I have Jenkins ver. 2.205
in Windows 10
and I have the following situation
Configure Global Security
has Enable security
checked.id_rsa_jenkins
and id_rsa_jenkins.pub
keys. The value of the public key was added to Jenkins for my account in SSH Public Keys
.jenkins-cli.jar
file, downloaded from http://localhost:9090/cli/
When I execute the following (split in multiple lines for presentation purposes):
java -jar jenkins-cli.jar
-s http://localhost:9090/
-i C:\Users\windowsusername/.ssh/id_rsa_jenkins
-ssh
-user jenkinsusername
help
Appears:
Enter passphrase for C:\Users\windowsusername\.ssh\id_rsa_jenkins:
I write the valid passphrase and then appears the following:
Nov 23, 2019 11:28:22 AM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider
INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider
Nov 23, 2019 11:28:22 AM hudson.cli.SSHCLI sshConnection
WARNING: No header 'X-SSH-Endpoint' returned by Jenkins
As shown above, does not appear the expected data
It happens for any Jenkins CLI
command, such as:
etc.
What is missing or wrong?
For the audience:
The instructions provided in the original post are mandatory. But the following instructions are mandatory too:
SSH
pluginConfigure Global Security
, in the SSH Server
section (in the bottom), proceed to enable it, in this case I use the Fixed
value option.Note seems the random
option is only useful for the jenkins-cli.jar
case. It because through the SSH
connection (i.e: ssh -l jenkinsusername -p 2020 localhost list-jobs
) is mandatory know the port, in this case 2020
.
Therefore Fixed
or Random
is viable for jenkins-cli.jar
(it does not ask for use a port number) but for SSH
connection is mandatory know the port number (here Fixed
is need it)
Furthemore in Jenkins SSH indicates:
Configuration
By default, Jenkins will listen on a random available port, so as not to break
existing deployments. But this is most likely not very useful, so the administrator
is encouraged to change this from the global security configuration page by assigning
a fixed port. This configuration UI will also allow you to disable this feature.
Was very valuable this video: