summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet @ jormungand <asmadeus@codewreck.org>2021-05-23 15:25:53 +0200
committerDominique Martinet @ jormungand <asmadeus@codewreck.org>2021-05-25 14:12:13 +0200
commitf456ebc6bea6ffe03af0a9a8345a671da58163a2 (patch)
treea298b64b519730fd4dcc7793372e111d106a0e0c
parentb92723d70b8a3579ed0ed4673563b1deef51fe01 (diff)
tor: add prometheus tor exporter
-rw-r--r--profiles/tor.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/profiles/tor.nix b/profiles/tor.nix
index 8cfa5bd..553da32 100644
--- a/profiles/tor.nix
+++ b/profiles/tor.nix
@@ -1,5 +1,19 @@
{ config, lib, pkgs, ... }:
-{
+let
+ wgCfg = config.services.codewreck.wireguard.machines;
+ wgIp = wgCfg."${config.networking.hostName}".ip;
+in {
services.tor.enable = true;
+ services.tor.settings = {
+ ControlPort = [{port = 9051; addr = "127.0.0.1"; }];
+ };
+
+ networking.firewall.extraCommands = ''
+ ip6tables -A nixos-fw -i wg0 -m tcp -p tcp --dport 9130 -m comment --comment tor-exporter -j nixos-fw-accept
+ '';
+ services.prometheus.exporters.tor = {
+ enable = true;
+ listenAddress = "${wgIp}";
+ };
}