blob: c2a6cca358fa1992df0579175bf14b3280cdd51a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
Facter.add(:tor_hidden_services) do
confine :kernel => "Linux"
setcode do
config_file = '/etc/tor/torrc'
if File.exists?(config_file)
dirs = File.read(config_file).split("\n").select{|l|
l =~ /^HiddenServiceDir/
}.collect{|l| l.sub(/^HiddenServiceDir /,'') }
dirs.inject({}) { |res,d|
if File.exists?(h=File.join(d,'hostname'))
res[File.basename(d)] = File.read(h).chomp
end
res
}
else
{}
end
end
end
|