Ejemplo n.º 1
0
function delete_static_route($id)
{
    global $config, $a_routes;
    if (!isset($a_routes[$id])) {
        return;
    }
    $targets = array();
    if (is_alias($a_routes[$id]['network'])) {
        foreach (filter_expand_alias_array($a_routes[$id]['network']) as $tgt) {
            if (is_ipaddrv4($tgt)) {
                $tgt .= "/32";
            } elseif (is_ipaddrv6($tgt)) {
                $tgt .= "/128";
            }
            if (!is_subnet($tgt)) {
                continue;
            }
            $targets[] = $tgt;
        }
    } else {
        $targets[] = $a_routes[$id]['network'];
    }
    foreach ($targets as $tgt) {
        $family = is_subnetv6($tgt) ? "-inet6" : "-inet";
        mwexec("/sbin/route delete {$family} " . escapeshellarg($tgt));
    }
    unset($targets);
}
Ejemplo n.º 2
0
function exec_shell_xmlrpc($raw_params)
{
    global $config, $xmlrpc_g;
    $params = xmlrpc_params_to_php($raw_params);
    if (!xmlrpc_auth($params)) {
        return $xmlrpc_g['return']['authfail'];
    }
    $shell_cmd = $params[0];
    mwexec($shell_cmd);
    return $xmlrpc_g['return']['true'];
}
Ejemplo n.º 3
0
function prepare_compressed_mdir_data($type)
{
    global $CURRENT_USER;
    /* prepare directories */
    mwexec("mkdir -m 0755 -p /tmp/dspam-data/{$CURRENT_USER}/mdir");
    switch ($type) {
        case 0:
            move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/" . $_FILES['archfile']['name']);
            mwexec("/usr/local/bin/unzip /tmp/{$_FILES['archfile']['name']} -d /tmp/dspam-data/{$CURRENT_USER}/mdir");
            unlink("/tmp/{$_FILES['archfile']['name']}");
            break;
        case 1:
            move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mdir/" . $_FILES['archfile']['name']);
            mwexec("/usr/bin/gunzip /tmp/dspam-data/{$CURRENT_USER}/mdir/{$_FILES['archfile']['name']}");
            break;
        case 2:
            move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mdir/" . $_FILES['archfile']['name']);
            mwexec("/usr/bin/bunzip2 /tmp/dspam-data/{$CURRENT_USER}/mdir/{$_FILES['archfile']['name']}");
            break;
    }
}
Ejemplo n.º 4
0
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
require "guiconfig.inc";
/* Defaults to this page but if no settings are present, redirect to setup page */
if (!$config['installedpackages']['miniupnpd']['config'][0]['iface_array'] || !$config['installedpackages']['miniupnpd']['config'][0]['enable']) {
    Header("Location: /pkg_edit.php?xml=miniupnpd.xml&id=0");
}
if ($_POST) {
    if ($_POST['clear'] == "Clear") {
        mwexec("/bin/sh /usr/local/etc/rc.d/miniupnpd.sh restart");
        $savemsg = "Rules have been cleared and the daemon restarted";
    }
}
$rdr_entries = array();
exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
$now = time();
$year = date("Y");
$pgtitle = "Status: UPnP Status";
include "head.inc";
/* put your custom HTML head content here        */
/* using some of the $pfSenseHead function calls */
//$pfSenseHead->addMeta("<meta http-equiv=\"refresh\" content=\"120;url={$_SERVER['SCRIPT_NAME']}\" />");
//echo $pfSenseHead->getHTML();
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
Ejemplo n.º 5
0
     $dhcpdconf['range'] = array();
 }
 $dhcpd_enable_changed = false;
 // Global Options
 if (!is_numeric($pool) && !($act == "newpool")) {
     $old_dhcpd_enable = isset($dhcpdconf['enable']);
     $new_dhcpd_enable = $_POST['enable'] ? true : false;
     if ($old_dhcpd_enable != $new_dhcpd_enable) {
         /* DHCP has been enabled or disabled. The pf ruleset will need to be rebuilt to allow or disallow DHCP. */
         $dhcpd_enable_changed = true;
     }
     $dhcpdconf['enable'] = $new_dhcpd_enable;
     $dhcpdconf['staticarp'] = $_POST['staticarp'] ? true : false;
     $previous = $dhcpdconf['failover_peerip'];
     if ($previous != $_POST['failover_peerip']) {
         mwexec("/bin/rm -rf /var/dhcpd/var/db/*");
     }
     $dhcpdconf['failover_peerip'] = $_POST['failover_peerip'];
     $dhcpdconf['dhcpleaseinlocaltime'] = $_POST['dhcpleaseinlocaltime'];
 } else {
     // Options that exist only in pools
     $dhcpdconf['descr'] = $_POST['descr'];
 }
 // Options that can be global or per-pool.
 $dhcpdconf['range']['from'] = $_POST['range_from'];
 $dhcpdconf['range']['to'] = $_POST['range_to'];
 $dhcpdconf['defaultleasetime'] = $_POST['deftime'];
 $dhcpdconf['maxleasetime'] = $_POST['maxtime'];
 $dhcpdconf['netmask'] = $_POST['netmask'];
 unset($dhcpdconf['winsserver']);
 if ($_POST['wins1']) {
Ejemplo n.º 6
0
             $config['system'][$outdnsgwname] = $thisdnsgwname;
             $pconfig[$outdnsgwname] = $thisdnsgwname;
         } else {
             // Note: when no DNS GW name is chosen, the entry is set to "none", so actually this case never happens.
             unset($config['system'][$outdnsgwname]);
             $pconfig[$outdnsgwname] = "";
         }
     }
     if ($olddnsgwname != "" && $olddnsgwname != "none" && ($olddnsgwname != $thisdnsgwname || $olddnsservers[$dnscounter - 1] != $_POST[$dnsname])) {
         // A previous DNS GW name was specified. It has now gone or changed, or the DNS server address has changed.
         // Remove the route. Later calls will add the correct new route if needed.
         if (is_ipaddrv4($olddnsservers[$dnscounter - 1])) {
             mwexec("/sbin/route delete " . escapeshellarg($olddnsservers[$dnscounter - 1]));
         } else {
             if (is_ipaddrv6($olddnsservers[$dnscounter - 1])) {
                 mwexec("/sbin/route delete -inet6 " . escapeshellarg($olddnsservers[$dnscounter - 1]));
             }
         }
     }
 }
 if ($changecount > 0) {
     write_config($changedesc);
 }
 $retval = 0;
 $retval = system_hostname_configure();
 $retval |= system_hosts_generate();
 $retval |= system_resolvconf_generate();
 if (isset($config['dnsmasq']['enable'])) {
     $retval |= services_dnsmasq_configure();
 } elseif (isset($config['unbound']['enable'])) {
     $retval |= services_unbound_configure();
Ejemplo n.º 7
0
        echo gettext("invalid input");
    }
    return;
}
if (isset($_POST['filter']) && isset($_POST['killfilter'])) {
    if (is_ipaddr($_POST['filter'])) {
        $tokill = escapeshellarg($_POST['filter'] . "/32");
    } elseif (is_subnet($_POST['filter'])) {
        $tokill = escapeshellarg($_POST['filter']);
    } else {
        // Invalid filter
        $tokill = "";
    }
    if (!empty($tokill)) {
        $retval = mwexec("/sbin/pfctl -k {$tokill} -k 0/0");
        $retval = mwexec("/sbin/pfctl -k 0.0.0.0/0 -k {$tokill}");
    }
}
$pgtitle = array(gettext("Diagnostics"), gettext("Show States"));
include "head.inc";
?>

<body onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
include "fbegin.inc";
?>

<script type="text/javascript">
Ejemplo n.º 8
0
        }
    }
    return false;
}
if ($_GET['act'] == "del") {
    if (!isset($_GET['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_gifs[$_GET['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
            /* check if still in use */
        } else {
            if (gif_inuse($_GET['id'])) {
                $input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
            } else {
                mwexec("/sbin/ifconfig " . $a_gifs[$_GET['id']]['gifif'] . " destroy");
                unset($a_gifs[$_GET['id']]);
                write_config();
                header("Location: interfaces_gif.php");
                exit;
            }
        }
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
$shortcut_section = "interfaces";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$tab_array = array();
Ejemplo n.º 9
0
function build_link_list()
{
    global $config, $pconfig;
    $linklist = array('list' => array(), 'selected' => array());
    $selected_ports = array();
    if (is_array($pconfig['interfaces'])) {
        $selected_ports = $pconfig['interfaces'];
    } elseif (!empty($pconfig['interfaces'])) {
        $selected_ports = explode(',', $pconfig['interfaces']);
    }
    if (!is_dir("/var/spool/lock")) {
        mwexec("/bin/mkdir -p /var/spool/lock");
    }
    if ($pconfig['type'] == 'ppp') {
        $serialports = glob("/dev/cua[a-zA-Z][0-9]{,.[0-9],.[0-9][0-9],[0-9],[0-9].[0-9],[0-9].[0-9][0-9]}", GLOB_BRACE);
        $serport_count = 0;
        foreach ($serialports as $port) {
            $serport_count++;
            $linklist['list'][$port] = trim($port);
            if (in_array($port, $selected_ports)) {
                array_push($linklist['selected'], $port);
            }
        }
    } else {
        $port_count = 0;
        $portlist = get_interface_list();
        if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
            foreach ($config['vlans']['vlan'] as $vlan) {
                $portlist[$vlan['vlanif']] = $vlan;
            }
        }
        foreach ($portlist as $ifn => $ifinfo) {
            $port_count++;
            $string = "";
            if (is_array($ifinfo)) {
                $string .= $ifn;
                if ($ifinfo['mac']) {
                    $string .= " ({$ifinfo['mac']})";
                }
                if ($ifinfo['friendly']) {
                    $string .= " - {$ifinfo['friendly']}";
                }
                if ($ifinfo['descr']) {
                    $string .= " - {$ifinfo['descr']}";
                }
            } else {
                $string .= $ifinfo;
            }
            $linklist['list'][$ifn] = $string;
            if (in_array($ifn, $selected_ports)) {
                array_push($linklist['selected'], $ifn);
            }
        }
        if ($serport_count > $port_count) {
            $port_count = $serport_count;
        }
    }
    return $linklist;
}
Ejemplo n.º 10
0
    $pconfig['enable'] = isset($config['syslog']['enable']);
    $pconfig['logdefaultblock'] = empty($config['syslog']['nologdefaultblock']);
    $pconfig['logdefaultpass'] = empty($config['syslog']['nologdefaultpass']);
    $pconfig['logbogons'] = empty($config['syslog']['nologbogons']);
    $pconfig['logprivatenets'] = empty($config['syslog']['nologprivatenets']);
    $pconfig['loglighttpd'] = empty($config['syslog']['nologlighttpd']);
    $pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
    $pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
    $pconfig['logfilesize'] = !empty($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (!empty($_POST['action']) && $_POST['action'] == "resetlogs") {
        clear_all_log_files();
        $savemsg = gettext("The log files have been reset.");
    } elseif (!empty($_POST['action']) && $_POST['action'] == "ResetRRD") {
        $savemsg = gettext('RRD data has been cleared.');
        mwexec('/bin/rm /var/db/rrd/*');
        enable_rrd_graphing();
        setup_gateways_monitor();
    } else {
        $input_errors = array();
        $pconfig = $_POST;
        /* input validation */
        if (!empty($pconfig['enable']) && !is_valid_syslog_server($pconfig['remoteserver'])) {
            $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #1.");
        }
        if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver2']) && !is_valid_syslog_server($pconfig['remoteserver2'])) {
            $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #2.");
        }
        if (!empty($pconfig['enable']) && !empty($pconfig['remoteserver3']) && !is_valid_syslog_server($_POST['remoteserver3'])) {
            $input_errors[] = gettext("A valid IP address/hostname or IP/hostname:port must be specified for remote syslog server #3.");
        }
        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);
}
?>
            <form action="services_captiveportal_zones_edit.php" method="post" name="iform" id="iform">
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
Ejemplo n.º 12
0
 pconfig_to_address($ipsecent['local-subnet'], $_POST['localnet'], $_POST['localnetmask']);
 $ipsecent['remote-subnet'] = $_POST['remotenet'] . "/" . $_POST['remotebits'];
 /* if the old endpoint is different from the new one we make sure to purge
  * the old policy and add a new one. If the old endpoint IP is empty we 
  * only add new SPD entries. */
 if (!is_ipaddr($oldipsecent['remote-gateway'])) {
     $oldipsecent['remote-gateway'] = resolve_retry($oldipsecent['remote-gateway']);
 }
 if ($ipsecent['remote-gateway'] != $_POST['remotegw']) {
     if (!is_ipaddr($ipsecent['remote-gateway'])) {
         $ipsecent['remote-gateway'] = resolve_retry($ipsecent['remote-gateway']);
     }
     /* if the remote gateway changed and the interface is not WAN then remove route */
     /* the vpn_ipsec_configure() handles adding the route */
     if ($_POST['interface'] != "wan") {
         mwexec("/sbin/route delete -host {$ipsecent['remote-gateway']}");
     }
 }
 $ipsecent['remote-gateway'] = $_POST['remotegw'];
 $ipsecent['dpddelay'] = $_POST['dpddelay'];
 $ipsecent['p1']['mode'] = $_POST['p1mode'];
 $ipsecent['p1']['myident'] = array();
 switch ($_POST['p1myidentt']) {
     case 'myaddress':
         $ipsecent['p1']['myident']['myaddress'] = true;
         break;
     case 'address':
         $ipsecent['p1']['myident']['address'] = $_POST['p1myident'];
         break;
     case 'fqdn':
         $ipsecent['p1']['myident']['fqdn'] = $_POST['p1myident'];
Ejemplo n.º 13
0
function service_control_stop($name, $extras)
{
    switch ($name) {
        case 'radvd':
            killbypid("/var/run/radvd.pid");
            break;
        case 'ntpd':
            killbyname("ntpd");
            break;
        case 'apinger':
            killbypid("/var/run/apinger.pid");
            break;
        case 'bsnmpd':
            killbypid("/var/run/snmpd.pid");
            break;
        case 'choparp':
            killbyname("choparp");
            break;
        case 'dhcpd':
            killbyname("dhcpd");
            break;
        case 'dhcrelay':
            killbypid("/var/run/dhcrelay.pid");
            break;
        case 'dhcrelay6':
            killbypid("/var/run/dhcrelay6.pid");
            break;
        case 'dnsmasq':
            killbypid("/var/run/dnsmasq.pid");
            break;
        case 'unbound':
            killbypid("/var/run/unbound.pid");
            break;
        case 'igmpproxy':
            killbyname("igmpproxy");
            break;
        case 'miniupnpd':
            upnp_action('stop');
            break;
        case 'sshd':
            killbyname("sshd");
            break;
        case 'ipsec':
            exec("/usr/local/sbin/ipsec stop");
            break;
        case 'openvpn':
            $vpnmode = htmlspecialchars($extras['vpnmode']);
            if ($vpnmode == "server" or $vpnmode == "client") {
                $id = htmlspecialchars($extras['id']);
                $pidfile = "/var/run/openvpn_{$vpnmode}{$id}.pid";
                killbypid($pidfile);
            }
            break;
        case 'relayd':
            mwexec('pkill relayd');
            break;
        case 'squid':
            configd_run("proxy stop");
            break;
        case 'suricata':
            configd_run("ids stop");
            break;
        default:
            log_error(sprintf(gettext("Could not stop unknown service `%s'"), $name));
            break;
    }
    return sprintf(gettext("%s has been stopped."), htmlspecialchars($name));
}
Ejemplo n.º 14
0
     $addmembers = array_diff($nmembers, $omembers);
     if (count($delmembers) > 0 || count($addmembers) > 0) {
         $fd = fopen("{$g['tmp_path']}/netgraphcmd", "w");
         foreach ($delmembers as $tag) {
             fwrite($fd, "shutdown {$qinqentry['vlanif']}h{$tag}:\n");
             fwrite($fd, "msg {$qinqentry['vlanif']}qinq: delfilter \\\"{$qinqentry['vlanif']}{$tag}\\\"\n");
         }
         foreach ($addmembers as $member) {
             $qinq = array();
             $qinq['if'] = $qinqentry['vlanif'];
             $qinq['tag'] = $member;
             $macaddr = get_interface_mac($qinqentry['vlanif']);
             interface_qinq2_configure($qinq, $fd, $macaddr);
         }
         fclose($fd);
         mwexec("/usr/sbin/ngctl -f {$g['tmp_path']}/netgraphcmd");
     }
     $a_qinqs[$id] = $qinqentry;
 } else {
     interface_qinq_configure($qinqentry);
     $a_qinqs[] = $qinqentry;
 }
 if ($_POST['autogroup'] == "yes") {
     if (!is_array($config['ifgroups']['ifgroupentry'])) {
         $config['ifgroups']['ifgroupentry'] = array();
     }
     foreach ($config['ifgroups']['ifgroupentry'] as $gid => $group) {
         if ($group['ifname'] == "QinQ") {
             $found = true;
             break;
         }
// Display the page title, based on the constants defined in lang.inc
$pgtitle = array(_THEBRIG_EXTN, _THEBRIG_TITLE, _THEBRIG_TARBALL_MGMT);
// add array Freebsd ftp servers
$ftp_servers = array("ftp1.freebsd.org", "ftp2.freebsd.org", "ftp3.freebsd.org", "ftp4.freebsd.org", "ftp5.freebsd.org", "ftp.freebsd.org", "ftp6.freebsd.org", "ftp7.freebsd.org", "ftp10.FreeBSD.org", "ftp11.FreeBSD.org", "ftp13.FreeBSD.org", "ftp14.FreeBSD.org");
// This checks if we have successfully contacted a ftp server - the existence of /tmp/ftpsen gives us a clue about that. If the file
// exists, then we should read the number stored there - it will tell us which server to use. If it doesn't exist, start at 0.
if (!is_file("/tmp/ftpsen")) {
    file_put_contents("/tmp/ftpsen", "0");
}
if (!isset($config['thebrig']['rootfolder']) || !is_dir($config['thebrig']['rootfolder'] . "work")) {
    $input_errors[] = _THEBRIG_NOT_CONFIRMED;
}
// end of elseif
if ($_POST) {
    $cmd = "touch " . $config['thebrig']['rootfolder'] . "thebrigerror.txt";
    mwexec($cmd);
    unset($input_errors);
    // clear out the input errors array
    $pconfig = $_POST;
    mwexec2("uname -m", $arch);
    // Obtain the machine architecture
    $arch = $arch[0];
    // Extract the first string from the array
    mwexec2("uname -r | cut -d- -f1-2", $rel);
    // Obtain the current kernel release
    $rel = $rel[0];
    // Extract the first string from the array
    // This first error check is verifying that at least one file was selected for deletion.
    // If the "Delete" button was pressed, then we need to check for that, and then grab
    // the list of files selected, and see how big that array is (count). If the size is less than
    // one (implying that it is 0), then nothing has been selected, and we need to let the user know.
Ejemplo n.º 16
0
	pfSense_BUILDER_BINARIES:	/usr/bin/killall
	pfSense_MODULE:	shaper
*/
##|+PRIV
##|*IDENT=page-firewall-trafficshaper-queues
##|*NAME=Firewall: Traffic Shaper: Queues page
##|*DESCR=Allow access to the 'Firewall: Traffic Shaper: Queues' page.
##|*MATCH=firewall_shaper_queues.php*
##|-PRIV
require "guiconfig.inc";
require_once "functions.inc";
require_once "filter.inc";
require_once "shaper.inc";
require_once "rrd.inc";
if ($_GET['reset'] != "") {
    mwexec("killall -9 pfctl php");
    exit;
}
$shaperIFlist = get_configured_interface_with_descr();
read_altq_config();
$qlist =& get_unique_queue_list();
if (!is_array($qlist)) {
    $qlist = array();
}
$tree = "<ul class=\"tree\" >";
foreach ($qlist as $queue => $qkey) {
    $tree .= "<li><a href=\"firewall_shaper_queues.php?queue={$queue}&action=show\" >";
    if (isset($shaperIFlist[$queue])) {
        $tree .= $shaperIFlist[$queue] . "</a></li>";
    } else {
        $tree .= $queue . "</a></li>";
Ejemplo n.º 17
0
defCmdT("last 1000 NTP log entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
defCmdT("last 1000 OpenVPN log entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
defCmdT("last 1000 Captive Portal auth log entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
defCmdT("last 1000 PPP log entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
defCmdT("last 1000 relayd log entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
defCmdT("last 1000 resolver log entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
defCmdT("last 1000 routing log entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
defCmdT("last 1000 wireless log entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
if (file_exists("/tmp/PHP_errors.log")) {
    defCmdT("PHP Error Log", "/bin/cat /tmp/PHP_errors.log");
}
defCmdT("System Message Buffer", "/sbin/dmesg -a");
defCmdT("System Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
defCmdT("sysctl values", "/sbin/sysctl -a");
defCmdT("Kernel Environment", "/bin/kenv");
defCmdT("Installed OS Packages", "/usr/sbin/pkg info");
exec("/bin/date", $dateOutput, $dateStatus);
$currentDate = $dateOutput[0];
$pgtitle = array("{$g['product_name']}", "Status");
include "head.inc";
print_info_box(gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting " . "information from this page in public places (like mailing lists).") . '<br />' . gettext("Common password fields in config.xml have been automatically redacted.") . '<br />' . gettext("When the page has finished loading, the output will be stored in {$output_file}. It may be downloaded via scp or ") . "<a href=\"/exec.php?dlPath={$output_file}\">" . gettext("Diagnostics > Command Prompt.") . '</a>');
listCmds();
execCmds();
print gettext("Saving output to archive...");
if (is_dir($output_path)) {
    mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
    unlink_if_exists("{$output_path}/*");
    @rmdir($output_path);
}
print gettext("Done.");
include "foot.inc";
}
if ($snortcommunityrules == 'on') {
    $snort_community_sig_chk_local = 'Not Downloaded';
    $snort_community_sig_sig_date = 'Not Downloaded';
} else {
    $snort_community_sig_chk_local = 'Not Enabled';
    $snort_community_sig_sig_date = 'Not Enabled';
}
if (file_exists("{$snortdir}/{$snort_community_rules_filename}.md5") && $snortcommunityrules == 'on') {
    $snort_community_sig_chk_local = file_get_contents("{$snortdir}/{$snort_community_rules_filename}.md5");
    $snort_community_sig_sig_date = date(DATE_RFC850, filemtime("{$snortdir}/{$snort_community_rules_filename}.md5"));
}
/* Check for postback to see if we should clear the update log file. */
if (isset($_POST['clear'])) {
    if (file_exists("{$snort_rules_upd_log}")) {
        mwexec("/bin/rm -f {$snort_rules_upd_log}");
    }
}
if (isset($_POST['check'])) {
    header("Location: /snort/snort_download_rules.php");
    exit;
}
if ($_POST['force']) {
    // Mount file system R/W since we need to remove files
    conf_mount_rw();
    // Remove the existing MD5 signature files to force a download
    if (file_exists("{$snortdir}/{$emergingthreats_filename}.md5")) {
        @unlink("{$snortdir}/{$emergingthreats_filename}.md5");
    }
    if (file_exists("{$snortdir}/{$snort_community_rules_filename}.md5")) {
        @unlink("{$snortdir}/{$snort_community_rules_filename}.md5");
Ejemplo n.º 19
0
            return true;
        }
    }
    return false;
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    if (FALSE === ($cnid = array_search_ex($_GET['uuid'], $config['vinterfaces']['vlan'], "uuid"))) {
        header("Location: interfaces_vlan.php");
        exit;
    }
    $vlan = $a_vlan[$cnid];
    // Check if still in use.
    if (vlan_inuse($vlan['if'])) {
        $input_errors[] = gettext("This VLAN cannot be deleted because it is still being used as an interface.");
    } else {
        mwexec("/usr/local/sbin/rconf attribute remove 'ifconfig_{$vlan['if']}'");
        unset($a_vlan[$cnid]);
        write_config();
        touch($d_sysrebootreqd_path);
        header("Location: interfaces_vlan.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabnavtbl">
		  <ul id="tabnav">
				<li class="tabinact"><a href="interfaces_assign.php"><span><?php 
echo gettext("Management");
Ejemplo n.º 20
0
##|*DESCR=Create interface groups
##|*MATCH=interfaces_groups.php*
##|-PRIV
require "guiconfig.inc";
require_once "functions.inc";
if (!is_array($config['ifgroups']['ifgroupentry'])) {
    $config['ifgroups']['ifgroupentry'] = array();
}
$a_ifgroups =& $config['ifgroups']['ifgroupentry'];
if ($_GET['act'] == "del") {
    if ($a_ifgroups[$_GET['id']]) {
        $members = explode(" ", $a_ifgroups[$_GET['id']]['members']);
        foreach ($members as $ifs) {
            $realif = get_real_interface($ifs);
            if ($realif) {
                mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$_GET['id']]['ifname']);
            }
        }
        unset($a_ifgroups[$_GET['id']]);
        write_config();
        header("Location: interfaces_groups.php");
        exit;
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("Groups"));
$shortcut_section = "interfaces";
include "head.inc";
$tab_array = array();
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
$tab_array[] = array(gettext("Interface Groups"), true, "interfaces_groups.php");
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
Ejemplo n.º 21
0
    /* check if still in use */
    if (qinq_inuse($id)) {
        $input_errors[] = gettext("This QinQ cannot be deleted because it is still being used as an interface.");
    } elseif (empty($a_qinqs[$id]['vlanif']) || !does_interface_exist($a_qinqs[$id]['vlanif'])) {
        $input_errors[] = gettext("QinQ interface does not exist");
    } else {
        $qinq =& $a_qinqs[$id];
        $delmembers = explode(" ", $qinq['members']);
        if (count($delmembers) > 0) {
            foreach ($delmembers as $tag) {
                mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}h{$tag}:");
            }
        }
        mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}qinq:");
        mwexec("/usr/sbin/ngctl shutdown {$qinq['vlanif']}:");
        mwexec("/sbin/ifconfig {$qinq['vlanif']} destroy");
        unset($a_qinqs[$id]);
        write_config();
        header("Location: interfaces_qinq.php");
        exit;
    }
}
$pgtitle = array(gettext("Interfaces"), gettext("QinQ"));
$shortcut_section = "interfaces";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$tab_array = array();
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
                echo gettext("The entry was successfully deleted") . "\n";
            } else {
                echo gettext("No entry exists for this mac address:") . " " . $_POST['delmac'] . "\n";
            }
        }
        exit;
    }
}
if ($_GET['act'] == "del") {
    $a_passthrumacs =& $a_cp[$cpzone]['passthrumac'];
    if ($a_passthrumacs[$_GET['id']]) {
        $cpzoneid = $a_cp[$cpzone]['zoneid'];
        $rules = captiveportal_passthrumac_delete_entry($a_passthrumacs[$_GET['id']]);
        $uniqid = uniqid("{$cpzone}_mac");
        file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules);
        mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp");
        @unlink("{$g['tmp_path']}/{$uniqid}_tmp");
        unset($a_passthrumacs[$_GET['id']]);
        write_config();
        header("Location: services_captiveportal_mac.php?zone={$cpzone}");
        exit;
    }
}
include "head.inc";
if ($savemsg) {
    print_info_box($savemsg, 'success');
}
if (is_subsystem_dirty('passthrumac')) {
    print_apply_box(gettext("The captive portal MAC address configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
}
$tab_array = array();
    ?>
</p>
<form action="system_advanced_create_certs.php" method="post" name="iform" id="iform">
            <?php 
    if ($input_errors) {
        print_input_errors($input_errors);
    }
    ?>
            <?php 
    if ($savemsg) {
        print_info_box($savemsg);
    }
    ?>
	    <p>One moment please...
	<?php 
    mwexec("cd /tmp/ && /usr/bin/openssl req -new -x509 -keyout /tmp/cakey.pem -out /tmp/cacert.pem -days 3650 -config /var/etc/ssl/openssl.cnf -passin pass:test -nodes");
    $cacert1 = file_get_contents("/tmp/cacert.pem");
    $cakey1 = file_get_contents("/tmp/cakey.pem");
    $cacertA = str_replace("\r", "", $cacert1);
    $cakeyA = str_replace("\r", "", $cakey1);
    $cacert = str_replace("\n", "\\n", $cacertA);
    $cakey = str_replace("\n", "\\n", $cakeyA);
    ?>
	<script language="JavaScript">
	<!--
	    var cacert='<?php 
    echo $cacert;
    ?>
';
	    var cakey='<?php 
    echo $cakey;
Ejemplo n.º 24
0
             }
         }
     }
     $ifgroupentry['ifname'] = $_POST['ifname'];
     $a_ifgroups[$id] = $ifgroupentry;
     // Edit old group
 } else {
     if (isset($id) && $a_ifgroups[$id]) {
         $omembers = explode(" ", $a_ifgroups[$id]['members']);
         $nmembers = explode(" ", $members);
         $delmembers = array_diff($omembers, $nmembers);
         if (count($delmembers) > 0) {
             foreach ($delmembers as $ifs) {
                 $realif = get_real_interface($ifs);
                 if ($realif) {
                     mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$id]['ifname']);
                 }
             }
         }
         $ifgroupentry['ifname'] = $_POST['ifname'];
         $a_ifgroups[$id] = $ifgroupentry;
         // Create new group
     } else {
         $ifgroupentry['ifname'] = $_POST['ifname'];
         $a_ifgroups[] = $ifgroupentry;
     }
 }
 write_config();
 interface_group_setup($ifgroupentry);
 header("Location: interfaces_groups.php");
 exit;
Ejemplo n.º 25
0
                            $queue->update_altq_queue_data($_POST);
                            $queue->wconfig();
                            write_config();
                            mark_subsystem_dirty('shaper');
                            $dontshow = false;
                        }
                        read_altq_config();
                        $output_form .= $queue->build_form();
                    } else {
                        $output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg . "</p>";
                        $dontshow = true;
                    }
                }
            }
        }
        mwexec("killall qstats");
    } else {
        $output_form .= "<p class=\"pgtitle\">" . $default_shaper_msg . "</p>";
        $dontshow = true;
    }
}
if ($queue) {
    if ($queue->GetEnabled()) {
        $can_enable = true;
    } else {
        $can_enable = false;
    }
    if ($queue->CanHaveChildren() && $can_enable) {
        if ($altq->GetQname() != $queue->GetQname() && $queue->GetDefault() != "") {
            $can_add = false;
        } else {
Ejemplo n.º 26
0
                     $final_address_details[] = preg_replace('/\\|\\|+/', '|', trim($_POST["detail{$x}"], "|"));
                     if (!$desc_fmt_err_found) {
                         $input_errors[] = $vertical_bar_err_text;
                         $desc_fmt_err_found = true;
                     }
                 }
             } else {
                 $final_address_details[] = sprintf(gettext("Entry added %s"), date('r'));
             }
             if (file_exists("{$temp_filename}/aliases")) {
                 $address = parse_aliases_file("{$temp_filename}/aliases", $_POST['type'], 3000);
                 if ($address == null) {
                     /* nothing was found */
                     $input_errors[] = sprintf(gettext("You must provide a valid URL. Could not fetch usable data from '%s'."), $_POST['address' . $x]);
                 }
                 mwexec("/bin/rm -rf " . escapeshellarg($temp_filename));
             } else {
                 $input_errors[] = sprintf(gettext("URL '%s' is not valid."), $_POST['address' . $x]);
             }
         }
     }
     unset($desc_fmt_err_found);
     if ($_POST['type'] == "url_ports") {
         $address = group_ports($address);
     }
 } else {
     /* item is a normal alias type */
     $wrongaliases = "";
     $desc_fmt_err_found = false;
     $alias_address_count = 0;
     $input_addresses = array();
Ejemplo n.º 27
0
##|*DESCR=Allow access to the 'Diagnostics: Reset state' page.
##|*MATCH=diag_resetstate.php*
##|-PRIV
require "guiconfig.inc";
require_once "filter.inc";
if ($_POST) {
    $savemsg = "";
    if ($_POST['statetable']) {
        filter_flush_state_table();
        if ($savemsg) {
            $savemsg .= " ";
        }
        $savemsg .= gettext("The state table has been flushed successfully.");
    }
    if ($_POST['sourcetracking']) {
        mwexec("/sbin/pfctl -F Sources");
        if ($savemsg) {
            $savemsg .= " <br />";
        }
        $savemsg .= gettext("The source tracking table has been flushed successfully.");
    }
}
$pgtitle = array(gettext("Diagnostics"), gettext("Reset state"));
include "head.inc";
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php 
include "fbegin.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
Ejemplo n.º 28
0
     $reqdfieldst = explode(" ", "numeric");
     do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
     do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
 }
 if (empty($input_errors)) {
     $config['nfsd']['enable'] = isset($_POST['enable']) ? true : false;
     $config['nfsd']['v4enable'] = isset($_POST['v4enable']) ? true : false;
     $config['nfsd']['numproc'] = $_POST['numproc'];
     $v4state = $config['nfsd']['v4enable'] == true ? "enable" : "disable";
     write_config();
     $retval = 0;
     if (!file_exists($d_sysrebootreqd_path)) {
         config_lock();
         rc_exec_script("/etc/rc.d/nfsuserd forcestop");
         $retval |= mwexec("/usr/local/sbin/rconf service {$v4state} nfsv4_server");
         $retval |= mwexec("/usr/local/sbin/rconf service {$v4state} nfsuserd");
         if (isset($config['nfsd']['enable']) && isset($config['nfsd']['v4enable'])) {
             $retval |= rc_exec_script("/etc/rc.d/nfsuserd start");
         }
         $retval |= rc_update_service("rpcbind");
         // !!! Do
         $retval |= rc_update_service("mountd");
         // !!! not
         $retval |= rc_update_service("nfsd");
         // !!! change
         $retval |= rc_update_service("statd");
         // !!! this
         $retval |= rc_update_service("lockd");
         // !!! order
         $retval |= rc_update_service("mdnsresponder");
         config_unlock();
Ejemplo n.º 29
0
function check_wireless_mode()
{
    global $_POST, $config, $g, $wlan_modes, $wancfg, $if, $wlanif, $wlanbaseif, $old_wireless_mode, $input_errors;
    if ($wancfg['wireless']['mode'] == $_POST['mode']) {
        return;
    }
    if (does_interface_exist(interface_get_wireless_clone($wlanbaseif))) {
        $clone_count = 1;
    } else {
        $clone_count = 0;
    }
    if (isset($config['wireless']['clone']) && is_array($config['wireless']['clone'])) {
        foreach ($config['wireless']['clone'] as $clone) {
            if ($clone['if'] == $wlanbaseif) {
                $clone_count++;
            }
        }
    }
    if ($clone_count > 1) {
        $old_wireless_mode = $wancfg['wireless']['mode'];
        $wancfg['wireless']['mode'] = $_POST['mode'];
        if (!interface_wireless_clone("{$wlanif}_", $wancfg)) {
            $input_errors[] = sprintf(gettext("Unable to change mode to %s.\t You may already have the maximum number of wireless clones supported in this mode."), $wlan_modes[$wancfg['wireless']['mode']]);
        } else {
            mwexec("/sbin/ifconfig " . escapeshellarg($wlanif) . "_ destroy");
        }
        $wancfg['wireless']['mode'] = $old_wireless_mode;
    }
}
Ejemplo n.º 30
0
    return false;
}
if ($_GET['act'] == "del") {
    if (!isset($_GET['id'])) {
        $input_errors[] = gettext("Wrong parameters supplied");
    } else {
        if (empty($a_bridges[$_GET['id']])) {
            $input_errors[] = gettext("Wrong index supplied");
        } else {
            if (bridge_inuse($_GET['id'])) {
                $input_errors[] = gettext("This bridge cannot be deleted because it is assigned as an interface.");
            } else {
                if (!does_interface_exist($a_bridges[$_GET['id']]['bridgeif'])) {
                    log_error("Bridge interface does not exist, skipping ifconfig destroy.");
                } else {
                    mwexec("/sbin/ifconfig " . $a_bridges[$_GET['id']]['bridgeif'] . " destroy");
                }
                unset($a_bridges[$_GET['id']]);
                write_config();
                header("Location: interfaces_bridge.php");
                exit;
            }
        }
    }
}
include "head.inc";
$main_buttons = array(array('href' => 'interfaces_bridge_edit.php', 'label' => gettext('Add')));
?>

<body>
<?php