From f4b02f3ec31b4628b27567c6765a8c148c30a531 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 28 Jul 2016 19:45:51 +0000 Subject: [PATCH] Add onion service facter to learn onion hostname --- modules/debian-org/lib/facter/onion-services.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 modules/debian-org/lib/facter/onion-services.rb diff --git a/modules/debian-org/lib/facter/onion-services.rb b/modules/debian-org/lib/facter/onion-services.rb new file mode 100644 index 000000000..08aa1349a --- /dev/null +++ b/modules/debian-org/lib/facter/onion-services.rb @@ -0,0 +1,13 @@ +Facter.add("onion_hostname") do + services = {} + + Dir['/var/lib/tor/onion/*/hostname'].each do |p| + dir = File.dirname(p) + service = File.basename(dir) + hostname = IO.read(p).chomp + services[service] = hostname + end + setcode do + services + end +end -- 2.20.1