Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of obsolete trilead-putty key #200

Merged
merged 7 commits into from
Mar 27, 2024

Conversation

olamy
Copy link
Member

@olamy olamy commented Mar 21, 2024

Signed-off-by: Olivier Lamy [email protected]

Testing done

Submitter checklist

Preview Give feedback

…-api which was really used

Signed-off-by: Olivier Lamy <[email protected]>
@olamy olamy marked this pull request as ready for review March 21, 2024 08:35
@olamy olamy requested a review from a team as a code owner March 21, 2024 08:35
@olamy olamy added the bug label Mar 21, 2024
@jtnord
Copy link
Member

jtnord commented Mar 21, 2024

I have no idea how often putty style keys are used (mostly generated from windows users I guess), but if we need to the spec is public.

@olamy olamy added enhancement and removed bug labels Mar 21, 2024
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up #199 I guess.

olamy added 2 commits March 22, 2024 06:23
@olamy olamy requested a review from jglick March 22, 2024 08:46
olamy and others added 2 commits March 23, 2024 03:58
String key = reader.toOpenSSH(privateKey, passphrase);
if(key != null) {
privateKeys.add(key);
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to break out of the outer loop (meaning adding a label) rather than the inner loop. Otherwise for a PuTTY key you will add two entries to privateKeys.

(Is there no test coverage for this?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well I'm really tempted to remove this putty key extension as this is not up to date and doesn't even work with current version of PuTTy.
using something such puttygen -t rsa -b 2048 -o mykey.ppk uttygen -t rsa -b 2048 -o mykey.ppk
you get a file starting with

PuTTY-User-Key-File-3: ssh-rsa

This key will simply generate a NPE because of this line https://github.com/kohsuke/trilead-putty-extension/blob/e928d8b5cc80a35d521b05e8256bdd5100cba616/src/main/java/org/kohsuke/putty/PuTTYKey.java#L149

So I'm just tempted to remove this code which simply doesn't work anymore...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTR v3 was released with 0.75 which was 2021-05-08 so it almost 3 years ago.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in the last 3 years, no single key created with PuTTy could have been used.
I couldn't find any issue reported in Jira...
It looks like we can remove the support of the PuTTy key format.
I'm not sure why someone re-invented the wheel by inventing another format.

https://xkcd.com/927/

Signed-off-by: Olivier Lamy <[email protected]>
Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to remove, but I'm sure someone will be using an old V2 key from a server configured long ago...
Not sure why putty keys were not using a different Key source to begin with though

Signed-off-by: Olivier Lamy <[email protected]>
@olamy olamy changed the title Make trilead-putty extension as optional, transitive deps via trilead-api which was really used Remove usage of obsolete trilead-putty key Mar 27, 2024
@olamy olamy added removed and removed enhancement labels Mar 27, 2024
@olamy olamy requested review from jglick and jtnord March 27, 2024 01:56
@olamy
Copy link
Member Author

olamy commented Mar 27, 2024

Seems reasonable to remove, but I'm sure someone will be using an old V2 key from a server configured long ago...

Easy bet to win :)

Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me, but will delay merging to let others have an opinion

@jglick jglick merged commit 7732563 into jenkinsci:master Mar 27, 2024
15 checks passed
@salsifis
Copy link

Seems reasonable to remove, but I'm sure someone will be using an old V2 key from a server configured long ago... Not sure why putty keys were not using a different Key source to begin with though

I can announce that you won your bet :)

Here is, for those who will encounter this problem, how to convert your older PuTTY credentials to more standard ones:

  • Open PuTTYgen
  • Load your key in the PuTTY format (.ppk) using the passphrase
  • Click “Conversions” › Export OpenSSH key (force new file format)

The resulting file can be used as the private key in a new credentials entry, with the same passphrase.

@jglick
Copy link
Member

jglick commented Mar 28, 2024

@salsifis I took the liberty of adding your instructions (unconfirmed) to https://github.com/jenkinsci/ssh-credentials-plugin/releases/tag/334.v7732563deee1 for better discoverability. @olamy / @jtnord should this be reverted and the originally proposed extension point reintroduced?

@jtnord
Copy link
Member

jtnord commented Mar 28, 2024

. @olamy / @jtnord should this be reverted and the originally proposed extension point reintroduced?

I am in 2 minds here.
on the one hand I do not like breaking things,
on the other the ep (and the old code as implemented) seemed to violate the kiss principal, and the UI does not purport to support these keys (nor does it purport to support OpenSSH keys - so that may be a moot point, however it is producing only OpenSSH based keys for use).

@olamy olamy deleted the make-triled-putty-key-optional branch March 29, 2024 00:19
@olamy
Copy link
Member Author

olamy commented Mar 29, 2024

@salsifis congratulations! bravo :)
I agree it's usually not a good idea to break things.
But here the putty key support is kind of obscure (not even clearly documented and coming transitively from some libraries called trilead-....) and really poor as we do not support keys generated by the last version of Putty.
The migration of the key looks to be very easy and thanks @jglick adding it to the release notes.

@salsifis
Copy link

@olamy @jtnord

In my opinion the main problem here is that this end of support was not announced (no warnings or whatever in the Jenkins interface). We had to look at the Jenkins logs and do some research to understand why an update caused the jobs to abort.

It would be better to have warnings if deprecations are on the table.

@jtnord
Copy link
Member

jtnord commented Apr 2, 2024

@olamy can you add the compatable-since to the hpi plugin configuration (denoting the first version that removed the support) - that way it will at least get the warning to prompt users to go to the release notes.

@olamy
Copy link
Member Author

olamy commented Apr 3, 2024

That sounds like a good idea. #202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants