aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Meusel <tim@bastelfreak.de>2020-08-06 21:31:27 +0200
committerTim Meusel <tim@bastelfreak.de>2020-09-06 17:27:48 +0200
commiteef4923bebf6ea2c2dc9e37526b95782cb63089c (patch)
tree6f05ecae25bbd38a72388260272e068cd89c69a2
parent1743b72e06d33e85b8eec11582f4b13fb59bfa3c (diff)
downloadpuppet-sshkeys_core-eef4923bebf6ea2c2dc9e37526b95782cb63089c.tar.gz
puppet-sshkeys_core-eef4923bebf6ea2c2dc9e37526b95782cb63089c.tar.bz2
(MODULES-10765) Implement ecdsa-sha2-nistp256-cert-v01@openssh.com support
-rw-r--r--lib/puppet/type/ssh_authorized_key.rb4
-rw-r--r--spec/unit/type/ssh_authorized_key_spec.rb9
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index 4a4fb24..ce8fd92 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -64,7 +64,7 @@ module Puppet
newvalues :'ssh-dss', :'ssh-rsa', :'ecdsa-sha2-nistp256', :'ecdsa-sha2-nistp384', :'ecdsa-sha2-nistp521', :'ssh-ed25519',
:'sk-ecdsa-sha2-nistp256@openssh.com', :'sk-ssh-ed25519@openssh.com', :'ssh-rsa-cert-v01@openssh.com',
- :'ssh-ed25519-cert-v01@openssh.com', :'ssh-dss-cert-v01@openssh.com'
+ :'ssh-ed25519-cert-v01@openssh.com', :'ssh-dss-cert-v01@openssh.com', :'ecdsa-sha2-nistp256-cert-v01@openssh.com'
aliasvalue(:dsa, :'ssh-dss')
aliasvalue(:ed25519, :'ssh-ed25519')
@@ -167,7 +167,7 @@ module Puppet
ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ecdsa-sk|ed25519-sk|
sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com|
ssh-rsa-cert-v01@openssh.com|ssh-ed25519-cert-v01@openssh.com|
- ssh-dss-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
+ ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
def self.keyline_regex
REGEX
end
diff --git a/spec/unit/type/ssh_authorized_key_spec.rb b/spec/unit/type/ssh_authorized_key_spec.rb
index 90c1dc3..6d1d391 100644
--- a/spec/unit/type/ssh_authorized_key_spec.rb
+++ b/spec/unit/type/ssh_authorized_key_spec.rb
@@ -90,7 +90,8 @@ describe Puppet::Type.type(:ssh_authorized_key), unless: Puppet.features.microso
:'ed25519-sk', :'sk-ssh-ed25519@openssh.com',
:'ssh-rsa-cert-v01@openssh.com',
:'ssh-ed25519-cert-v01@openssh.com',
- :'ssh-dss-cert-v01@openssh.com'
+ :'ssh-dss-cert-v01@openssh.com',
+ :'ecdsa-sha2-nistp256-cert-v01@openssh.com'
].each do |keytype|
it "supports #{keytype}" do
described_class.new(name: 'whev', type: keytype, user: 'nobody')
@@ -159,6 +160,12 @@ describe Puppet::Type.type(:ssh_authorized_key), unless: Puppet.features.microso
end
# rubocop:enable Metrics/LineLength
+ # rubocop:disable Metrics/LineLength
+ it 'supports a valid ecdsa-sha2-nistp256-cert-v01@openssh.com key' do
+ 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
+ end
+ # rubocop:enable Metrics/LineLength
+
it "doesn't support whitespaces" do
expect { described_class.new(name: 'whev', type: :rsa, user: 'nobody', key: 'AAA FA==') }.to raise_error(Puppet::Error, %r{Key must not contain whitespace})
end