Jenkins && Pipeline public/private Key errors

Source: Internet
Author: User
Tags ssh server rekey

1. Jenkins Test configuration failed:

Jenkins.plugins.publish_over. bappublisherexception:failed to connect and initialize SSH connection. Message: [Failed to connect sessions for config [Prop-idm.dxctech.tk-tianxia]. message [Auth fail]]


Solution:

run cmd as below:

[TX@PROP-IDM. ssh]$ cat id_rsa.pub >> Authorized_keys


2. Pipeline failed

Node (' slave1 ') {
Stage (' Update IDM version ') {
Sshagent (credentials:[' idm-version-update ']) {
sh "ssh-v-o stricthostkeychecking=no-l tiaxia prop-idm.dxctech.tk '/home/tiaxia/workshop/vpc-idm-service/ update-version.sh ${version} ' "
}

}

Stage (' Push to ftp Server ') {
SH "scp/opt/mount1/jenkinshome/workspace/propel-idm-distribution2/idm-vpc-part/target/packagetmp/ IDM-SERVICE-1.10.0-VPC1.22/WEB-INF/LIB/*.JARUFTP@EC4T01705.ITCS.ENTSVCS.NET:/VAR/FTP/DXC-VPC-IDM "
}

}

[Pipeline] node Running on ec4t01663.itcs.entsvcs.net_slave1 in/opt/mount1/jenkinshome/workspace/update-idm-version [Pipeline] {[Pipeline] stage [Pipeline] {(update IDM version) [Pipeline] sshagent [ssh-agent] Using credentials Tiaxia (idm-version-
Update) (prop-idm.dxctech.tk) [ssh-agent] Looking for ssh-agent implementation ...   [Ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine) $ ssh-agent ssh_auth_sock=/tmp/ssh-3ipzugmaul7r/agent.101746 SSH_AG ent_pid=101748 $ ssh-add/opt/mount1/jenkinshome/workspace/update-idm-version@tmp/private_key_ 5963022477772105576.key Identity added:/opt/mount1/jenkinshome/workspace/update-idm-version@tmp/private_key_ 5963022477772105576.key (/opt/mount1/jenkinshome/workspace/update-idm-version@tmp/private_key_
5963022477772105576.key) [Ssh-agent] started. [Pipeline] {[Pipeline] sh [update-idm-version] Running shell script + ssh-v-o stricthostkeychecking=no-l tiaxia. TK '/home/tiaxia/workshop/vpc-idm-service/update-version.Sh ' openssh_7.4p1, OpenSSL 1.0.2k-fips 2017 debug1:reading configuration data/etc/ssh/ssh_config debug1:/etc
/ssh/ssh_config line 56:applying options for * debug1:connecting to prop-idm.dxctech.tk [15.107.26.32] Port 22.
Debug1:connection established.  Debug1:identity File/home/jenkins/.ssh/id_rsa Type 1 debug1:key_load_public:No such file or directory debug1:identity File/home/jenkins/.ssh/id_rsa-cert type-1 debug1:key_load_public:No Such file or directory debug1:identity File/hom E/JENKINS/.SSH/ID_DSA type-1 debug1:key_load_public:No Such file or directory debug1:identity file/home/jenkins/.ssh/ Id_dsa-cert type-1 debug1:key_load_public:No Such file or directory debug1:identity FILE/HOME/JENKINS/.SSH/ID_ECDSA t Ype-1 debug1:key_load_public:No such file or directory debug1:identity File/home/jenkins/.ssh/id_ecdsa-cert type-1 D Ebug1:key_load_public:No such file or directory debug1:identity file/home/jenkins/.ssh/id_ed25519 type-1 debug1:key_Load_public:no such file or directory debug1:identity File/home/jenkins/.ssh/id_ed25519-cert type-1 debug1:enabling C Ompatibility mode for Protocol 2.0 debug1:local version string ssh-2.0-openssh_7.4 debug1:remote Protocol version 2.0, r emote software version openssh_6.6.1 debug1:match:openssh_6.6.1 Pat Openssh_6.6.1* Compat 0x04000000 ing to prop-idm.dxctech.tk:22 as ' Tiaxia ' Debug1:ssh2_msg_kexinit sent Debug1:ssh2_msg_kexinit received orithm:curve25519-sha256@libssh.org debug1:kex:host Key algorithm:ecdsa-sha2-nistp256 debug1:kex:server->client cipher:chacha20-poly1305@openssh.com MAC: <implicit> compression:none debug1:kex:client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression:none debug1:kex:curve25519-sha256@libssh.org need=
dh_need=64 debug1:kex:curve25519-sha256@libssh.org need=64 dh_need=64 debug1:expecting SSH2_MSG_KEX_ECDH_REPLY Debug1:server Host Key:ecdsa-sha2-nistp256 sha256:bywounkjzypigtopw1397leqkcfrm64jskiyj3bpqkm debug1:host ' prop-idm.dxctech.tk ' is known and matches the
ECDSA host key.
Debug1:found key in/home/jenkins/.ssh/known_hosts:11 Debug1:rekey after 134217728 blocks Debug1:ssh2_msg_newkeys sent Debug1:expecting Ssh2_msg_newkeys Debug1:ssh2_msg_newkeys received debug1:rekey after 134217728 blocks
_service_accept received debug1:authentications that can Continue:publickey,gssapi-keyex,gssapi-with-mic,password  Debug1:next authentication Method:gssapi-keyex Debug1:no Valid Key Exchange Context Debug1:next authentication method:  Gssapi-with-mic debug1:unspecified GSS failure.  Minor code may provide more information No Kerberos credentials available (default cache:file:/tmp/krb5cc_25929) DEBUG1:  Unspecified GSS failure.  Minor code may provide more information No Kerberos credentials available (default cache:file:/tmp/krb5cc_25929) DEBUG1: Next authentication Method:publickey debug1:offering RSA PublIC Key:/opt/mount1/jenkinshome/workspace/update-idm-version@tmp/private_key_5963022477772105576.key DEBUG1: Authentications can continue:publickey,gssapi-keyex,gssapi-with-mic,password debug1:offering RSA public key:/
Home/jenkins/.ssh/id_rsa debug1:authentications that can Continue:publickey,gssapi-keyex,gssapi-with-mic,password Debug1:trying private key:/home/jenkins/.ssh/id_dsa debug1:trying private key:/home/jenkins/.ssh/id_ecdsa debug1:try ing private key:/home/jenkins/.ssh/id_ed25519 debug1:next authentication Method:password debug1:read_passphrase:can ' T open/dev/tty:no such device or address debug1:authentications that can continue:publickey,gssapi-keyex,gssapi-with-m
Ic,password Permission denied, please try again.
Debug1:read_passphrase:can ' t open/dev/tty:no such device or address $ ssh-agent-k unset ssh_auth_sock;
Unset ssh_agent_pid;
Echo Agent pid 101748 killed; [Ssh-agent]
Stopped. Debug1:authentications that can Continue:publickey,gssapi-keyex, Gssapi-with-mic,password Permission denied, please try again. Debug1:read_passphrase:can ' t open/dev/tty:no such device or address debug1:authentications that can Continue:publick
Ey,gssapi-keyex,gssapi-with-mic,password Debug1:no more authentication methods to try.
Permission denied (Publickey,gssapi-keyex,gssapi-with-mic,password).
[Pipeline]} [Pipeline]//Sshagent [Pipeline]} [Pipeline]//Stage [Pipeline]} [Pipeline]/node [Pipeline] End of Pipeline ERROR: Script returned exit code 255 finished:failure


Solution:

Add Jenkins Server public key to Prop-idm.dxctech.tk:/home/tiaxia/.ssh/authorized_keys


3.

Stage (' Push to ftp Server ') {
SH "scp/opt/mount1/jenkinshome/workspace/propel-idm-distribution2/idm-vpc-part/target/packagetmp/ IDM-SERVICE-1.10.0-VPC1.22/WEB-INF/LIB/*.JARUFTP@EC4T01705.ITCS.ENTSVCS.NET:/VAR/FTP/DXC-VPC-IDM "
}

[Pipeline] {(Push to FTP Server)
[Pipeline] SH
[update-idm-version] Running shell script
+ scp/opt/mount1/jenkinshome/workspace/ propel-idm-distribution2/idm-vpc-part/target/packagetmp/idm-service-1.10.0-vpc1.22/web-inf/lib/ Idm-authn-1.10.0-vpc1.22.jar UFTP@EC4T01705.ITCS.ENTSVCS.NET:/VAR/FTP/DXC-VPC-IDM
Host Key Verification failed .
Lost connection
[Pipeline]}
[Pipeline]//Stage
[Pipeline]}
[Pipeline]//Node
[Pipeline] End of Pipeline
Error:script returned exit code 1
finished:failure

Solution

Check the permissions on your homedirectory,. SSH directory, and the Authorized_keys file: ifyour SSH server is Running with ' strictmodes on ', it'll refuse to use yourpublic keys in the ~/.ssh/authorized_keys file. Your home directory should bewritable only by you, ~/.SSH should is, and Authorized_keys should be 600

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.