Skip to content

Commit c33e9e0

Browse files
committed
(MODULES-10765) Implement [email protected] 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
67-
67+
68+
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
169170
170-
171+
172+
[email protected])\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
9292
9393
94-
94+
95+
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 [email protected] key' do
172+
expect { described_class.new(name: 'bastelfreakwashere', type: :'[email protected]', 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)