Skip to content

Commit c33e9e0

Browse files
committed
(MODULES-10765) Implement ecdsa-sha2-nistp384-cert-v01@openssh.com support
1 parent eef4923 commit c33e9e0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/puppet/type/ssh_authorized_key.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ module Puppet
6464

6565
newvalues :'ssh-dss', :'ssh-rsa', :'ecdsa-sha2-nistp256', :'ecdsa-sha2-nistp384', :'ecdsa-sha2-nistp521', :'ssh-ed25519',
6666
:'sk-ecdsa-sha2-nistp256@openssh.com', :'sk-ssh-ed25519@openssh.com', :'ssh-rsa-cert-v01@openssh.com',
67-
:'ssh-ed25519-cert-v01@openssh.com', :'ssh-dss-cert-v01@openssh.com', :'ecdsa-sha2-nistp256-cert-v01@openssh.com'
67+
:'ssh-ed25519-cert-v01@openssh.com', :'ssh-dss-cert-v01@openssh.com', :'ecdsa-sha2-nistp256-cert-v01@openssh.com',
68+
:'ecdsa-sha2-nistp384-cert-v01@openssh.com'
6869

6970
aliasvalue(:dsa, :'ssh-dss')
7071
aliasvalue(:ed25519, :'ssh-ed25519')
@@ -167,7 +168,8 @@ def insync?(is)
167168
ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ecdsa-sk|ed25519-sk|
168169
sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com|
169170
ssh-rsa-cert-v01@openssh.com|ssh-ed25519-cert-v01@openssh.com|
170-
ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
171+
ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com|
172+
ecdsa-sha2-nistp384-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
171173
def self.keyline_regex
172174
REGEX
173175
end

spec/unit/type/ssh_authorized_key_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
:'ssh-rsa-cert-v01@openssh.com',
9292
:'ssh-ed25519-cert-v01@openssh.com',
9393
:'ssh-dss-cert-v01@openssh.com',
94-
:'ecdsa-sha2-nistp256-cert-v01@openssh.com'
94+
:'ecdsa-sha2-nistp256-cert-v01@openssh.com',
95+
:'ecdsa-sha2-nistp384-cert-v01@openssh.com'
9596
].each do |keytype|
9697
it "supports #{keytype}" do
9798
described_class.new(name: 'whev', type: keytype, user: 'nobody')
@@ -166,6 +167,12 @@
166167
end
167168
# rubocop:enable Metrics/LineLength
168169

170+
# rubocop:disable Metrics/LineLength
171+
it 'supports a valid ecdsa-sha2-nistp384-cert-v01@openssh.com key' do
172+
expect { described_class.new(name: 'bastelfreakwashere', type: :'ecdsa-sha2-nistp384-cert-v01@openssh.com', user: 'opensshrulez', key: 'AAAAKGVjZHNhLXNoYTItbmlzdHAzODQtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgh+/K6gv7WlwX9qVlKLH8Vurzo5xfc8/glVcT7auQOhIAAAAIbmlzdHAzODQAAABhBDouPHnR+OD4jfdqMbhFXTfB8vTjpZYLQSl0HxEXRAs8AgqDEZI1lJEVwdxtJUbczyu1Wj7wM45YpSpgUQVU38rmVkpxujqhhMMmqMWf87gnjm9oVLLFvJHdauKNnXjJQQAAAAAAAAAAAAAAAgAAABBob3N0LmV4YW1wbGUuY29tAAAAFAAAABBob3N0LmV4YW1wbGUuY29tAAAAAF8sWnQAAAAAYQw85wAAAAAAAAAAAAAAAAAAAIgAAAATZWNkc2Etc2hhMi1uaXN0cDM4NAAAAAhuaXN0cDM4NAAAAGEEOi48edH44PiN92oxuEVdN8Hy9OOllgtBKXQfERdECzwCCoMRkjWUkRXB3G0lRtzPK7VaPvAzjlilKmBRBVTfyuZWSnG6OqGEwyaoxZ/zuCeOb2hUssW8kd1q4o2deMlBAAAAgwAAABNlY2RzYS1zaGEyLW5pc3RwMzg0AAAAaAAAADBJccfmOaYjNVbqkx0X7cLpl53EzTAMdv9k159mBLYaepMnLYmhKx+LvfA5bAUTar4AAAAwSO7n770NIdhhMZjGio4GKDyKq2WW6QLRXleY6QcynBaQ90rkMVnt+jeIEs30h6F8') }.not_to raise_error # rubocop:disable Metrics/LineLength
173+
end
174+
# rubocop:enable Metrics/LineLength
175+
169176
it "doesn't support whitespaces" do
170177
expect { described_class.new(name: 'whev', type: :rsa, user: 'nobody', key: 'AAA FA==') }.to raise_error(Puppet::Error, %r{Key must not contain whitespace})
171178
end

0 commit comments

Comments
 (0)