Tuesday, August 29, 2023

Rundeck Add or Upload a Private Key - SSH keys

 

On the Rundeck Server go to $HOME directory of rundeck user

cd /home/rundeck
mkdir .ssh
cd .ssh
touch authorized_keys
touch known_hosts
ssh-keygen -t rsa
Use the Path /home/rundeck/.ssh/id_rsa

id_rsa and id_rsa.pub will be created.

echo "Content of id_rsa.pub" >> authorized_keys
echo "Content of id_rsa.pub" >> known_hosts

Copy the contents of id_rsa.pub, login to Target Node and go to Userid $HOME/.ssh which is used for login

cd $HOME/.ssh
touch authorized_keys
touch known_hosts
echo "Content of id_rsa.pub" >> authorized_keys
echo "Content of id_rsa.pub" >> known_hosts

Copy content of id_rsa from Target Node, login to Rundeck -> http://localhost:4440

Click on Settings -> Key storage -> Click on "Add or Upload a Key"

Key Type -> Private Key

Add the content into Enter Test box and Click Save


Now go to Project Settings -> Edit Configuration -> select SSH Authentication privateKey

or

Set the following in the Project Settings -> Edit Configuration -> Edit Configuration File

project.ssh-authentication=privateKey
project.ssh-key-passphrase-storage-path=keys/Login-Server
project.ssh-key-storage-path=keys/Login-Server


Now Click on JOBS -> select or create a job -> on workflow tab -> add steps



Run the job