blob: 1b2c4affc00313bd9688dd9996d6c4faf71bbe80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
require 'pathname'
Facter.add(:letsencrypt_bycertname) do
confine kernel: ['FreeBSD', 'Linux', 'OpenBSD']
setcode do
certs = {}
# locate the certificate repository
livedir = ['/etc/letsencrypt/live',
'/usr/local/etc/letsencrypt/live',
'/etc/certbot/live']
.map { |path| Pathname.new path }
.find(&:directory?)
unless livedir.nil?
Pathname.new(livedir).children.select(&:directory?).each do |path|
m = path.basename.to_s.match(%r{(.*?)(-\d+)?$})
certs[m[1]] = path.to_s
end
end
certs
end
end
|