Tech Tidbit #2 — Configuring proxy credentials on Jenkins

Configuring your username and password for connecting to a remote client from Jenkins is easy. But how would you configure a proxy/group id for authentication to remote clients from Jenkins. It does not typically have a password(or atleast the password is managed only by admins)

Steps:

Client Side(Open up terminal or some command line):

  1. Sudo into your proxy id on the remote client → sudo su — proxyid
  2. Change to hidden ssh directory → cd .ssh
  3. Run ssh-keygen to generate your public and private key pair → ssh-keygen
  4. When prompted for a passphrase, you may or may not input it. Two files will be generated (id_rsa and id_rsa.pub)
  5. Set permissions on the hidden ssh directory → chmod 700 .ssh
  6. copy the public key from the pair generated in Step 3 to authorized keys file → cat id_rsa.pub >> authorized_keys
  7. Set permissions of authorized keys → chmod 600 authorized_keys
  8. Print and copy private key to add to Jenkins → cat id_rsa

Jenkins Side:

  1. Open up Global Credentials from the side bar as follows:

2. Click on “Add Credentials” and then select the Kind as “SSH Username with Private Key” and fill in the private key copied from step 8 above and also the passphrase that you gave when you generated the key(if any).Click ok

All set!

--

--