Skip to content

Commit eef4923

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

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/puppet/type/ssh_authorized_key.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ 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'
67+
:'ssh-ed25519-cert-v01@openssh.com', :'ssh-dss-cert-v01@openssh.com', :'ecdsa-sha2-nistp256-cert-v01@openssh.com'
6868

6969
aliasvalue(:dsa, :'ssh-dss')
7070
aliasvalue(:ed25519, :'ssh-ed25519')
@@ -167,7 +167,7 @@ def insync?(is)
167167
ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ecdsa-sk|ed25519-sk|
168168
sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com|
169169
ssh-rsa-cert-v01@openssh.com|ssh-ed25519-cert-v01@openssh.com|
170-
ssh-dss-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
170+
ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
171171
def self.keyline_regex
172172
REGEX
173173
end

spec/unit/type/ssh_authorized_key_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
:'ed25519-sk', :'sk-ssh-ed25519@openssh.com',
9191
:'ssh-rsa-cert-v01@openssh.com',
9292
:'ssh-ed25519-cert-v01@openssh.com',
93-
:'ssh-dss-cert-v01@openssh.com'
93+
:'ssh-dss-cert-v01@openssh.com',
94+
:'ecdsa-sha2-nistp256-cert-v01@openssh.com'
9495
].each do |keytype|
9596
it "supports #{keytype}" do
9697
described_class.new(name: 'whev', type: keytype, user: 'nobody')
@@ -159,6 +160,12 @@
159160
end
160161
# rubocop:enable Metrics/LineLength
161162

163+
# rubocop:disable Metrics/LineLength
164+
it 'supports a valid ecdsa-sha2-nistp256-cert-v01@openssh.com key' do
165+
expect { described_class.new(name: 'bastelfreakwashere', type: :'ecdsa-sha2-nistp256-cert-v01@openssh.com', user: 'opensshrulez', key: 'AAAAKGVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAgQUGk9Pzd+RqECXZMmgj8bFEumUGfZPEhJhyUusF7hvwAAAAIbmlzdHAyNTYAAABBBBmo/Yw8pVDSObTkJxlpYL5s9tVnpj7ubeky+PKY2zJ8pRYIHS3XJ6x/NyB/iFoYlGxrn4CaMPwNvYxvSEdTj60AAAAAAAAAAAAAAAIAAAAQaG9zdC5leGFtcGxlLmNvbQAAABQAAAAQaG9zdC5leGFtcGxlLmNvbQAAAABfLFfgAAAAAGEMOkIAAAAAAAAAAAAAAAAAAABoAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBmo/Yw8pVDSObTkJxlpYL5s9tVnpj7ubeky+PKY2zJ8pRYIHS3XJ6x/NyB/iFoYlGxrn4CaMPwNvYxvSEdTj60AAABjAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAABIAAAAIGkErINcPm1MpBhKuUmdR0KAPJGZCSeGT9E6FafcVhlFAAAAIERD5WsflI5QdJETz3n64tIDcdPbUF0GQW8iP8EV+Nf5') }.not_to raise_error # rubocop:disable Metrics/LineLength
166+
end
167+
# rubocop:enable Metrics/LineLength
168+
162169
it "doesn't support whitespaces" do
163170
expect { described_class.new(name: 'whev', type: :rsa, user: 'nobody', key: 'AAA FA==') }.to raise_error(Puppet::Error, %r{Key must not contain whitespace})
164171
end

0 commit comments

Comments
 (0)