mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Cleanup return_dir_as_array to not return . or .. and make the new firewall plugin system active.
This commit is contained in:
parent
a8ac6c9856
commit
174861fdd9
@ -139,10 +139,16 @@ function filter_configure() {
|
||||
} else {
|
||||
/* process packager manager custom rules */
|
||||
$files = return_dir_as_array("/usr/local/pkg/pf/");
|
||||
foreach ($files as $file) {
|
||||
$text = return_filename_as_string($file);
|
||||
eval($text);
|
||||
if($files <> "") {
|
||||
foreach ($files as $file) {
|
||||
if($file <> "") {
|
||||
$text = return_filename_as_string($file);
|
||||
if($text != "")
|
||||
eval($text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -949,10 +955,12 @@ function filter_rules_generate() {
|
||||
$ipfrules .= <<<EOD
|
||||
|
||||
# loopback
|
||||
anchor "loopback"
|
||||
pass in quick on lo0 all label "pass loopback"
|
||||
pass out quick on lo0 all label "pass loopback"
|
||||
|
||||
# pass traffic from firewall -> out
|
||||
anchor "firewallout"
|
||||
pass out quick on $wanif inet proto tcp from $wanif to any keep state
|
||||
|
||||
# enable ftp-proxy
|
||||
@ -974,6 +982,7 @@ EOD;
|
||||
$ipfrules .= <<<EOD
|
||||
|
||||
# allow access to DHCP server on {$on}
|
||||
anchor "dhcpserver"
|
||||
pass in quick on {$oc['if']} proto udp from any port = 68 to 255.255.255.255 port = 67 label "allow access to DHCP server"
|
||||
pass in quick on {$oc['if']} proto udp from any port = 68 to {$oc['ip']} port = 67 label "allow access to DHCP server"
|
||||
pass out quick on {$oc['if']} proto udp from {$oc['ip']} port = 67 to any port = 68 label "allow access to DHCP server"
|
||||
@ -1034,6 +1043,7 @@ EOD;
|
||||
$ipfrules .= <<<EOD
|
||||
|
||||
# WAN spoof check
|
||||
anchor "wanspoof"
|
||||
block in $log quick on $wanif from $lansa/$lansn to any label "WAN spoof check"
|
||||
|
||||
EOD;
|
||||
@ -1062,6 +1072,7 @@ EOD;
|
||||
# allow our DHCP client out to the WAN
|
||||
# XXX - should be more restrictive
|
||||
# (not possible at the moment - need 'me' like in ipfw)
|
||||
anchor "wandhcp"
|
||||
pass out quick on $wanif proto udp from any port = 68 to any port = 67 label "allow dhcp client out wan"
|
||||
block in $log quick on $wanif proto udp from any port = 67 to $lansa/$lansn port = 68 label "allow dhcp client out wan"
|
||||
pass in quick on $wanif proto udp from any port = 67 to any port = 68 label "allow dhcp client out wan"
|
||||
|
||||
@ -41,12 +41,15 @@ function log_error($error) {
|
||||
* return_dir_as_array($dir): returns $dir contents as an array
|
||||
*/
|
||||
function return_dir_as_array($dir) {
|
||||
$dir_array = array();
|
||||
if (is_dir($dir)) {
|
||||
$dir_array = array();
|
||||
if ($dh = opendir($dir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
array_push($dir_array, $file);
|
||||
//echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
|
||||
$canadd = 0;
|
||||
if($file == ".") $canadd = 1;
|
||||
if($file == "..") $canadd = 1;
|
||||
if($canadd == 0)
|
||||
array_push($dir_array, $file);
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
@ -59,7 +62,7 @@ function return_dir_as_array($dir) {
|
||||
*/
|
||||
function return_filename_as_string($filename) {
|
||||
$tmp = "";
|
||||
$fd = popen($filename, "r");
|
||||
$fd = fopen($filename, "r");
|
||||
while(!feof($fd)) {
|
||||
$tmp .= fread($fd,49);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user