From: [email protected] <[email protected]> On Behalf Of Ivan Fernandez Calvo Sent: Wednesday, February 5, 2020 11:12 AM To: Jenkins Users <[email protected]> Subject: [SOCIAL NETWORK] Re: SSH Remote Host not being able to connect
I understand you have a Jenkins instance that runs on a windows machine and you want to use a Linux machine as an agent connected by SSH * Create an SSH key pair (public/private) Ran the command “ssh-keygen -t rsa -C "Jenkins agent key" -f "jenkinsAgent_rsa" “ * Create an SSH credential in the Jenkins machine and put the private key there Created the credentials and put jenkinsAgent_rsa into it. * Create an SSH agent see https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#configure-launch-agents-via-ssh<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjenkinsci%2Fssh-slaves-plugin%2Fblob%2Fmaster%2Fdoc%2FCONFIGURE.md%23configure-launch-agents-via-ssh&data=02%7C01%7Cssanders%40nycopportunity.nyc.gov%7Ca3b05396379a43b03ffc08d7aa5625a1%7C73d61799c28440228d4154cc4f1929ef%7C0%7C0%7C637165160528450979&sdata=ZwAy47%2Fxj2JYsbcVzz3gIvnFEvY%2BeFromHWpDgfOcoo%3D&reserved=0> – This is creating a node which I didn’t do before – so I created the node and selected the credential with the private key. The verification strategy slect is non-verifying. * Select the SSH credential created before as credentials * Chose the verification strategy that you want, see the documentation, if you have problems start with the "Non verifying Verification Strategy" you can change it later * Add the public key on ~/.ssh/authorized_keys This was done I tried to relaunch the node and got the following: [02/05/20 12:57:13] [SSH] Opening SSH connection to msslva-hhsmdm07.csc.nycnet:22. [02/05/20 12:57:13] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection. ERROR: Server rejected the 1 private key(s) for mdmadmin (credentialId:c6bf4c24-0a05-43ca-a9be-3dfc149c6d0f/method:publickey) [02/05/20 12:57:13] [SSH] Authentication failed. Authentication failed. [02/05/20 12:57:13] Launch failed - cleaning up connection [02/05/20 12:57:13] [SSH] Connection closed. Not sure where this log you are talking about. Is this on the Windows machine running Jenkins? Previously I did not create a Node. I simply added an entry in the Manage Jenkins --> Configure System --> SSH Remote Host section – added an entry here selecting that credential. In the Project I would select “Execute shell script on remote host using SSH” . But the SSH Remote Host entry is also failing on connecting to the machine. I am able to do WinSCP from the Jenkins machine to the remote host with the same user id. this should work, if not you should see some error messages on the agent logs page "JENKISN_URL/computer/AGENT_NAME/log", if nothing works see https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/TROUBLESHOOTING.md#common-info-needed-to-troubleshooting-a-bug<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjenkinsci%2Fssh-slaves-plugin%2Fblob%2Fmaster%2Fdoc%2FTROUBLESHOOTING.md%23common-info-needed-to-troubleshooting-a-bug&data=02%7C01%7Cssanders%40nycopportunity.nyc.gov%7Ca3b05396379a43b03ffc08d7aa5625a1%7C73d61799c28440228d4154cc4f1929ef%7C0%7C0%7C637165160528460936&sdata=TtU9Z%2FwVB0FXOEV0BNB8%2Bp%2B6hcfxPGPYMnrDPpkPFeg%3D&reserved=0> there you have the information needed to troubleshoot an SSH issue El martes, 4 de febrero de 2020, 21:53:45 (UTC+1), Sholom Sanders escribió: On my remote Linux machine I created a private/public key to communicate with Jenkins on my Windows machine. I put the public key into authorized_keys. In Jenkins, I created a credential for this user and pasted in the private key. I then went to Manage Jenkins --> Configure System to the SSH Remote Hosts. I created a new one with the Linux machine name and port 22 and selected the newly created credential. When I click on check connection, I am getting "Can't connect to server". I had created two other SSH remote hosts successfully. But this lone is not going through and I am not sure how to track down the solution. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/72ae6f7e-fa54-4be5-add3-9337d70835d4%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fjenkinsci-users%2F72ae6f7e-fa54-4be5-add3-9337d70835d4%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Cssanders%40nycopportunity.nyc.gov%7Ca3b05396379a43b03ffc08d7aa5625a1%7C73d61799c28440228d4154cc4f1929ef%7C0%7C0%7C637165160528460936&sdata=mGUTOiSTXtV3HOq9gWBq%2Bnq2xpHTHsE7MRn%2BgoyfLvc%3D&reserved=0>. ________________________________ This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/BL0PR0901MB4356F0713FDDFE42729B9144F2020%40BL0PR0901MB4356.namprd09.prod.outlook.com.
