{jenkins-plugin-info:ssh-agent|jiraComponent=ssh-agent|sourceDir=ssh-agent-plugin}

SSH Agent Plugin

This plugin allows you to provide SSH credentials to builds via a ssh-agent in Jenkins.

Requirements

Currently all Windows nodes (including the master) on which this plugin will be used must have the Apache Tomcat Native libraries installed. As of 1.0 should be unnecessary for Unix nodes. As of 1.14 unnecessary if ssh-agent is installed.

Configuring

First you need to add some SSH Credentials to your instance:

Jenkins | Manage Jenkins | Manage Credentials

Note that only Private Key based credentials can be used.

Then configure your build to use the credentials:

And then your build will have those credentials available, e.g.

From a Pipeline job, use the sshagent step.

Installation Example: MacOSX (10.7.5)

Irrelevant in 1.14+ when ssh-agent is available in the path.

Prerequisites:

Note that tomcat itself is not needed. This works fine with winstone (just running jenkins jar from command line).

Download and extract the tomcat native library: http://tomcat.apache.org/download-native.cgi

tar -zxvf tomcat-native-1.1.XX-src.tar.gz

Build the native library:

cd tomcat-native-1.1.XX/jni/native

./configure --with-apr=/usr/bin/apr-1-config

make && sudo make install

Build the java interface:

cd ..
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home

ant build

ant jar

Copy the output jar somewhere suitable for inclusion in your jenkins CLASSPATH.

Set environment variables prior to starting jenkins:

export DYLD_LIBRARY_PATH=/usr/local/apr/lib
export CLASSPATH=/path/to/tomcat-native-1.1.XX.jar
java -jar jenkins.war

Additionally, you might have to add bouncycastle to your JCE providers. If you attempt to use the plugin and get an exception like the following:

java.lang.IllegalStateException: BouncyCastle must be registered as a JCE provider

Then you may need to configure the jce provider. One way is to do this right in the JRE, so if Jenkins is using the same jdk as above, edit

/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre/lib/security/java.security, and add the following line:

security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider

Then, restart jenkins.

From there, configure using the instructions above.

Version History

Version 1.17 (2018-10-02)

Version 1.16 (2018-07-30)

Version 1.15 (2017-04-06)

Version 1.14 (2017-02-10)

Version 1.13 (2016-03-03)

Apparently does not work in some versions of Jenkins; see JENKINS-36935.

Version 1.12 (2016-03-03)

Version 1.11 (2016-03-03)

Version 1.10 (2016-03-03)

Version 1.9 (2015-12-07)

Changelog unrecorded.

Version 1.8 (2015-08-07)

Version 1.7 (2015-06-02)

Version 1.6 (2015-04-20)

Version 1.5 (2014-08-11)

Version 1.4.2 (2014-08-11)

Version 1.4.1 (2013-11-08)

Version 1.4 (2013-10-08)

Version 1.3 (2013-08-09)

Version 1.2 (2013-08-07)

Version 1.1 (2013-07-04)

Version 1.0 (2012-11-01)

Version 0.1 (2012-10-26)