[JIRA] (JENKINS-60629) Openshift injection of ssh private key into jenkins needs manual update to work for SSH Agent

6 views
Skip to first unread message

julian.d.stamp@gmail.com (JIRA)

unread,
Jan 3, 2020, 5:17:02 AM1/3/20
to jenkinsc...@googlegroups.com
Julian Stamp created an issue
 
Jenkins / Bug JENKINS-60629
Openshift injection of ssh private key into jenkins needs manual update to work for SSH Agent
Issue Type: Bug Bug
Assignee: Unassigned
Components: ssh-agent-plugin
Created: 2020-01-03 10:16
Environment: OpenShift Master: v3.11.129
Jenkins: 2.164.2
Sync plugin: 1.0.34
SSH agent plugin: 1.17
Priority: Minor Minor
Reporter: Julian Stamp

I am configuring a permanent ssh agent in a Jenkins pod that runs on an Openshift cluster and for that purpose I inject the private ssh key from an openshift secret.

When I deploy the jenkins pod, the ssh agent does not manage to start. The error message is:

[09/30/19 08:48:54] [SSH] Opening SSH connection to ${server-adress}:22.
[09/30/19 08:48:56] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for jenkins
 (credentialId:project-ssh-agent/method:publickey)
[09/30/19 08:48:56] [SSH] Authentication failed.
Authentication failed.
[09/30/19 08:48:56] Launch failed - cleaning up connection
[09/30/19 08:48:56] [SSH] Connection closed. 

In order to get the connection working, I go to the credentials store in the Jenkins UI https://${jenkins-url}/credentials/store/system/domain/_/credential/project-ssh-agent/update, go to Update credentials and click on Save without having changed anything about the credentials.

Clicking on relaunch agent now spawns the agent using the ssh connection to connect to the remote server as configured.

Considerations

The injection works fine and the resulting ssh-key in the Jenkins credentials store can directly be used for ssh-based git checkouts. I previously had opened a ticket about this with the openshift jenkins-sync-plugin support (https://github.com/openshift/jenkins-sync-plugin/issues/345).

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

julian.d.stamp@gmail.com (JIRA)

unread,
Jan 3, 2020, 5:18:02 AM1/3/20
to jenkinsc...@googlegroups.com
Julian Stamp updated an issue
Change By: Julian Stamp
I am configuring a permanent ssh agent in a Jenkins pod that runs on an Openshift cluster and for that purpose I inject the private ssh key from an openshift secret.

When I deploy the jenkins pod, the ssh agent does not manage to start. The error message is:
{code: java bash }

[09/30/19 08:48:54] [SSH] Opening SSH connection to ${server-adress}:22.
[09/30/19 08:48:56] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for jenkins
(credentialId:project-ssh-agent/method:publickey)
[09/30/19 08:48:56] [SSH] Authentication failed.
Authentication failed.
[09/30/19 08:48:56] Launch failed - cleaning up connection
[09/30/19 08:48:56] [SSH] Connection closed. {code}
In order to get the connection working, I go to the credentials store in the Jenkins UI {{https://${jenkins-url}/credentials/store/system/domain/_/credential/project-ssh-agent/update}}, go to {{Update}} credentials and click on {{Save}} without having changed anything about the credentials.


Clicking on {{relaunch agent}} now spawns the agent using the ssh connection to connect to the remote server as configured.
h3. Considerations

The injection works fine and the resulting ssh-key in the Jenkins credentials store can directly be used for ssh-based git checkouts. I previously had opened a ticket about this with the openshift jenkins-sync-plugin support ([https://github.com/openshift/jenkins-sync-plugin/issues/345)|https://github.com/openshift/jenkins-sync-plugin/issues/345).].

julian.d.stamp@gmail.com (JIRA)

unread,
Jan 3, 2020, 5:20:02 AM1/3/20
to jenkinsc...@googlegroups.com
Julian Stamp updated an issue
Change By: Julian Stamp
Environment:
OpenShift Master: v3.11.129
Jenkins: 2.164.2
Sync Jenkins sync plugin: 1.0.34
SSH agent plugin: 1.17
Reply all
Reply to author
Forward
0 new messages