Esempio n. 1
0
<script type="text/javascript">
//<![CDATA[
	prot_change();
//]]>
</script>

<?php 
if ($restart_webgui) {
    echo "<meta http-equiv=\"refresh\" content=\"20;url={$url}\" />";
}
?>

<?php 
include "foot.inc";
?>

<?php 
if ($restart_sshd) {
    killbyname("sshd");
    log_error(gettext("secure shell configuration has changed. Stopping sshd."));
    if ($config['system']['ssh']['enabled']) {
        log_error(gettext("secure shell configuration has changed. Restarting sshd."));
        configd_run("sshd restart");
    }
}
if ($restart_webgui) {
    ob_flush();
    flush();
    log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
    mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
}
Esempio n. 2
0
            }
        }
        write_config();
        system_hostname_configure();
        system_hosts_generate();
        system_resolvconf_generate();
        if (isset($config['dnsmasq']['enable'])) {
            services_dnsmasq_configure();
        } elseif (isset($config['unbound']['enable'])) {
            services_unbound_configure();
        }
        system_timezone_configure();
        system_firmware_configure();
        system_ntp_configure();
        if ($olddnsallowoverride != $config['system']['dnsallowoverride']) {
            configd_run("dns reload");
        }
        // Reload the filter - plugins might need to be run.
        filter_configure();
        $savemsg = get_std_save_message();
    }
    unset($ignore_posted_dnsgw);
}
legacy_html_escape_form_data($pconfig);
include "head.inc";
?>

<body>
    <?php 
include "fbegin.inc";
?>
Esempio n. 3
0
            $delTable = escapeshellarg($tablename);
            configd_run("filter delete table {$delTable} {$delEntry}");
            header("Location: diag_tables.php?tablename=" . $tablename);
            exit;
        }
    } elseif (isset($_POST['act']) && $_POST['act'] == 'flush') {
        $delTable = escapeshellarg($tablename);
        configd_run("filter delete table {$delTable} ALL");
        header("Location: diag_tables.php?tablename=" . $tablename);
        exit;
    }
}
// fetch list of tables and content of selected table
$tables = json_decode(configd_run("filter list tables json"));
if (in_array($tablename, $tables)) {
    $entries = json_decode(configd_run("filter list table {$tablename} json"));
} else {
    $entries = array();
}
include "head.inc";
?>
<body>
<?php 
include "fbegin.inc";
?>


<script type="text/javascript">
$( document ).ready(function() {
    // on change pfTable selection
     $("#tablename").change(function(){
Esempio n. 4
0
        filter_configure();
        $savemsg = get_std_save_message();
        if ($restart_webgui) {
            $savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."), $url);
        }
        setup_serial_port();
        system_hosts_generate();
        // Restart DNS in case dns rebinding toggled
        if (isset($config['dnsmasq']['enable'])) {
            services_dnsmasq_configure();
        } elseif (isset($config['unbound']['enable'])) {
            services_unbound_configure();
        }
        if ($restart_sshd) {
            log_error(gettext('Secure Shell configuration has changed. Applying now...'));
            configd_run('sshd restart', true);
        }
        if ($restart_webgui) {
            log_error(gettext('webConfigurator configuration has changed. Applying now...'));
            mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
        }
    }
}
$a_cert = isset($config['cert']) ? $config['cert'] : array();
$certs_available = false;
if (count($a_cert)) {
    $certs_available = true;
}
if (empty($pconfig['webguiproto']) || !$certs_available) {
    $pconfig['webguiproto'] = "http";
}
Esempio n. 5
0
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // fetch only valid input data (items from above lists)
    $viewtype = 'default';
    $numstate = '200';
    $sorttype = 'bytes';
    if (isset($_POST['viewtype']) && in_array($_POST['viewtype'], $viewtypes)) {
        $viewtype = $_POST['viewtype'];
    }
    if (isset($_POST['states']) && in_array($_POST['states'], $numstates)) {
        $numstate = $_POST['states'];
    }
    if (isset($_POST['sorttype']) && in_array($_POST['sorttype'], $sorttypes)) {
        $sorttype = $_POST['sorttype'];
    }
    // fetch pftop data
    echo configd_run("filter diag top {$sorttype} {$viewtype} {$numstate}");
    exit;
}
include "head.inc";
?>
<body>
<?php 
include "fbegin.inc";
?>
<script type="text/javascript">
$( document ).ready(function() {
    /**
     * fetch pftop data from backend
     */
    function getpftopactivity() {
      $.ajax(
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    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_once "guiconfig.inc";
require_once "pfsense-utils.inc";
require_once "interfaces.inc";
/* TCP flags */
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
/* OS types, request from backend */
$ostypes = json_decode(configd_run('filter list osfp json'));
/**
 * build array with interface options for this form
 */
function formInterfaces()
{
    global $config;
    $interfaces = array();
    foreach (get_configured_interface_with_descr(false, true) as $if => $ifdesc) {
        $interfaces[$if] = $ifdesc;
    }
    if (!empty($config['ifgroups']['ifgroupentry']) && is_array($config['ifgroups']['ifgroupentry'])) {
        foreach ($config['ifgroups']['ifgroupentry'] as $ifgrp) {
            $interfaces[$ifgrp['ifname']] = $ifgrp['descr'];
        }
    }
Esempio n. 7
0
<script type="text/javascript">
//<![CDATA[
	prot_change();
//]]>
</script>

<?php 
if ($restart_webgui) {
    echo "<meta http-equiv=\"refresh\" content=\"20;url={$url}\" />";
}
?>

<?php 
include "foot.inc";
?>

<?php 
if ($restart_sshd) {
    killbyname("sshd");
    log_error(gettext("secure shell configuration has changed. Stopping sshd."));
    if ($config['system']['ssh']['enabled']) {
        log_error(gettext("secure shell configuration has changed. Restarting sshd."));
        configd_run("sshd restart");
    }
}
if ($restart_webgui) {
    ob_flush();
    flush();
    log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
    configd_run("webgui restart 2", true);
}
Esempio n. 8
0
}
if ($_GET['getstatus']) {
    echo "|{$status}|";
    exit;
}
if ($_POST['reloadfilter']) {
    configd_run("filter reload");
    if (isset($config['hasync']['synchronizetoip']) && trim($config['hasync']['synchronizetoip']) != "") {
        // only try to sync when hasync is configured
        configd_run("filter sync reload");
    }
    header("Location: status_filter_reload.php");
    exit;
}
if ($_POST['syncfilter']) {
    configd_run("filter sync");
    header("Location: status_filter_reload.php");
    exit;
}
include "head.inc";
?>

<body>

<?php 
include "fbegin.inc";
?>

	<section class="page-content-main">
		<div class="container-fluid">
			<div class="row">
             if ($rule['gateway'] == $a_gateway_groups[$_POST['id']]['name']) {
                 unset($config['filter']['rule'][$idx]['gateway']);
             }
         }
         unset($a_gateway_groups[$_POST['id']]);
         write_config();
         mark_subsystem_dirty('staticroutes');
         header("Location: system_gateway_groups.php");
         exit;
     }
 } elseif (isset($_POST['apply'])) {
     $retval = 0;
     $retval = system_routing_configure();
     configd_run('dyndns reload');
     configd_run('ipsecdns reload');
     configd_run('filter reload');
     /* reconfigure our gateway monitor */
     setup_gateways_monitor();
     if ($retval == 0) {
         clear_subsystem_dirty('staticroutes');
     }
     foreach ($a_gateway_groups as $gateway_group) {
         $gw_subsystem = 'gwgroup.' . $gateway_group['name'];
         if (is_subsystem_dirty($gw_subsystem)) {
             openvpn_resync_gwgroup($gateway_group['name']);
             clear_subsystem_dirty($gw_subsystem);
         }
     }
     header("Location: system_gateway_groups.php");
     exit;
 }
Esempio n. 10
0
                update_alias_names_upon_change(array('aliases', 'alias'), array('address'), $pconfig['name'], $origname);
            }
            // save to config
            if (isset($id)) {
                $a_aliases[$id] = $confItem;
            } else {
                $a_aliases[] = $confItem;
            }
            // Sort list
            $a_aliases = msort($a_aliases, "name");
            if (write_config()) {
                // post save actions
                mark_subsystem_dirty('aliases');
                if (strpos($pconfig['type'], 'url') !== false) {
                    // update URL Table Aliases
                    configd_run('filter refresh_url_alias', true);
                }
            }
            if ($pconfig['type'] == 'host') {
                header("Location: firewall_aliases.php?tab=ip");
            } elseif (strpos($pconfig['type'], 'url') !== false) {
                header("Location: firewall_aliases.php?tab=url");
            } else {
                header("Location: firewall_aliases.php?tab=" . $pconfig['type']);
            }
            exit;
        }
    }
}
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_aliases.php';
legacy_html_escape_form_data($pconfig);
Esempio n. 11
0
        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
        AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
        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_once "guiconfig.inc";
include_once "includes/functions.inc.php";
require_once "pfsense-utils.inc";
require_once "system.inc";
if (isset($_REQUEST['getupdatestatus'])) {
    $pkg_json = trim(configd_run('firmware pkgstatus'));
    if ($pkg_json != '') {
        $pkg_status = json_decode($pkg_json, true);
    }
    if (!isset($pkg_status) || $pkg_status["connection"] == "error") {
        echo "<span class='text-danger'>" . gettext("Connection Error") . "</span><br/><span class='btn-link' onclick='checkupdate()'>" . gettext("Click to retry") . "</span>";
    } elseif ($pkg_status["repository"] == "error") {
        echo "<span class='text-danger'>" . gettext("Repository Problem") . "</span><br/><span class='btn-link' onclick='checkupdate()'>" . gettext("Click to retry") . "</span>";
    } elseif ($pkg_status["updates"] == "0") {
        echo "<span class='text-info'>" . gettext("Your system is up to date.") . "</span><br/><span class='btn-link' onclick='checkupdate()'>" . gettext('Click to check for updates') . "</span>";
    } else {
        echo "<span class='text-info'>" . gettext("There are ") . $pkg_status["updates"] . gettext(" update(s) available.") . "</span><br/><a href='/ui/core/firmware/#checkupdate'>" . gettext("Click to upgrade") . "</a> | <span class='btn-link' onclick='checkupdate()'>" . gettext('Re-check now') . "</span>";
    }
    exit;
}
$filesystems = get_mounted_filesystems();
        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
        AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
        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_once "guiconfig.inc";
require_once "pfsense-utils.inc";
require_once "system.inc";
require_once "stats.inc";
if (isset($_REQUEST['getupdatestatus'])) {
    $pkg_json = trim(configd_run('firmware check'));
    if ($pkg_json != '') {
        $pkg_status = json_decode($pkg_json, true);
    }
    if (!isset($pkg_status) || $pkg_status["connection"] == "error") {
        echo "<span class='text-danger'>" . gettext("Connection Error") . "</span><br/><span class='btn-link' onclick='checkupdate()'>" . gettext("Click to retry") . "</span>";
    } elseif ($pkg_status["repository"] == "error") {
        echo "<span class='text-danger'>" . gettext("Repository Problem") . "</span><br/><span class='btn-link' onclick='checkupdate()'>" . gettext("Click to retry") . "</span>";
    } elseif ($pkg_status["updates"] == "0") {
        echo "<span class='text-info'>" . gettext("Your system is up to date.") . "</span><br/><span class='btn-link' onclick='checkupdate()'>" . gettext('Click to check for updates') . "</span>";
    } else {
        echo "<span class='text-info'>" . gettext("There are ") . $pkg_status["updates"] . gettext(" update(s) available.") . "</span><br/><a href='/ui/core/firmware/#checkupdate'>" . gettext("Click to upgrade") . "</a> | <span class='btn-link' onclick='checkupdate()'>" . gettext('Re-check now') . "</span>";
    }
    exit;
}
$filesystems = get_mounted_filesystems();
Esempio n. 13
0
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    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_once "guiconfig.inc";
require_once "vpn.inc";
require_once "services.inc";
require_once "interfaces.inc";
$shortcut_section = 'ipsec';
include "head.inc";
$ipsec_leases = json_decode(configd_run("ipsec list leases"), true);
?>
<body>

<?php 
include "fbegin.inc";
?>
  <section class="page-content-main">
    <div class="container-fluid">
      <div class="row">
        <section class="col-xs-12">
          <div class="content-box">
<?php 
if (count($ipsec_leases) > 0) {
    foreach ($ipsec_leases as $pool => $pool_data) {
        ?>
Esempio n. 14
0
    foreach (array_reverse($portarr, TRUE) as $port => $count) {
        $str = "";
        $service = getservbyport($port, strtolower($proto));
        $port = "{$proto}/{$port}";
        if (!empty($service)) {
            $port = "{$port} ({$service})";
        }
        $ports[] = "{$port}: {$count}";
    }
    return implode($ports, ', ');
}
$srcipinfo = array();
$dstipinfo = array();
$allipinfo = array();
$pairipinfo = array();
$states = json_decode(configd_run("filter list states json"), true);
if (isset($states['details'])) {
    foreach ($states['details'] as $state) {
        if (isset($state['nat_addr']) && $states['direction'] == 'out') {
            $srcip = $state['nat_addr'];
            $srcport = $state['nat_port'];
        } else {
            $srcip = $state['src_addr'];
            $srcport = $state['src_port'];
        }
        $dstip = $state['dst_addr'];
        $dstport = $state['dst_port'];
        $proto = $state['proto'];
        addipinfo($srcipinfo, $srcip, $proto, $srcport, $dstport);
        addipinfo($dstipinfo, $dstip, $proto, $srcport, $dstport);
        addipinfo($pairipinfo, "{$srcip} -> {$dstip}", $proto, $srcport, $dstport);
Esempio n. 15
0
     } else {
         unset($gateway['disabled']);
     }
     /* when saving the manual gateway we use the attribute which has the corresponding id */
     if (isset($realid)) {
         $a_gateway_item[$realid] = $gateway;
     } else {
         $a_gateway_item[] = $gateway;
     }
     mark_subsystem_dirty('staticroutes');
     write_config();
     if (!empty($_REQUEST['isAjax'])) {
         echo $pconfig['name'];
         exit;
     } elseif (!empty($reloadif)) {
         configd_run("interface reconfigure {$reloadif}");
     }
     header("Location: system_gateways.php");
     exit;
 } else {
     if (!empty($_REQUEST['isAjax'])) {
         header("HTTP/1.0 500 Internal Server Error");
         header("Content-type: text/plain");
         foreach ($input_errors as $error) {
             echo "{$error}\n";
         }
         exit;
     }
     if (!empty($pconfig['interface'])) {
         $pconfig['friendlyiface'] = $_POST['interface'];
     }
Esempio n. 16
0
function service_control_restart($name, $extras)
{
    switch ($name) {
        case 'radvd':
            services_radvd_configure();
            break;
        case 'ntpd':
            system_ntp_configure();
            break;
        case 'apinger':
            killbypid("/var/run/apinger.pid");
            setup_gateways_monitor();
            break;
        case 'bsnmpd':
            services_snmpd_configure();
            break;
        case 'dhcrelay':
            services_dhcrelay_configure();
            break;
        case 'dhcrelay6':
            services_dhcrelay6_configure();
            break;
        case 'dnsmasq':
            services_dnsmasq_configure();
            break;
        case 'unbound':
            services_unbound_configure();
            break;
        case 'dhcpd':
            services_dhcpd_configure();
            break;
        case 'igmpproxy':
            services_igmpproxy_configure();
            break;
        case 'miniupnpd':
            upnp_action('restart');
            break;
        case 'ipsec':
            vpn_ipsec_force_reload();
            break;
        case 'sshd':
            configd_run("sshd restart");
            break;
        case 'openvpn':
            $vpnmode = htmlspecialchars($extras['vpnmode']);
            if ($vpnmode == "server" || $vpnmode == "client") {
                $id = htmlspecialchars($extras['id']);
                $configfile = "/var/etc/openvpn/{$vpnmode}{$id}.conf";
                if (file_exists($configfile)) {
                    openvpn_restart_by_vpnid($vpnmode, $id);
                }
            }
            break;
        case 'relayd':
            relayd_configure(true);
            break;
        case 'squid':
            configd_run("proxy restart");
            break;
        case 'suricata':
            configd_run("ids restart");
            break;
        default:
            log_error(sprintf(gettext("Could not restart unknown service `%s'"), $name));
            break;
    }
    return sprintf(gettext("%s has been restarted."), htmlspecialchars($name));
}
Esempio n. 17
0
                }
            }
            interfaces_carp_setup();
            set_single_sysctl('net.inet.carp.allow', '1');
        }
    }
}
$carpcount = 0;
foreach ($a_vip as $carp) {
    if ($carp['mode'] == "carp") {
        $carpcount++;
        break;
    }
}
// fetch pfsync info
$pfsyncnodes = json_decode(configd_run("filter list pfsync json"), true);
legacy_html_escape_form_data($a_vip);
$status = get_single_sysctl('net.inet.carp.allow') > 0;
$carp_detected_problems = array_pop(get_sysctl("net.inet.carp.demotion")) > 0;
include "head.inc";
?>

<body>
<?php 
include "fbegin.inc";
?>

<section class="page-content-main">
  <div class="container-fluid">
    <div class="row">
      <?php 
Esempio n. 18
0
            if (!empty($_POST['connid'])) {
                configd_run("ipsec connect " . $_POST['connid']);
            }
            break;
        case 'disconnect':
            if (!empty($_POST['connid'])) {
                configd_run("ipsec disconnect " . $_POST['connid']);
            }
            break;
        default:
            break;
    }
    header("Location: diag_ipsec.php");
    exit(0);
}
$ipsec_status = json_decode(configd_run("ipsec list_status"), true);
if ($ipsec_status == null) {
    $ipsec_status = array();
}
$pgtitle = array(gettext('VPN'), gettext('IPsec'), gettext('Status Overview'));
$shortcut_section = 'ipsec';
include "head.inc";
?>
<script type="text/javascript">
  $( document ).ready(function() {
      // show / hide connection details
      $(".ipsec_info").click(function(event){
          $("#" + $(this).data('target')).toggleClass('hidden visible');
          event.preventDefault();
      });
  });
Esempio n. 19
0
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    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_once "guiconfig.inc";
$pgtitle = gettext("Diagnostics: pfInfo");
$data_tabs = array("info", "memory", "timeouts", "interfaces");
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['getactivity'])) {
        $diag = configd_run("filter diag info json");
        echo $diag;
    }
    exit;
}
include "head.inc";
?>
<body>
<?php 
include "fbegin.inc";
?>
<script type="text/javascript">
$( document ).ready(function() {
  function getpfinfo() {
    jQuery.ajax({
      type: "post",