summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2018-08-03 13:21:00 +0000
committerGitHub <noreply@github.com>2018-08-03 13:21:00 +0000
commitcb691b987fc51763733b3817588f148073d43052 (patch)
tree20c0a05355b36ac28e6ad42a230052a58b5dd0c0 /nixos
parent30b3f277b6854b18f6dc06e39e66b638bf945efd (diff)
parent9216da8928bc17878635ef50dac089f01a8c6466 (diff)
downloadnixpkgs-cb691b987fc51763733b3817588f148073d43052.tar
nixpkgs-cb691b987fc51763733b3817588f148073d43052.tar.gz
nixpkgs-cb691b987fc51763733b3817588f148073d43052.tar.bz2
nixpkgs-cb691b987fc51763733b3817588f148073d43052.tar.lz
nixpkgs-cb691b987fc51763733b3817588f148073d43052.tar.xz
nixpkgs-cb691b987fc51763733b3817588f148073d43052.tar.zst
nixpkgs-cb691b987fc51763733b3817588f148073d43052.zip
Merge pull request #44394 from mayflower/exporter-firewall-fix
nixos/prometheus-exporters: use nixos-fw chain
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix
index 9c58a15bcd7..1d5f400250f 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters.nix
@@ -73,7 +73,7 @@ let
       description = ''
         Specify a filter for iptables to use when
         <option>services.prometheus.exporters.${name}.openFirewall</option>
-        is true. It is used as `ip46tables -I INPUT <option>firewallFilter</option> -j ACCEPT`.
+        is true. It is used as `ip46tables -I nixos-fw <option>firewallFilter</option> -j nixos-fw-accept`.
       '';
     };
     user = mkOption {
@@ -116,9 +116,10 @@ let
 
   mkExporterConf = { name, conf, serviceOpts }:
     mkIf conf.enable {
-      networking.firewall.extraCommands = mkIf conf.openFirewall ''
-        ip46tables -I INPUT ${conf.firewallFilter} -j ACCEPT
-      '';
+      networking.firewall.extraCommands = mkIf conf.openFirewall (concatStrings [
+        "ip46tables -I nixos-fw ${conf.firewallFilter} "
+        "-m comment --comment ${name}-exporter -j nixos-fw-accept"
+      ]);
       systemd.services."prometheus-${name}-exporter" = mkMerge ([{
         wantedBy = [ "multi-user.target" ];
         after = [ "network.target" ];