Skip to content

Commit eef4923

Browse files
committed
(MODULES-10765) Implement [email protected] 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
67-
67+
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
169169
170-
[email protected])\s+([^ ]+)\s*(.*)$}x
170+
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', :'[email protected]',
9191
9292
93-
93+
94+
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 [email protected] key' do
165+
expect { described_class.new(name: 'bastelfreakwashere', type: :'[email protected]', 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)