コード例 #1
0
ファイル: exec.shorewall.php プロジェクト: brucewu16899/1.6.x
function build()
{
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, building configuration.\n";
    }
    @mkdir("/var/lib/shorewall", 0755, true);
    $unix = new unix();
    if (!isset($GLOBALS["INTERFACES"])) {
        $GLOBALS["INTERFACES"] = $unix->NETWORK_ALL_INTERFACES();
    }
    shorewall_conf();
    build_providers();
    build_zones();
    build_interfaces();
    build_policies();
    build_rules();
    build_rtrules();
    build_masq();
    CheckConf();
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, BUILD DONE.\n";
    }
}
コード例 #2
0
ファイル: logic_config.php プロジェクト: amrX2K/PIA-Tunnel
function disp_general_box()
{
    global $_settings;
    global $GLOB_disp_network_default_fields;
    $settings = $_settings->get_settings();
    $disp_body = '';
    $disp_body .= '<div class="box options">';
    $disp_body .= '<h2>General Settings</h2>' . "\n";
    $disp_body .= "<table>\n";
    $disp_body .= build_providers();
    $disp_body .= '<tr><td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
    //VM LAN segment forwarding
    $GLOB_disp_network_default_fields .= 'FORWARD_VM_LAN,';
    $sel = array('id' => 'FORWARD_VM_LAN', 'selected' => $settings['FORWARD_VM_LAN'], array('yes', 'yes'), array('no', 'no'));
    $disp_body .= '<tr><td>VPN Gateway for VM LAN</td><td>' . build_select($sel) . '</td></tr>' . "\n";
    //use public LAN segment for forwarding
    $GLOB_disp_network_default_fields .= 'FORWARD_PUBLIC_LAN,';
    $sel = array('id' => 'FORWARD_PUBLIC_LAN', 'selected' => $settings['FORWARD_PUBLIC_LAN'], array('yes', 'yes'), array('no', 'no'));
    $disp_body .= '<tr><td>VPN Gateway for public LAN</td><td>' . build_select($sel) . '</td></tr>' . "\n";
    /*  $disp_body .= '<tr><td>&nbsp;</td><td>&nbsp;</td></tr>'."\n";
      $GLOB_disp_network_default_fields .= 'NETWORK_MAX_SPEED,';
      $sel = array(
                'id' => 'NETWORK_MAX_SPEED',
                'selected' =>  $settings['NETWORK_MAX_SPEED'],
                array( '0', 'no limit'),
                array( '1600', '200KB/s'),
                array( '3200', '400KB/s'),
                array( '4800', '600KB/s'),
                array( '6400', '800KB/s'),
                array( '8192', '1MB/s'),
                array( '12288', '1.5MB/s'),
                array( '16384', '2MB/s'),
                array( '20480', '2.5MB/s'),
                array( '24576', '3MB/s'),
                array( '32768', '4MB/s'),
                array( '40960', '5MB/s'),
                array( '81920', '10MB/s'),
                array( '819200', '100MB/s')
              );
      $disp_body .= '<tr><td><strong>Experimental</strong><br>Limit network throughput<br></td><td>'.build_select($sel).'</td></tr>'."\n";
    */
    $disp_body .= '<tr><td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
    //now FIREWALL_IF_WEB options
    $use = 'FIREWALL_IF_WEB';
    $GLOB_disp_network_default_fields .= 'FIREWALL_IF_WEB,';
    $fw_ssh = $_settings->get_settings_array($use);
    //Wvar_dump($fw_ssh);die();
    $sel = array('id' => $use, 'selected' => $fw_ssh, array('FIREWALL_IF_WEB[0]', 'eth0'), array('FIREWALL_IF_WEB[1]', 'eth1'));
    $disp_body .= '<tr><td><span title="incoming on port 80">Allow webUI access on</span></td><td><span title="incoming on port 80">' . build_checkbox($sel) . '</span></td></tr>' . "\n";
    $use = 'FIREWALL_IF_SSH';
    $GLOB_disp_network_default_fields .= 'FIREWALL_IF_SSH,';
    $fw_ssh = $_settings->get_settings_array($use);
    //Wvar_dump($fw_ssh);die();
    $sel = array('id' => $use, 'selected' => $fw_ssh, array('FIREWALL_IF_SSH[0]', 'eth0'), array('FIREWALL_IF_SSH[1]', 'eth1'));
    $disp_body .= '<tr><td><span title="incoming on port 22">Allow SSH on</span></td><td><span title="incoming on port 22">' . build_checkbox($sel) . '</span></td></tr>' . "\n";
    $use = 'FIREWALL_IF_SNMP';
    $GLOB_disp_network_default_fields .= 'FIREWALL_IF_SNMP,';
    $fw_ssh = $_settings->get_settings_array($use);
    $sel = array('id' => $use, 'selected' => $fw_ssh, array('FIREWALL_IF_SNMP[0]', 'eth0'), array('FIREWALL_IF_SNMP[1]', 'eth1'));
    $disp_body .= '<tr><td><span title="incoming on port 161 and outgoing on 162">Allow SNMP on</span></td><td><span title="incoming on port 161 and outgoing on 162">' . build_checkbox($sel) . '</span></td></tr>' . "\n";
    $use = 'FIREWALL_IF_SECSNMP';
    $GLOB_disp_network_default_fields .= 'FIREWALL_IF_SECSNMP,';
    $fw_ssh = $_settings->get_settings_array($use);
    $sel = array('id' => $use, 'selected' => $fw_ssh, array('FIREWALL_IF_SECSNMP[0]', 'eth0'), array('FIREWALL_IF_SECSNMP[1]', 'eth1'));
    $disp_body .= '<tr><td><span title="incoming on port 10161 and outgoing on 10162">Allow Secure SNMP on</span></td><td><span title="incoming on port 10161 and outgoing on 10162">' . build_checkbox($sel) . '</span></td></tr>' . "\n";
    $disp_body .= '<tr><td>&nbsp;</td><td>&nbsp;</td></tr>' . "\n";
    $disp_body .= '<tr><td>Web-UI Username</td><td><input type="text" name="WEB_UI_USER" value="' . htmlspecialchars($settings['WEB_UI_USER']) . '"></td></tr>' . "\n";
    $disp_body .= '<tr><td>Web-UI Password</td><td><input type="password" name="WEB_UI_PASSWORD" value="" placeholder="*********"></td></tr>' . "\n";
    $GLOB_disp_network_default_fields .= 'WEB_UI_COOKIE_LIFETIME,';
    $disp_body .= '<tr><td>Remember Me for</td><td><input type="text" class="short" name="WEB_UI_COOKIE_LIFETIME" value="' . htmlspecialchars($settings['WEB_UI_COOKIE_LIFETIME']) . '"> days</td></tr>' . "\n";
    $GLOB_disp_network_default_fields .= 'WEB_UI_REFRESH_TIME,';
    $sel = array('id' => 'WEB_UI_REFRESH_TIME', 'selected' => $settings['WEB_UI_REFRESH_TIME'], array('5000', '5 seconds'), array('10000', '10 seconds'), array('15000', '15 seconds'), array('30000', '30 seconds'), array('60000', '60 seconds'));
    $disp_body .= '<tr><td>Refresh Overview every </td><td>' . build_select($sel) . '</td></tr>' . "\n";
    $disp_body .= "</table>\n";
    $disp_body .= '<br><input type="submit" name="store settings" value="Store Settings">';
    $disp_body .= ' &nbsp; <input type="submit" name="restart_firewall" value="Restart Firewall">';
    $disp_body .= '</div>';
    return $disp_body;
}