コード例 #1
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));
}
コード例 #2
0
##|-PRIV
require_once "guiconfig.inc";
require_once "functions.inc";
require_once "filter.inc";
require_once "shaper.inc";
require_once "vslb.inc";
if (!is_array($config['load_balancer']['virtual_server'])) {
    $config['load_balancer']['virtual_server'] = array();
}
$a_vs =& $config['load_balancer']['virtual_server'];
if ($_POST) {
    $pconfig = $_POST;
    if ($_POST['apply']) {
        $retval = 0;
        $retval |= filter_configure();
        $retval |= relayd_configure();
        $savemsg = get_std_save_message($retval);
        /* Wipe out old relayd anchors no longer in use. */
        cleanup_lb_marked();
        clear_subsystem_dirty('loadbalancer');
    }
}
if ($_GET['act'] == "del") {
    if (array_key_exists($_GET['id'], $a_vs)) {
        if (!$input_errors) {
            cleanup_lb_mark_anchor($a_vs[$_GET['id']]['name']);
            unset($a_vs[$_GET['id']]);
            write_config();
            mark_subsystem_dirty('loadbalancer');
            header("Location: load_balancer_virtual_server.php");
            exit;
コード例 #3
0
            install_cron_job("/etc/rc.backup_dhcpleases.sh", $config['system']['dhcpbackup'] > 0, $minute = "0", "*/{$config['system']['dhcpbackup']}");
        }
        write_config();
        $retval = 0;
        system_resolvconf_generate(true);
        $retval = filter_configure();
        if (stristr($retval, "error") != true) {
            $savemsg = get_std_save_message(gettext($retval));
        } else {
            $savemsg = gettext($retval);
        }
        activate_powerd();
        load_crypto();
        load_thermal_hardware();
        if ($need_relayd_restart) {
            relayd_configure();
        }
    }
}
$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Miscellaneous"));
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'success');
}
$tab_array = array();
$tab_array[] = array(gettext("Admin Access"), false, "system_advanced_admin.php");
$tab_array[] = array(htmlspecialchars(gettext("Firewall & NAT")), false, "system_advanced_firewall.php");
$tab_array[] = array(gettext("Networking"), false, "system_advanced_network.php");
コード例 #4
0
ファイル: xmlrpc.php プロジェクト: michaeleino/pfsense
function filter_configure_xmlrpc($raw_params)
{
    global $xmlrpc_g, $config;
    $params = xmlrpc_params_to_php($raw_params);
    if (!xmlrpc_auth($params)) {
        xmlrpc_authfail();
        return $xmlrpc_g['return']['authfail'];
    }
    filter_configure();
    system_routing_configure();
    setup_gateways_monitor();
    relayd_configure();
    require_once "openvpn.inc";
    openvpn_resync_all();
    if (isset($config['dnsmasq']['enable'])) {
        services_dnsmasq_configure();
    } elseif (isset($config['unbound']['enable'])) {
        services_unbound_configure();
    } else {
        # Both calls above run services_dhcpd_configure(), then we just
        # need to call it when they are not called to avoid restarting dhcpd
        # twice, as described on ticket #3797
        services_dhcpd_configure();
    }
    local_sync_accounts();
    return $xmlrpc_g['return']['true'];
}
コード例 #5
0
ファイル: xmlrpc.php プロジェクト: KyleJohnstonNet/pfsense
 /**
  * Wrapper for filter_configure()
  *
  * @param string $username
  * @param string $password
  *
  * @return bool
  */
 public function filter_configure($username, $password)
 {
     $this->auth($username, $password);
     global $g, $config;
     filter_configure();
     system_routing_configure();
     setup_gateways_monitor();
     relayd_configure();
     require_once "openvpn.inc";
     openvpn_resync_all();
     /*
      * The DNS Resolver and the DNS Forwarder may both be active so
      * long as * they are running on different ports.
      * See ticket #5882
      */
     if (isset($config['dnsmasq']['enable'])) {
         /* Configure dnsmasq but tell it NOT to restart DHCP */
         services_dnsmasq_configure(false);
     } else {
         /* kill any running dnsmasq instance */
         if (isvalidpid("{$g['varrun_path']}/dnsmasq.pid")) {
             sigkillbypid("{$g['varrun_path']}/dnsmasq.pid", "TERM");
         }
     }
     if (isset($config['unbound']['enable'])) {
         /* Configure unbound but tell it NOT to restart DHCP */
         services_unbound_configure(false);
     } else {
         /* kill any running Unbound instance */
         if (isvalidpid("{$g['varrun_path']}/unbound.pid")) {
             sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
         }
     }
     /*
      * Call this separately since the above are manually set to
      * skip the DHCP restart they normally perform.
      * This avoids restarting dhcpd twice as described on
      * ticket #3797
      */
     services_dhcpd_configure();
     local_sync_accounts();
     return true;
 }
コード例 #6
0
ファイル: xmlrpc.php プロジェクト: curtiszimmerman/pfsense
function filter_configure_xmlrpc($raw_params)
{
    global $xmlrpc_g, $g, $config;
    $params = xmlrpc_params_to_php($raw_params);
    if (!xmlrpc_auth($params)) {
        xmlrpc_authfail();
        return $xmlrpc_g['return']['authfail'];
    }
    filter_configure();
    system_routing_configure();
    setup_gateways_monitor();
    relayd_configure();
    require_once "openvpn.inc";
    openvpn_resync_all();
    /* The DNS Resolver and the DNS Forwarder may both be active so long as
     * they are running on different ports. See ticket #5882
     */
    $need_dhcp_start = true;
    if (isset($config['dnsmasq']['enable'])) {
        /* Configure dnsmasq but tell it NOT to restart DHCP */
        services_dnsmasq_configure(false);
    } else {
        /* kill any running dnsmasq since it is not enabled. */
        if (file_exists("{$g['varrun_path']}/dnsmasq.pid")) {
            sigkillbypid("{$g['varrun_path']}/dnsmasq.pid", "TERM");
        }
    }
    if (isset($config['unbound']['enable'])) {
        /* Configure unbound but tell it NOT to restart DHCP */
        services_unbound_configure(false);
    } else {
        /* kill any running Unbound instance since it is not enabled. */
        if (file_exists("{$g['varrun_path']}/unbound.pid")) {
            sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
        }
    }
    /* Call this separately since the above are manually set to skip the DHCP restart they normally perform.
     * This avoids restarting dhcpd twice as described on ticket #3797
     */
    services_dhcpd_configure();
    local_sync_accounts();
    return $xmlrpc_g['return']['true'];
}
コード例 #7
0
ファイル: xmlrpc.php プロジェクト: rdmenezes/pfsense
function filter_configure_xmlrpc($raw_params)
{
    global $xmlrpc_g;
    $params = xmlrpc_params_to_php($raw_params);
    if (!xmlrpc_auth($params)) {
        xmlrpc_authfail();
        return $xmlrpc_g['return']['authfail'];
    }
    filter_configure();
    system_routing_configure();
    setup_gateways_monitor();
    relayd_configure();
    require_once "openvpn.inc";
    openvpn_resync_all();
    services_dhcpd_configure();
    services_dnsmasq_configure();
    local_sync_accounts();
    return $xmlrpc_g['return']['true'];
}