@ferm::rule { "dsa-apache":
domain => "(ip ip6)",
description => "Allow web access",
- rule => "proto tcp mod state state (NEW) dport (80) ACCEPT"
+ rule => "&SERVICE(tcp, 80)"
}
}
@ferm::rule { "dsa-exim":
domain => "(ip ip6)",
description => "Allow smtp access",
- rule => "proto tcp mod state state (NEW) dport (25) ACCEPT"
+ rule => "&SERVICE(tcp, 25)"
}
}
##
@def &SERVICE($proto, $port) = {
- domain (ip ip6) chain INPUT proto $proto dport $port ACCEPT;
+ proto $proto mod state state (NEW) dport $port ACCEPT;
}
-@def &V4_SERVICE($proto, $port) = {
- domain ip chain INPUT proto $proto dport $port ACCEPT;
+@def &SERVICE_RANGE($proto, $port, $srange) = {
+ proto $proto mod state state (NEW) dport $port saddr ($srange) ACCEPT;
}
-@def &V6_SERVICE($proto, $port) = {
- domain ip6 chain INPUT proto $proto dport $port ACCEPT;
-}
-
-@def &V4_SERVICE_RANGE($proto, $port, $srange) = {
- domain ip chain INPUT proto $proto dport $port saddr $srange ACCEPT;
-}
-
-@def &V6_SERVICE_RANGE($proto, $port, $srange) = {
- domain ip6 chain INPUT proto $proto dport $port saddr $srange ACCEPT;
+@def &TCP_UDP_SERVICE($port) = {
+ proto tcp mod state state (NEW) dport $port ACCEPT;
+ proto udp mod state state (NEW) dport $port ACCEPT;
}
@def $HOST_MUNIN = (192.25.206.57 192.25.206.33);
@ferm::rule { "dsa-bind":
domain => "(ip ip6)",
description => "Allow nameserver access",
- rule => "proto (udp tcp) mod state state (NEW) dport (53) ACCEPT"
+ rule => "&TCP_UDP_SERVICE(53)"
}
}
@ferm::rule { "dsa-ntp":
domain => "(ip ip6)",
description => "Allow ntp access",
- rule => "proto udp mod state state (NEW) dport (123) ACCEPT"
+ rule => "&SERVICE(udp, 123)"
}
}