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.

In 
https://github.com/jenkinsci/ec2-plugin/blob/master/src/main/java/hudson/plugins/ec2/EC2Cloud.java
 
there is the following validation in doCheckSshKeysCredentialsId:

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?
If it is a bug, then how do I proceed to file a bug report? The repo 
at https://github.com/jenkinsci/ec2-plugin only has pull requests, no issue 
tracker.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/26dd4e46-c712-4b98-9559-d929c129bd06n%40googlegroups.com.

Reply via email to