Skip to content

Commit 6ae3516

Browse files
committed
ssh: Add fact for generated user keys
Add a fact that contains the public keys for all keys generated with ssh::client::user_key.
1 parent d4a7957 commit 6ae3516

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
Facter.add(:ssh_local_keys) do
4+
confine do
5+
File.directory?('/etc/ssh/local_keys.d/')
6+
end
7+
setcode do
8+
hash = {}
9+
10+
Dir.glob('/etc/ssh/local_keys.d/*.pub').each do |file|
11+
filename = file.split('/').last.gsub('.pub', '')
12+
content = File.read(file)
13+
hash[filename] = content.chomp
14+
end
15+
16+
hash
17+
end
18+
end

0 commit comments

Comments
 (0)