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
- is true. It is used as `ip46tables -I INPUT -j ACCEPT`.
+ is true. It is used as `ip46tables -I nixos-fw -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" ];