diff --git a/plist b/plist index c2a84b6a3..975577bc3 100644 --- a/plist +++ b/plist @@ -36,8 +36,6 @@ /usr/local/etc/inc/notices.smtp.inc /usr/local/etc/inc/plugins.inc /usr/local/etc/inc/plugins.inc.d/dnsmasq.inc -/usr/local/etc/inc/plugins.inc.d/if_group.inc -/usr/local/etc/inc/plugins.inc.d/if_legacy_opt.inc /usr/local/etc/inc/plugins.inc.d/ipfw.inc /usr/local/etc/inc/plugins.inc.d/ipsec.inc /usr/local/etc/inc/plugins.inc.d/ipsec/auth-user.php diff --git a/src/etc/inc/plugins.inc.d/if_group.inc b/src/etc/inc/plugins.inc.d/if_group.inc deleted file mode 100644 index 5e8ec2d1b..000000000 --- a/src/etc/inc/plugins.inc.d/if_group.inc +++ /dev/null @@ -1,49 +0,0 @@ - true); - $oc['networks'] = array(); - $oc['if'] = $ifgen['ifname']; - $oc['descr'] = $ifgen['ifname']; - $oc['virtual'] = true; - $oc['type'] = 'group'; - $interfaces[$ifgen['ifname']] = $oc; - } - } - - return $interfaces; -} diff --git a/src/etc/inc/plugins.inc.d/if_legacy_opt.inc b/src/etc/inc/plugins.inc.d/if_legacy_opt.inc deleted file mode 100644 index 2a1b4862a..000000000 --- a/src/etc/inc/plugins.inc.d/if_legacy_opt.inc +++ /dev/null @@ -1,84 +0,0 @@ - "pass", "log" => !isset($config['syslog']['nologdefaultpass'])); - - /* - * pass traffic between statically routed subnets and the subnet on the - * interface in question to avoid problems with complicated routing - * topologies - */ - if (isset($config['filter']['bypassstaticroutes']) && isset($config['staticroutes']['route']) && count($config['staticroutes']['route'])) { - $FilterIflist = filter_generate_optcfg_array(); - filter_generate_gateways(); // loads global $GatewaysList - - foreach (get_staticroutes() as $route) { - $friendly = $GatewaysList[$route['gateway']]['friendlyiface']; - if (is_array($FilterIflist[$friendly])) { - $oc = $FilterIflist[$friendly]; - $routeent = explode("/", $route['network']); - if (is_ipaddrv4($routeent[0]) && is_ipaddrv4($oc['ip'])) { - $sa = $oc['sa']; - $sn = $oc['sn']; - } elseif (is_ipaddrv6($routeent[0]) && is_ipaddrv6($oc['ipv6'])) { - $sa = $oc['sav6']; - $sn = $oc['snv6']; - } else { - continue; - } - - $networks = array(); - $networks[] = array('from' => "{$sa}/{$sn}", 'to' => $route['network']); - $networks[] = array('to' => "{$sa}/{$sn}", 'from' => $route['network']); - foreach ($networks as $network) { - $fw->registerFilterRule(10, - array('interface' => $friendly, 'statetype' => 'sloppy', - 'protocol' => 'tcp','flags' => 'any', 'from' => $network['from'], - 'to' => $network['to'], 'quick' => false, - 'label' => "pass traffic between statically routed subnets"), - $defaults['pass'] - ); - $fw->registerFilterRule(10, - array('interface' => $friendly, 'statetype' => 'sloppy', - 'from' => $network['from'],'to' => $network['to'], 'quick' => false, - 'label' => "pass traffic between statically routed subnets"), - $defaults['pass'] - ); - } - } - } - } -} diff --git a/src/etc/inc/plugins.inc.d/pf.inc b/src/etc/inc/plugins.inc.d/pf.inc index b4e41a0aa..1394ed7d9 100644 --- a/src/etc/inc/plugins.inc.d/pf.inc +++ b/src/etc/inc/plugins.inc.d/pf.inc @@ -1,6 +1,7 @@ All rights reserved. @@ -47,3 +48,82 @@ function pf_services() return $services; } + +function pf_interfaces() +{ + global $config; + + $interfaces = array(); + + /* add interface groups */ + if (isset($config['ifgroups']['ifgroupentry'])) { + foreach($config['ifgroups']['ifgroupentry'] as $ifgen) { + $oc = array("enable" => true); + $oc['networks'] = array(); + $oc['if'] = $ifgen['ifname']; + $oc['descr'] = $ifgen['ifname']; + $oc['virtual'] = true; + $oc['type'] = 'group'; + $interfaces[$ifgen['ifname']] = $oc; + } + } + + return $interfaces; +} + +/** + * options we should probably remove from the system at some point, lets make them plugabble before removal + */ +function pf_firewall($fw) +{ + global $config, $GatewaysList; + + $defaults = array(); + $defaults['pass'] = array("type" => "pass", "log" => !isset($config['syslog']['nologdefaultpass'])); + + /* + * pass traffic between statically routed subnets and the subnet on the + * interface in question to avoid problems with complicated routing + * topologies + */ + if (isset($config['filter']['bypassstaticroutes']) && isset($config['staticroutes']['route']) && count($config['staticroutes']['route'])) { + $FilterIflist = filter_generate_optcfg_array(); + filter_generate_gateways(); // loads global $GatewaysList + + foreach (get_staticroutes() as $route) { + $friendly = $GatewaysList[$route['gateway']]['friendlyiface']; + if (is_array($FilterIflist[$friendly])) { + $oc = $FilterIflist[$friendly]; + $routeent = explode("/", $route['network']); + if (is_ipaddrv4($routeent[0]) && is_ipaddrv4($oc['ip'])) { + $sa = $oc['sa']; + $sn = $oc['sn']; + } elseif (is_ipaddrv6($routeent[0]) && is_ipaddrv6($oc['ipv6'])) { + $sa = $oc['sav6']; + $sn = $oc['snv6']; + } else { + continue; + } + + $networks = array(); + $networks[] = array('from' => "{$sa}/{$sn}", 'to' => $route['network']); + $networks[] = array('to' => "{$sa}/{$sn}", 'from' => $route['network']); + foreach ($networks as $network) { + $fw->registerFilterRule(10, + array('interface' => $friendly, 'statetype' => 'sloppy', + 'protocol' => 'tcp','flags' => 'any', 'from' => $network['from'], + 'to' => $network['to'], 'quick' => false, + 'label' => "pass traffic between statically routed subnets"), + $defaults['pass'] + ); + $fw->registerFilterRule(10, + array('interface' => $friendly, 'statetype' => 'sloppy', + 'from' => $network['from'],'to' => $network['to'], 'quick' => false, + 'label' => "pass traffic between statically routed subnets"), + $defaults['pass'] + ); + } + } + } + } +} diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml index 125a106e2..129bea389 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml @@ -120,9 +120,6 @@ - - - @@ -166,6 +163,9 @@ + + +