Skip to content

Commit

Permalink
SSH key check is too strict
Browse files Browse the repository at this point in the history
Keys with BEGIN OPENSSH PRIVATE KEY are also valid

Reported on mailing list: https://groups.google.com/g/jenkinsci-users/c/GwDegE_BdMg
  • Loading branch information
amedee committed Apr 13, 2021
1 parent c25c122 commit c64692f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/hudson/plugins/ec2/EC2Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,9 +1102,11 @@ public FormValidation doCheckSshKeysCredentialsId(@QueryParameter String value)
BufferedReader br = new BufferedReader(new StringReader(privateKey));
String line;
while ((line = br.readLine()) != null) {
if (line.equals("-----BEGIN RSA PRIVATE KEY-----"))
if (line.equals("-----BEGIN RSA PRIVATE KEY-----") ||
line.equals("-----BEGIN OPENSSH PRIVATE KEY-----"))
hasStart = true;
if (line.equals("-----END RSA PRIVATE KEY-----"))
if (line.equals("-----END RSA PRIVATE KEY-----") ||
line.equals("-----END OPENSSH PRIVATE KEY-----"))
hasEnd = true;
}
if (!hasStart)
Expand Down

0 comments on commit c64692f

Please sign in to comment.