I tested several methods to connect an Agent to a Master but none of those works
I would like to use native ssh client to connect to my Agents.
SSH plugin randomly disconnects.
- Jenkins LTS
- CloudBees Jenkins Enterprise (CJE)
- SSH Slave plugin
- CloudBees SSH Agents
You could launch the agent with a command in the master and use command line SSH to do that. It uses a SSH native command to make the tunnel. It could be a way to move forward while you diagnose the main issue.
Use this command to launch the Agent, you have to replace words in capitals by your own values
ssh -i PATH_TO_KEY_WITHOUT_PASSPHRASE USER@HOST "cd AGENT_HOME_DIR && curl -O http://JENKINS_URL/jnlpJars/slave.jar && java -jar slave.jar"
You need a RSA key without passphrase and need to add this key as authorised key on each Agent (~/.ssh/authorized_keys)
ssh-keygen -t rsa -f $HOME/.ssh/test_rsa
Use this command to add the key to authorized keys in Agent, so that you can access the Agent from Master using that key
ssh-copy-id -i$HOME/.ssh/test_rsa USER@HOST