Cannot connect slave "Caused by: java.io.IOException: Invalid PEM structure, '-----BEGIN...' missing"

2,717 views
Skip to first unread message

Kamal Ahmed

unread,
Jun 18, 2013, 10:51:43 AM6/18/13
to jenkins...@googlegroups.com
I am using Jenkins ver. 1.518, on Centos 6.4 , and trying to connect to a CentOs 6.4 Slave but getting exception:


ERROR: Failed to authenticate as jenkins with credential=a5504c8f-3302-40bd-ab4b-8c689e64c84f
java.io.IOException: Publickey authentication failed.
	at com.trilead.ssh2.auth.AuthenticationManager.authenticatePublicKey(AuthenticationManager.java:264)
	at com.trilead.ssh2.Connection.authenticateWithPublicKey(Connection.java:445)
	at com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.doAuthenticate(TrileadSSHPublicKeyAuthenticator.java:92)
	at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.authenticate(SSHAuthenticator.java:262)
	at com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.authenticate(SSHAuthenticator.java:282)
	at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:918)
	at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:479)
	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:223)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Invalid PEM structure, '-----BEGIN...' missing
	at com.trilead.ssh2.crypto.PEMDecoder.parsePEM(PEMDecoder.java:138)
	at com.trilead.ssh2.crypto.PEMDecoder.decode(PEMDecoder.java:313)
	at com.trilead.ssh2.auth.AuthenticationManager.authenticatePublicKey(AuthenticationManager.java:173)
	... 12 more
[06/18/13 10:45:18] [SSH] Authentication failed.
hudson.AbortException: Authentication failed.
	at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:923)
	at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:479)
	at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:223)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:662)
[06/18/13 10:45:18] [SSH] Connection closed.

Seth Floyd

unread,
Jun 17, 2014, 2:18:47 PM6/17/14
to jenkins...@googlegroups.com, kamal22...@yahoo.com
Did you ever figure this out? Im getting the same thing and im stumped. I can connect just fine if I ssh from master to the slave using the key...but not when I try to launch the slave from inside Jenkins.

Daniel Beck

unread,
Jun 17, 2014, 3:22:08 PM6/17/14
to jenkins...@googlegroups.com

On 17.06.2014, at 20:18, Seth Floyd <sethf...@gmail.com> wrote:

> Did you ever figure this out? Im getting the same thing and im stumped. I can connect just fine if I ssh from master to the slave using the key...but not when I try to launch the slave from inside Jenkins.

The credentials are somehow wrong. Make sure you didn't specify the path to the key file, or your public key, in the "Enter directly" key field of the SSH credential used for the slave.

Seth Floyd

unread,
Jun 18, 2014, 10:19:49 AM6/18/14
to jenkins...@googlegroups.com
Finally got it to work after i pasted the infor from the private key into the "Enter directly" field. Even though that doesnt work for another credential where we point to the .pub file using the "SSH username with private key" option.
Thanks any ways.

S



--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/4WA-K3aDNg0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Beck

unread,
Jun 18, 2014, 1:34:15 PM6/18/14
to jenkins...@googlegroups.com

On 18.06.2014, at 16:19, Seth Floyd <se...@sethfloydjr.com> wrote:

> where we point to the .pub file using the "SSH username with private key" option

That cannot possibly work. ".pub" indicates a public key.

Seth Floyd

unread,
Jun 18, 2014, 2:02:22 PM6/18/14
to jenkins...@googlegroups.com
Yep...but it does work. It was setup like this before I got here so i know I didnt do that.



Richard Bywater

unread,
Jun 18, 2014, 5:07:12 PM6/18/14
to jenkins...@googlegroups.com
I'll repeat what Daniel said and say it cannot possibly have worked - maybe it possibly had a cached private key somewhere that got lost along the way as there is no way you can you a public key for that purpose. The only other option I can think of is the .pub file isn't actually a public key (which is breaking convention) and perhaps Jenkins has changed to recognise the extensions. 

All these are guesses except for the part that there is no way a public key would work :)

Richard.


--
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 jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages