Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
56acedd
Add "omBratteng" as contributor
omBratteng Jul 12, 2020
0816a56
Update the list of valid ssh keys.
omBratteng Jul 12, 2020
a0c6e0b
test_sshutil: Add testing for the new ssh keys
omBratteng Jul 15, 2020
8b95cc8
test_sshutil: Remove the key types that actually are signatures
omBratteng Jul 15, 2020
b5c3881
test_sshutil: Add a public key for each valid key type
omBratteng Jul 15, 2020
22761ba
test_sshutil: Test all the valid key types in the AuthKeyLineParser
omBratteng Jul 15, 2020
6f09bca
cc_ssh: Add a list of supported key types for the docs
omBratteng Jul 15, 2020
f77a723
ssh_util: remove dsa, ecdsa, ed25519 and rsa, as they're not actually…
omBratteng Jul 15, 2020
fa351e7
test_sshutil: remove dsa, ecdsa, ed25519 and rsa, as they're not actu…
omBratteng Jul 15, 2020
e96a9b5
test_sshutil: replace the rsa and dsa with ssh-rsa and ssh-dsa the pl…
omBratteng Jul 15, 2020
b6be5ba
This reverts commit e96a9b5, fa351e7, f77a723
omBratteng Jul 16, 2020
7471a22
test_sshutil: remove duplicate ecdsa
omBratteng Jul 16, 2020
aa0643a
test_sshutil: reduce the repetition of the key types by fetching them…
omBratteng Jul 16, 2020
7c4af7c
test_sshutil: add a disclaimer to not use the public keys from the tests
omBratteng Jul 16, 2020
40b4e68
ssh_util: inform why dsa, rsa, ecdsa and ed25519 are stil in the vali…
omBratteng Jul 16, 2020
33700fe
cc_ssh: add a pointer in the docs for authorized_keys where the list …
omBratteng Jul 16, 2020
143f5cf
ssh_util: add some information about where to get the list and how to…
omBratteng Jul 16, 2020
bdd846c
Merge branch 'master' into update-ssh-keys
omBratteng Jul 28, 2020
3712844
Added 6 more key types in function _is_printable_key() in cc_ssh_auth…
tsanghan Jul 25, 2020
5c549e5
cc_ssh_authkey_fingerprints: fix the `` for internal name
omBratteng Jul 28, 2020
f2026f7
cc_ssh_authkey_fingerprints: add all the supported ssh key types.
omBratteng Jul 28, 2020
9c6e558
ssh_util: add a pointer to update the `_is_printable_key` list
omBratteng Jul 28, 2020
5bd5b3c
cc_ssh_authkey_fingerprints: add a pointer to update the `VALID_KEY_T…
omBratteng Jul 28, 2020
57f39ea
Merge branch 'master' into update-ssh-keys
omBratteng Aug 6, 2020
aecc2f0
Merge branch 'master' into update-ssh-keys
omBratteng Aug 13, 2020
83faf9f
cc_ssh_authkey_fingerprints: import the `VALID_KEY_TYPES` from `ssh_u…
omBratteng Aug 13, 2020
ec094ed
Merge branch 'master' into update-ssh-keys
omBratteng Aug 20, 2020
7d96627
Merge branch 'master' into update-ssh-keys
mitechie Aug 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions cloudinit/config/cc_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,42 @@

no-port-forwarding,no-agent-forwarding,no-X11-forwarding

Supported public key types for the ``ssh_authorized_keys`` are:

- dsa
- rsa
- ecdsa
- ed25519
- ecdsa-sha2-nistp256-cert-v01@openssh.com
- ecdsa-sha2-nistp256
- ecdsa-sha2-nistp384-cert-v01@openssh.com
- ecdsa-sha2-nistp384
- ecdsa-sha2-nistp521-cert-v01@openssh.com
- ecdsa-sha2-nistp521
- 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-dss-cert-v01@openssh.com
- ssh-dss
- ssh-ed25519-cert-v01@openssh.com
- ssh-ed25519
- ssh-rsa-cert-v01@openssh.com
- ssh-rsa
- ssh-xmss-cert-v01@openssh.com
- ssh-xmss@openssh.com

.. note::
this list has been filtered out from the supported keytypes of
`OpenSSH`_ source, where the sigonly keys are removed. Please see
``ssh_util`` for more information.

``dsa``, ``rsa``, ``ecdsa`` and ``ed25519`` are added for legacy,
as they are valid public keys in some old distros. They can possibly
be removed in the future when support for the older distros are dropped

.. _OpenSSH: https://github.com/openssh/openssh-portable/blob/master/sshkey.c

Host Keys
^^^^^^^^^

Expand Down
6 changes: 3 additions & 3 deletions cloudinit/config/cc_ssh_authkey_fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
default, but can be disabled using ``no_ssh_fingerprints``. The hash type for
the keys can be specified, but defaults to ``sha256``.

**Internal name:** `` cc_ssh_authkey_fingerprints``
**Internal name:** ``cc_ssh_authkey_fingerprints``

**Module frequency:** per instance

Expand Down Expand Up @@ -59,8 +59,8 @@ def _gen_fingerprint(b64_text, hash_meth='sha256'):

def _is_printable_key(entry):
if any([entry.keytype, entry.base64, entry.comment, entry.options]):
if (entry.keytype and
entry.keytype.lower().strip() in ['ssh-dss', 'ssh-rsa']):
if (entry.keytype and entry.keytype.lower().strip()
in ssh_util.VALID_KEY_TYPES):
return True
return False

Expand Down
40 changes: 28 additions & 12 deletions cloudinit/ssh_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,43 @@
# See: man sshd_config
DEF_SSHD_CFG = "/etc/ssh/sshd_config"

# taken from OpenSSH source openssh-7.3p1/sshkey.c:
# static const struct keytype keytypes[] = { ... }
# this list has been filtered out from keytypes of OpenSSH source
# openssh-8.3p1/sshkey.c:
# static const struct keytype keytypes[] = {
# filter out the keytypes with the sigonly flag, eg:
# { "rsa-sha2-256", "RSA", NULL, KEY_RSA, 0, 0, 1 },
# refer to the keytype struct of OpenSSH in the same file, to see
# if the position of the sigonly flag has been moved.
#
# dsa, rsa, ecdsa and ed25519 are added for legacy, as they are valid
# public keys in some old distros. They can possibly be removed
# in the future when support for the older distros is dropped
#
# When updating the list, also update the _is_printable_key list in
# cloudinit/config/cc_ssh_authkey_fingerprints.py
VALID_KEY_TYPES = (
"dsa",
"rsa",
"ecdsa",
"ecdsa-sha2-nistp256",
"ed25519",
"ecdsa-sha2-nistp256-cert-v01@openssh.com",
"ecdsa-sha2-nistp384",
"ecdsa-sha2-nistp256",
"ecdsa-sha2-nistp384-cert-v01@openssh.com",
"ecdsa-sha2-nistp521",
"ecdsa-sha2-nistp384",
"ecdsa-sha2-nistp521-cert-v01@openssh.com",
"ed25519",
"rsa",
"rsa-sha2-256",
"rsa-sha2-512",
"ssh-dss",
"ecdsa-sha2-nistp521",
"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-dss-cert-v01@openssh.com",
"ssh-ed25519",
"ssh-dss",
"ssh-ed25519-cert-v01@openssh.com",
"ssh-rsa",
"ssh-ed25519",
"ssh-rsa-cert-v01@openssh.com",
"ssh-rsa",
"ssh-xmss-cert-v01@openssh.com",
"ssh-xmss@openssh.com",
)

_DISABLE_USER_SSH_EXIT = 142
Expand Down
Loading