aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Meusel <tim@bastelfreak.de>2020-08-06 21:35:33 +0200
committerTim Meusel <tim@bastelfreak.de>2020-09-06 17:28:12 +0200
commitc33e9e02d8374441eb9feef20613a7a9da8c62ca (patch)
tree49ea2b29c2f2d162fec47f0f75affb3ba5122f59
parenteef4923bebf6ea2c2dc9e37526b95782cb63089c (diff)
downloadpuppet-sshkeys_core-c33e9e02d8374441eb9feef20613a7a9da8c62ca.tar.gz
puppet-sshkeys_core-c33e9e02d8374441eb9feef20613a7a9da8c62ca.tar.bz2
(MODULES-10765) Implement ecdsa-sha2-nistp384-cert-v01@openssh.com support
-rw-r--r--lib/puppet/type/ssh_authorized_key.rb6
-rw-r--r--spec/unit/type/ssh_authorized_key_spec.rb9
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index ce8fd92..f34ef9c 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -64,7 +64,8 @@ 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', :'ecdsa-sha2-nistp256-cert-v01@openssh.com'
+ :'ssh-ed25519-cert-v01@openssh.com', :'ssh-dss-cert-v01@openssh.com', :'ecdsa-sha2-nistp256-cert-v01@openssh.com',
+ :'ecdsa-sha2-nistp384-cert-v01@openssh.com'
aliasvalue(:dsa, :'ssh-dss')
aliasvalue(:ed25519, :'ssh-ed25519')
@@ -167,7 +168,8 @@ 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|ecdsa-sha2-nistp256-cert-v01@openssh.com)\s+([^ ]+)\s*(.*)$}x
+ ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com|
+ ecdsa-sha2-nistp384-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 6d1d391..14c65f7 100644
--- a/spec/unit/type/ssh_authorized_key_spec.rb
+++ b/spec/unit/type/ssh_authorized_key_spec.rb
@@ -91,7 +91,8 @@ describe Puppet::Type.type(:ssh_authorized_key), unless: Puppet.features.microso
:'ssh-rsa-cert-v01@openssh.com',
:'ssh-ed25519-cert-v01@openssh.com',
:'ssh-dss-cert-v01@openssh.com',
- :'ecdsa-sha2-nistp256-cert-v01@openssh.com'
+ :'ecdsa-sha2-nistp256-cert-v01@openssh.com',
+ :'ecdsa-sha2-nistp384-cert-v01@openssh.com'
].each do |keytype|
it "supports #{keytype}" do
described_class.new(name: 'whev', type: keytype, user: 'nobody')
@@ -166,6 +167,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-nistp384-cert-v01@openssh.com key' do
+ 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
+ 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