Example #1
0
        		*/
        $config['snmpd']['trapenable'] = $_POST['trapenable'] ? true : false;
        $config['snmpd']['trapserver'] = $_POST['trapserver'];
        $config['snmpd']['trapserverport'] = $_POST['trapserverport'];
        $config['snmpd']['trapstring'] = $_POST['trapstring'];
        $config['snmpd']['modules']['mibii'] = $_POST['mibii'] ? true : false;
        $config['snmpd']['modules']['netgraph'] = $_POST['netgraph'] ? true : false;
        $config['snmpd']['modules']['pf'] = $_POST['pf'] ? true : false;
        $config['snmpd']['modules']['hostres'] = $_POST['hostres'] ? true : false;
        $config['snmpd']['modules']['bridge'] = $_POST['bridge'] ? true : false;
        $config['snmpd']['modules']['ucd'] = $_POST['ucd'] ? true : false;
        $config['snmpd']['modules']['regex'] = $_POST['regex'] ? true : false;
        $config['snmpd']['bindip'] = $_POST['bindip'];
        write_config();
        $retval = 0;
        $retval = services_snmpd_configure();
        $savemsg = get_std_save_message($retval);
    }
}
$closehead = false;
$pgtitle = array(gettext("Services"), gettext("SNMP"));
$shortcut_section = "snmp";
include "head.inc";
?>
<script type="text/javascript">
//<![CDATA[
function check_deps() {
	if (jQuery('#hostres').prop('checked') == true) {
		jQuery('#mibii').prop('checked',true);
	}
}
Example #2
0
        if (file_exists("{$g['tmp_path']}/.interfaces.apply")) {
            $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.interfaces.apply"));
            foreach ($toapplylist as $ifapply => $ifcfgo) {
                if (isset($config['interfaces'][$ifapply]['enable'])) {
                    interface_bring_down($ifapply, false, $ifcfgo);
                    interface_configure($ifapply, true);
                } else {
                    interface_bring_down($ifapply, true, $ifcfgo);
                    if (isset($config['dhcpd'][$ifapply]['enable']) || isset($config['dhcpdv6'][$ifapply]['enable'])) {
                        services_dhcpd_configure();
                    }
                }
            }
        }
        /* restart snmp so that it binds to correct address */
        services_snmpd_configure();
        /* sync filter configuration */
        setup_gateways_monitor();
        clear_subsystem_dirty('interfaces');
        filter_configure();
        enable_rrd_graphing();
        if (is_subsystem_dirty('staticroutes') && system_routing_configure() == 0) {
            clear_subsystem_dirty('staticroutes');
        }
    }
    @unlink("{$g['tmp_path']}/.interfaces.apply");
    header("Location: interfaces.php?if={$if}");
    exit;
} else {
    if ($_POST && $_POST['enable'] != "yes") {
        unset($wancfg['enable']);
Example #3
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));
}