Skip to content

Commit 12a157e

Browse files
committed
MODULES-11100 - Add sk-ecdsa pubkey support to accounts_ssh_authorized_keys_line_parser_string
1 parent 1e60e10 commit 12a157e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/puppet/functions/accounts_ssh_authorized_keys_line_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
end
1717

1818
def accounts_ssh_authorized_keys_line_parser_string(str)
19-
matched = str.match(%r{((ssh-|ecdsa-)[^\s]+)\s+([^\s]+)\s+(.*)$})
19+
matched = str.match(%r{((sk-ecdsa-|ssh-|ecdsa-)[^\s]+)\s+([^\s]+)\s+(.*)$})
2020
raise ArgumentError, 'Wrong Keyline format!' unless matched && matched.length == 5
2121
options = str[0, str.index(matched[0])].rstrip
2222
[options, matched[1], matched[3], matched[4]]

spec/acceptance/user_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
test_key = 'AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8Hfd'\
66
'OV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9W'\
77
'hQ=='
8+
ecdsa_test_key = 'AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNlpEm6+RwCiQXgQAb0P1asEAxCJDVtm/YYyUbdSifCbri98fjs1C/03pm9yLRQ0W/S70S8AhDCMjVFA07WzjOQ='
9+
ecdsa_sk_test_key = 'AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBAjkGvdKC05udQc82xGWWSKHbmJyBoa/oCq+2FiU6udqQyx0uOEC3YZAjvygBSdIo5vCpDELqJxaNQGQEkeUyYYAAAAEc3NoOg=='
810

911
pp_accounts_define = <<-PUPPETCODE
1012
file { '/test':
@@ -22,7 +24,9 @@
2224
bash_profile_content => file('accounts/shell/bash_profile'),
2325
sshkeys => [
2426
'ssh-rsa #{test_key} vagrant',
25-
'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2'
27+
'command="/bin/echo Hello",from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2',
28+
'ecdsa-sha2-nistp256 #{ecdsa_test_key} vagrant3',
29+
'[email protected] #{ecdsa_sk_test_key} vagrant4'
2630
],
2731
}
2832
PUPPETCODE
@@ -52,7 +56,9 @@
5256
bash_profile_content => file('accounts/shell/bash_profile'),
5357
sshkeys => [
5458
'ssh-rsa #{test_key} vagrant',
55-
'from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2'
59+
'from="myhost.example.com,192.168.1.1" ssh-rsa #{test_key} vagrant2',
60+
'ecdsa-sha2-nistp256 #{ecdsa_test_key} vagrant3',
61+
'[email protected] #{ecdsa_sk_test_key} vagrant4'
5662
],
5763
}
5864
PUPPETCODE

0 commit comments

Comments
 (0)