Tech Tidbit #2 — Configuring proxy credentials on Jenkins
Nov 9, 2020
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):
- Sudo into your proxy id on the remote client → sudo su — proxyid
- Change to hidden ssh directory → cd .ssh
- Run ssh-keygen to generate your public and private key pair → ssh-keygen
- When prompted for a passphrase, you may or may not input it. Two files will be generated (id_rsa and id_rsa.pub)
- Set permissions on the hidden ssh directory → chmod 700 .ssh
- copy the public key from the pair generated in Step 3 to authorized keys file → cat id_rsa.pub >> authorized_keys
- Set permissions of authorized keys → chmod 600 authorized_keys
- Print and copy private key to add to Jenkins → cat id_rsa
Jenkins Side:
- 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!