I have a question about
https://github.com/jenkinsci/ec2-plugin. It may be a bug, but I'd like to have confirmation before I try to find out how to file a bug report.
boolean hasStart = false, hasEnd = false;
BufferedReader br = new BufferedReader(new StringReader(privateKey));
String line;
while ((line = br.readLine()) != null) {
if (line.equals("-----BEGIN RSA PRIVATE KEY-----"))
hasStart = true;
if (line.equals("-----END RSA PRIVATE KEY-----"))
hasEnd = true;
}
if (!hasStart)
return FormValidation.error("This doesn't look like a private key at all");
if (!hasEnd)
return FormValidation
.error("The private key is missing the trailing 'END RSA PRIVATE KEY' marker. Copy&paste error?");
I have generated an ed25519 key, with
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519
SSH version:
OpenSSH_8.4p1 Ubuntu-5ubuntu1, OpenSSL 1.1.1j 16 Feb 2021
This key looks like
-----BEGIN OPENSSH PRIVATE KEY-----
(...)
-----END OPENSSH PRIVATE KEY-----
I can successfully use this key to connect to manually started instances (with Manage Nodes -> Add New Node).
I can not use this key to connect to an instance started by the EC2 plugin. The EC2 plugin tells me "This doesn't look like a private key at all".
It appears as if the validation is too strict.
Workaround:
In the private key file, I replaced
-----BEGIN OPENSSH PRIVATE KEY-----
(...)
-----END OPENSSH PRIVATE KEY-----
with
-----BEGIN RSA PRIVATE KEY-----
(...)
-----END RSA PRIVATE KEY-----
Can someone confirm if this is an actual bug, or is the problem at my end?