From 59c0272ec779cb917e5e1cabe779cc03bea7be47 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 26 Mar 2014 20:55:36 +0000 Subject: [PATCH] Log everything when selected to do so --- etc/inc/filter.inc | 186 ++++++++++++++++++++++----------------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 5fd549c6ff..308bf26c8a 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2646,10 +2646,10 @@ function filter_rules_generate() { #--------------------------------------------------------------------------- # default deny rules #--------------------------------------------------------------------------- -block in $log inet all tracker {$increment_tracker($tracker)} label "Default deny rule IPv4" -block out $log inet all tracker {$increment_tracker($tracker)} label "Default deny rule IPv4" -block in $log inet6 all tracker {$increment_tracker($tracker)} label "Default deny rule IPv6" -block out $log inet6 all tracker {$increment_tracker($tracker)} label "Default deny rule IPv6" +block in {$log} inet all tracker {$increment_tracker($tracker)} label "Default deny rule IPv4" +block out {$log} inet all tracker {$increment_tracker($tracker)} label "Default deny rule IPv4" +block in {$log} inet6 all tracker {$increment_tracker($tracker)} label "Default deny rule IPv6" +block out {$log} inet6 all tracker {$increment_tracker($tracker)} label "Default deny rule IPv6" # IPv6 ICMP is not auxilary, it is required for operation # See man icmp6(4) @@ -2661,24 +2661,24 @@ block out $log inet6 all tracker {$increment_tracker($tracker)} label "Default d # 134 routeradv Router advertisement # 135 neighbrsol Neighbor solicitation # 136 neighbradv Neighbor advertisement -pass quick inet6 proto ipv6-icmp from any to any icmp6-type {1,2,135,136} tracker {$increment_tracker($tracker)} keep state +pass {$log} quick inet6 proto ipv6-icmp from any to any icmp6-type {1,2,135,136} tracker {$increment_tracker($tracker)} keep state # Allow only bare essential icmpv6 packets (NS, NA, and RA, echoreq, echorep) -pass out quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {129,133,134,135,136} tracker {$increment_tracker($tracker)} keep state -pass out quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {129,133,134,135,136} tracker {$increment_tracker($tracker)} keep state -pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state -pass in quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state -pass in quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state +pass out {$log} quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {129,133,134,135,136} tracker {$increment_tracker($tracker)} keep state +pass out {$log} quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {129,133,134,135,136} tracker {$increment_tracker($tracker)} keep state +pass in {$log} quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state +pass in {$log} quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state +pass in {$log} quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} tracker {$increment_tracker($tracker)} keep state # We use the mighty pf, we cannot be fooled. -block quick inet proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} -block quick inet proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} -block quick inet6 proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} -block quick inet6 proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} +block {$log} quick inet proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} +block {$log} quick inet proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} +block {$log} quick inet6 proto { tcp, udp } from any port = 0 to any tracker {$increment_tracker($tracker)} +block {$log} quick inet6 proto { tcp, udp } from any to any port = 0 tracker {$increment_tracker($tracker)} # Snort package -block quick from to any tracker {$increment_tracker($tracker)} label "Block snort2c hosts" -block quick from any to tracker {$increment_tracker($tracker)} label "Block snort2c hosts" +block {$log} quick from to any tracker {$increment_tracker($tracker)} label "Block snort2c hosts" +block {$log} quick from any to tracker {$increment_tracker($tracker)} label "Block snort2c hosts" EOD; @@ -2726,7 +2726,7 @@ EOD; * Support for allow limiting of TCP connections by establishment rate * Useful for protecting against sudden outburts, etc. */ - $ipfrules .= "block in quick from to any tracker 1000000400 label \"virusprot overload table\"\n"; + $ipfrules .= "block in {$log} quick from to any tracker 1000000400 label \"virusprot overload table\"\n"; $saved_tracker += 100; $tracker = $saved_tracker; @@ -2770,8 +2770,8 @@ EOD; $listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : $cpcfg['zoneid']; $portalias = $listenporthttps; $portalias .= " {$listenporthttp}"; - $ipfrules .= "pass in quick on { {$cpinterface} } proto tcp from any to { {$cpaddresses} } port { {$portalias} } tracker {$increment_tracker($tracker)} keep state(sloppy)\n"; - $ipfrules .= "pass out quick on { {$cpinterface} } proto tcp from any to any flags any tracker {$increment_tracker($tracker)} keep state(sloppy)\n"; + $ipfrules .= "pass in {$log} quick on { {$cpinterface} } proto tcp from any to { {$cpaddresses} } port { {$portalias} } tracker {$increment_tracker($tracker)} keep state(sloppy)\n"; + $ipfrules .= "pass out {$log} quick on { {$cpinterface} } proto tcp from any to any flags any tracker {$increment_tracker($tracker)} keep state(sloppy)\n"; } } } @@ -2797,17 +2797,27 @@ EOD; block in $bogonlog quick on \${$oc['descr']} from to any tracker {$increment_tracker($tracker)} label "{$fix_rule_label("block bogon IPv4 networks from {$oc['descr']}")}" EOD; + + if(isset($config['system']['ipv6allow'])) { + $ipfrules .= << to any tracker {$increment_tracker($tracker)} label "{$fix_rule_label("block bogon IPv6 networks from {$oc['descr']}")}" + +EOD; + } } + $saved_tracker += 10; $tracker = $saved_tracker; if(isset($config['system']['ipv6allow']) && ($oc['type6'] == "slaac" || $oc['type6'] == "dhcp6")) { $ipfrules .= << to any tracker {$increment_tracker($tracker)} label "{$fix_rule_label("block bogon IPv6 networks from {$oc['descr']}")}" - -EOD; - } - $isbridged = false; if(is_array($config['bridges']['bridged'])) { foreach ($config['bridges']['bridged'] as $oc2) { @@ -2868,16 +2869,16 @@ EOD; case "pptp": $ipfrules .= << "") { $ipfrules .= <<