Merge ~larsks/cloud-init:fedora/1151824 into cloud-init:master

Proposed by Lars Kellogg-Stedman
Status: Merged
Merged at revision: 853df0a0e85002582694b88db886f206f64b23c7
Proposed branch: ~larsks/cloud-init:fedora/1151824
Merge into: cloud-init:master
Diff against target: 47 lines (+15/-1)
2 files modified
cloudinit/ssh_util.py (+3/-0)
tests/unittests/test_sshutil.py (+12/-1)
Reviewer Review Type Date Requested Status
cloud-init Commiters Pending
Review via email: mp+315263@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

The change looks fine, but I'd really like to have a test case showing the failure and it fixed.

testing cloudinit/config/cc_ssh.py:apply_credentials or even just
cloudinit/ssh_util.py:setup_user_keys would be great.

Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :

I've provided an updated test. It fails under master, but succeeds with this patch applied.

Revision history for this message
Scott Moser (smoser) wrote :

Great, thank you!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
2index be8a49e..b95b956 100644
3--- a/cloudinit/ssh_util.py
4+++ b/cloudinit/ssh_util.py
5@@ -22,8 +22,11 @@ DEF_SSHD_CFG = "/etc/ssh/sshd_config"
6 VALID_KEY_TYPES = (
7 "dsa",
8 "ecdsa",
9+ "ecdsa-sha2-nistp256",
10 "ecdsa-sha2-nistp256-cert-v01@openssh.com",
11+ "ecdsa-sha2-nistp384",
12 "ecdsa-sha2-nistp384-cert-v01@openssh.com",
13+ "ecdsa-sha2-nistp521",
14 "ecdsa-sha2-nistp521-cert-v01@openssh.com",
15 "ed25519",
16 "rsa",
17diff --git a/tests/unittests/test_sshutil.py b/tests/unittests/test_sshutil.py
18index 55971b5..6d45f90 100644
19--- a/tests/unittests/test_sshutil.py
20+++ b/tests/unittests/test_sshutil.py
21@@ -32,6 +32,11 @@ VALID_CONTENT = {
22 "YWpMfYdPUnE7u536WqzFmsaqJctz3gBxH9Ex7dFtrxR4qiqEr9Qtlu3xGn7Bw07"
23 "/+i1D+ey3ONkZLN+LQ714cgj8fRS4Hj29SCmXp5Kt5/82cD/VN3NtHw=="
24 ),
25+ 'ecdsa-sha2-nistp256': (
26+ "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMy/WuXq5MF"
27+ "r5hVQ9EEKKUTF7vUaOkgxUh6bNsCs9SFMVslIm1zM/WJYwUv52LdEePjtDYiV4A"
28+ "l2XthJ9/bs7Pc="
29+ )
30 }
31
32 TEST_OPTIONS = (
33@@ -44,7 +49,13 @@ class TestAuthKeyLineParser(test_helpers.TestCase):
34 def test_simple_parse(self):
35 # test key line with common 3 fields (keytype, base64, comment)
36 parser = ssh_util.AuthKeyLineParser()
37- for ktype in ['rsa', 'ecdsa', 'dsa']:
38+ ecdsa_types = [
39+ 'ecdsa-sha2-nistp256',
40+ 'ecdsa-sha2-nistp384',
41+ 'ecdsa-sha2-nistp521',
42+ ]
43+
44+ for ktype in ['rsa', 'ecdsa', 'dsa'] + ecdsa_types:
45 content = VALID_CONTENT[ktype]
46 comment = 'user-%s@host' % ktype
47 line = ' '.join((ktype, content, comment,))

Subscribers

People subscribed via source and target branches