Update the list of valid ssh keys.#487
Conversation
|
I tried testing locally with tox, worked fine. But not sure what the best way to test the newly added keys are. |
OddBloke
left a comment
There was a problem hiding this comment.
Hi @omBratteng, thanks for the submission! The actual change here LGTM, it just needs tests adding to https://github.com/canonical/cloud-init/blob/master/tests/unittests/test_sshutil.py. (The last time this was done was in 853df0a which should give you a rough idea of how to proceed. 👍)
|
Thanks @OddBloke, I'll try to get some tests. I'm a bit unfamiliar with tox, is there a way I can run the specific test https://github.com/canonical/cloud-init/blob/master/tests/unittests/test_sshutil.py ? |
|
Thanks for the update @omBratteng! You've presumably figured this out, but I notice that the tests only include new cases for a subset of the key types you're adding; is it feasible to expand that list out further, to cover all the newly-added types? |
|
(Oh and as a note to my future self: I have confirmed you've signed the CLA.) |
|
I just spun up a faster VM for running the tests, but I'll try it later. |
|
On Tue, Jul 14, 2020 at 05:57:01AM -0700, Ole-Martin Bratteng wrote:
I just spun up a faster VM for running the tests, but I'll try it later.
Fair enough!
Yeah, I can try to add tests for the -cert variants too, I just have
never used ssh certs. I can also add tests for the rest of the valid
SSH keys, as I see it's just a subset of all the valid ones.
Thanks, that would be much appreciated!
|
Update ssh_util.py with latest list of keys (from openssh-8.3p1/sshkey.c), Added keys: rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com sk-ecdsa-sha2-nistp256@openssh.com sk-ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com ssh-xmss-cert-v01@openssh.com ssh-xmss@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com
Thanks to @djmdjm for pointing me in the right direction.
… a valid entry in authorized_keys They are just the short names used for human interactions, e.g. "ssh-keygen -t rsa" and they should never appear in public keys
…ally a valid entry in authorized_keys
|
@OddBloke added more tests now, and removed some key types which @djmdjm pointed out for me which actually are signatures. |
Older versions of OpenSSH (I tested with 7.2, the version in Ubuntu 16.04 which we still actively backport cloud-init to) will allow you to SSH in if an (I'm running to a meeting, so haven't reviewed anything more than this.) |
|
Gotcha, I can either revert the last three commits, or just f77a723 which is the one that removes |
|
I'd opt for reverting all three commits, if you're happy doing that? |
Revert "test_sshutil: replace the rsa and dsa with ssh-rsa and ssh-dsa the places I missed it" Revert "test_sshutil: remove dsa, ecdsa, ed25519 and rsa, as they're not actually a valid entry in authorized_keys" Revert "ssh_util: remove dsa, ecdsa, ed25519 and rsa, as they're not actually a valid entry in authorized_keys"
|
Commits reverted |
OddBloke
left a comment
There was a problem hiding this comment.
Thanks for the update! Determining the list of public key types is more involved than I was expecting, so I've asked for an update to an explanatory comment inline (and also have a minor test improvement Q).
… from the valid content
…of supported key types come from
|
I've added some comments, both in the source and docs, about where the list comes from. Let me know if you want me to change to wording of it, writing documentation for this sized project isn't something I have done before. |
|
Related PR: #506. |
…key_fingerprints module
Also includes the legacy dsa, rsa, ecdsa and ed25519
…YPES` when updating `_is_printable_key`
OddBloke
left a comment
There was a problem hiding this comment.
One question about the additional commit that was added here.
…tl` to reduce duplicate lists
Review comments were addressed sufficiently by the author. So, I'm dismissing this review as "addressed" by the author
Update ssh_util.py with latest list of keys (from openssh-8.3p1/sshkey.c),
Added keys:
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com
sk-ecdsa-sha2-nistp256@openssh.com
sk-ssh-ed25519-cert-v01@openssh.com
sk-ssh-ed25519@openssh.com
ssh-xmss-cert-v01@openssh.com
ssh-xmss@openssh.com
LP: #1877869