コード例 #1
0
    $reqdfieldsn = array(gettext("Zone name"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
    foreach ($a_cp as $cpkey => $cpent) {
        if ($cpent['zone'] == $_POST['zone']) {
            $input_errors[] = sprintf("[%s] %s.", $_POST['zone'], gettext("already exists"));
            break;
        }
    }
    if (!$input_errors) {
        $cpzone = strtolower($_POST['zone']);
        $a_cp[$cpzone] = array();
        $a_cp[$cpzone]['zone'] = str_replace(" ", "", $_POST['zone']);
        $a_cp[$cpzone]['descr'] = $_POST['descr'];
        write_config();
        /* make sure ipfw is loaded */
        if (!is_module_loaded("ipfw.ko")) {
            filter_load_ipfw();
        }
        mwexec("/usr/local/sbin/ipfw_context -a {$cpzone}", true);
        header("Location: services_captiveportal.php?zone={$cpzone}");
        exit;
    }
}
include "head.inc";
include "fbegin.inc";
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
コード例 #2
0
        if ($_POST['disablescrub'] == "yes") {
            $config['system']['disablescrub'] = $_POST['disablescrub'];
        } else {
            unset($config['system']['disablescrub']);
        }
        if ($_POST['tftpinterface']) {
            $config['system']['tftpinterface'] = implode(",", $_POST['tftpinterface']);
        } else {
            unset($config['system']['tftpinterface']);
        }
        write_config();
        /* 
         * XXX: This is a kludge here but its the better place than on every filter reload.
         * NOTE: This is only for setting the ipfw state limits. 
         */
        if ($_POST['maximumstates'] && is_numeric($_POST['maximumstates']) && is_module_loaded("ipfw.ko")) {
            filter_load_ipfw();
        }
        $retval = 0;
        $retval = filter_configure();
        if (stristr($retval, "error") != true) {
            $savemsg = get_std_save_message($retval);
        } else {
            $savemsg = $retval;
        }
    }
}
$pgtitle = array(gettext("System"), gettext("Advanced: Firewall and NAT"));
include "head.inc";
?>
コード例 #3
0
     $ip['bw_down'] = $_POST['bw_down'];
 }
 if (isset($id) && $a_allowedips[$id]) {
     $oldip = $a_allowedips[$id]['ip'];
     if (!empty($a_allowedips[$id]['sn'])) {
         $oldmask = $a_allowedips[$id]['sn'];
     } else {
         $oldmask = 32;
     }
     $a_allowedips[$id] = $ip;
 } else {
     $a_allowedips[] = $ip;
 }
 allowedips_sort();
 write_config();
 if (isset($a_cp[$cpzone]['enable']) && is_module_loaded("ipfw.ko")) {
     $rules = "";
     $cpzoneid = $a_cp[$cpzone]['zoneid'];
     unset($ipfw);
     if (isset($oldip) && isset($oldmask)) {
         $ipfw = pfSense_ipfw_getTablestats($cpzoneid, IP_FW_TABLE_XLISTENTRY, 3, $oldip);
         $rules .= "table 3 delete {$oldip}/{$oldmask}\n";
         $rules .= "table 4 delete {$oldip}/{$oldmask}\n";
         if (is_array($ipfw)) {
             $rules .= "pipe delete {$ipfw['dnpipe']}\n";
             $rules .= "pipe delete " . ($ipfw['dnpipe'] + 1 . "\n");
         }
     }
     $rules .= captiveportal_allowedip_configure_entry($ip);
     if (is_array($ipfw)) {
         captiveportal_free_dn_ruleno($ipfw['dnpipe']);
コード例 #4
0
ファイル: status.php プロジェクト: 8191/opnsense-core
function execCmds()
{
    global $commands;
    for ($i = 0; isset($commands[$i]); $i++) {
        doCmdT($commands[$i][0], $commands[$i][1]);
    }
}
global $g, $config;
/* Set up all of the commands we want to execute. */
defCmdT("System uptime", "uptime");
defCmdT("Interfaces", "/sbin/ifconfig -a");
defCmdT("PF Info", "/sbin/pfctl -s info");
defCmdT("Routing tables", "netstat -nr");
defCmdT("top | head -n5", "/usr/bin/top | /usr/bin/head -n5");
defCmdT("sysctl hw.physmem", "/sbin/sysctl hw.physmem");
if (is_module_loaded('ipfw')) {
    defCmdT('ipfw queue show', '/sbin/ipfw queue show');
    defCmdT('ipfw pipe show', '/sbin/ipfw pipe show');
    defCmdT('ipfw show', '/sbin/ipfw show');
}
defCmdT("pfctl -sn", "/sbin/pfctl -sn");
defCmdT("pfctl -sr", "/sbin/pfctl -sr");
defCmdT("pfctl -ss", "/sbin/pfctl -ss");
defCmdT("pfctl -si", "/sbin/pfctl -si");
defCmdT("pfctl -sa", "/sbin/pfctl -sa");
defCmdT("pfctl -s rules -vv", "/sbin/pfctl -s rules -vv");
defCmdT("pfctl -s queue -v", "/sbin/pfctl -s queue -v");
defCmdT("pfctl -s nat -v", "/sbin/pfctl -s nat -v");
defCmdT("PF OSFP", "/sbin/pfctl -s osfp");
defCmdT("netstat -s -ppfsync", "netstat -s -ppfsync");
defCmdT("pfctl -vsq", "/sbin/pfctl -vsq");