Example #1
0
            write_config();
            redirectHeader("system_authservers.php");
        } else {
            $act = "edit";
        }
    } elseif (isset($pconfig['act']) && $pconfig['act'] == 'del' && isset($id)) {
        /* Remove server from main list. */
        $serverdeleted = $a_server[$id]['name'];
        foreach ($config['system']['authserver'] as $k => $as) {
            if ($config['system']['authserver'][$k]['name'] == $serverdeleted) {
                unset($config['system']['authserver'][$k]);
            }
        }
        $savemsg = gettext("Authentication Server") . " {$serverdeleted} " . gettext("deleted") . "<br />";
        write_config($savemsg);
        redirectHeader("system_authservers.php");
    }
}
$pgtitle = array(gettext('System'), gettext('Users'), gettext('Servers'));
$shortcut_section = "authentication";
// list of all possible fields for auth item (used for form init)
$all_authfields = array('type', 'name', 'ldap_caref', 'ldap_host', 'ldap_port', 'ldap_urltype', 'ldap_protver', 'ldap_scope', 'ldap_basedn', 'ldap_authcn', 'ldap_extended_query', 'ldap_binddn', 'ldap_bindpw', 'ldap_attr_user', 'radius_host', 'radius_auth_port', 'radius_acct_port', 'radius_secret', 'radius_timeout', 'radius_srvcs');
foreach ($all_authfields as $fieldname) {
    if (!isset($pconfig[$fieldname])) {
        $pconfig[$fieldname] = null;
    }
}
legacy_html_escape_form_data($pconfig);
legacy_html_escape_form_data($a_server);
include "head.inc";
$main_buttons = array(array('label' => 'Add server', 'href' => 'system_authservers.php?act=new'));
Example #2
0
            if (!isset($pconfig[$fieldname])) {
                $pconfig[$fieldname] = null;
            }
        }
    }
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['id']) && is_numericint($_POST['id'])) {
        $id = $_POST['id'];
    }
    if (isset($_POST['act'])) {
        $act = $_POST['act'];
    }
    if ($act == "del") {
        // remove client
        if (!isset($id) || !isset($a_client[$id])) {
            redirectHeader("vpn_openvpn_client.php");
            exit;
        }
        if (!empty($a_client[$id])) {
            openvpn_delete('client', $a_client[$id]);
        }
        unset($a_client[$id]);
        write_config();
    } else {
        // update client (after validation)
        $pconfig = $_POST;
        $input_errors = array();
        if (isset($id) && $a_client[$id]) {
            $vpnid = $a_client[$id]['vpnid'];
        }
        if (isset($pconfig['mode']) && $pconfig['mode'] != "p2p_shared_key") {
Example #3
0
            if (!isset($pconfig[$fieldname])) {
                $pconfig[$fieldname] = null;
            }
        }
    }
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['id']) && is_numericint($_POST['id'])) {
        $id = $_POST['id'];
    }
    if (isset($_POST['act'])) {
        $act = $_POST['act'];
    }
    if ($act == "del") {
        // action delete
        if (!isset($a_server[$id])) {
            redirectHeader("vpn_openvpn_server.php");
            exit;
        }
        if (!empty($a_server[$id])) {
            openvpn_delete('server', $a_server[$id]);
        }
        unset($a_server[$id]);
        write_config();
    } else {
        // action add/update
        $input_errors = array();
        $pconfig = $_POST;
        if (isset($id) && $a_server[$id]) {
            $vpnid = $a_server[$id]['vpnid'];
        } else {
            $vpnid = 0;
     $config['notifications']['smtp']['username'] = $_POST['smtpusername'];
     $config['notifications']['smtp']['password'] = $_POST['smtppassword'];
     $config['notifications']['smtp']['fromaddress'] = $_POST['smtpfromaddress'];
     if ($_POST['disable_smtp'] == "yes") {
         $config['notifications']['smtp']['disable'] = true;
     } else {
         unset($config['notifications']['smtp']['disable']);
     }
     // System Sounds
     if ($_POST['disablebeep'] == "yes") {
         $config['system']['disablebeep'] = true;
     } else {
         unset($config['system']['disablebeep']);
     }
     write_config();
     redirectHeader("system_advanced_notifications.php");
     return;
 }
 if ($_POST['test_growl'] == gettext("Test Growl")) {
     // Send test message via growl
     if ($config['notifications']['growl']['ipaddress'] && ($config['notifications']['growl']['password'] = $_POST['password'])) {
         @unlink('/var/db/growlnotices_lastmsg.txt');
         register_via_growl();
         notify_via_growl(sprintf(gettext("This is a test message from %s.  It is safe to ignore this message."), $g['product_name']), true);
     }
 }
 if ($_POST['test_smtp'] == gettext("Test SMTP")) {
     // Send test message via smtp
     @unlink('/var/db/notices_lastmsg.txt');
     $savemsg = notify_via_smtp(sprintf(gettext("This is a test message from %s.  It is safe to ignore this message."), $g['product_name']), true);
 }
Example #5
0
            /* Add the user to All Users group. */
            foreach ($config['system']['group'] as $gidx => $group) {
                if ($group['name'] == "all") {
                    if (!is_array($config['system']['group'][$gidx]['member'])) {
                        $config['system']['group'][$gidx]['member'] = array();
                    }
                    $config['system']['group'][$gidx]['member'][] = $userent['uid'];
                    break;
                }
            }
            $a_user[] = $userent;
        }
        local_user_set_groups($userent, $_POST['groups']);
        local_user_set($userent);
        write_config();
        redirectHeader("system_usermanager.php");
    }
}
$closehead = false;
include "head.inc";
?>

<body>

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

<script type="text/javascript">
//<![CDATA[
        } else {
            $name = "Shared Key Server {$prot}:{$port}";
        }
        $ras_serverent['index'] = $sindex;
        $ras_serverent['name'] = $name;
        $ras_serverent['mode'] = $server['mode'];
        $ras_server[] = $ras_serverent;
    }
}
if (isset($_GET['act'])) {
    $input_errors = array();
    $act = $_GET['act'];
    if ($act == "skconf" || $act == "skzipconf") {
        $srvid = isset($_GET['srvid']) ? $_GET['srvid'] : false;
        if ($srvid === false || !isset($config['openvpn']['openvpn-server'][$srvid]['mode']) || $config['openvpn']['openvpn-server'][$srvid]['mode'] != "p2p_shared_key") {
            redirectHeader("vpn_openvpn_export.php");
            exit;
        }
        if (empty($_GET['useaddr'])) {
            $input_errors[] = "You need to specify an IP or hostname.";
        } else {
            $useaddr = $_GET['useaddr'];
        }
        $proxy = "";
        if (!empty($_GET['proxy_addr']) || !empty($_GET['proxy_port'])) {
            $proxy = array();
            if (empty($_GET['proxy_addr'])) {
                $input_errors[] = "You need to specify an address for the proxy port.";
            } else {
                $proxy['ip'] = $_GET['proxy_addr'];
            }
Example #7
0
    $config['openvpn']['openvpn-csc'] = array();
}
$a_csc =& $config['openvpn']['openvpn-csc'];
if (is_numericint($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
$act = $_GET['act'];
if (isset($_POST['act'])) {
    $act = $_POST['act'];
}
if ($_GET['act'] == "del") {
    if (!$a_csc[$id]) {
        redirectHeader("vpn_openvpn_csc.php");
        exit;
    }
    openvpn_delete_csc($a_csc[$id]);
    unset($a_csc[$id]);
    write_config();
    $savemsg = gettext("Client Specific Override successfully deleted") . "<br />";
}
if ($_GET['act'] == "edit") {
    if (isset($id) && $a_csc[$id]) {
        $pconfig['custom_options'] = $a_csc[$id]['custom_options'];
        $pconfig['disable'] = isset($a_csc[$id]['disable']);
        $pconfig['common_name'] = $a_csc[$id]['common_name'];
        $pconfig['block'] = $a_csc[$id]['block'];
        $pconfig['description'] = $a_csc[$id]['description'];
        $pconfig['tunnel_network'] = $a_csc[$id]['tunnel_network'];
Example #8
0
            $retval = vpn_l2tp_configure();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            if (is_subsystem_dirty('l2tpusers')) {
                clear_subsystem_dirty('l2tpusers');
            }
        }
    }
}
if ($_GET['act'] == "del") {
    if ($a_secret[$_GET['id']]) {
        unset($a_secret[$_GET['id']]);
        write_config();
        mark_subsystem_dirty('l2tpusers');
        redirectHeader("vpn_l2tp_users.php");
        exit;
    }
}
include "head.inc";
$main_buttons = array(array('label' => gettext("add user"), 'href' => 'vpn_l2tp_users_edit.php'));
?>

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

	<section class="page-content-main">
		<div class="container-fluid">
			<div class="row">
Example #9
0
    if (!$a_ca[$id]) {
        redirectHeader("system_camanager.php");
        exit;
    }
    $exp_name = urlencode("{$a_ca[$id]['descr']}.crt");
    $exp_data = base64_decode($a_ca[$id]['crt']);
    $exp_size = strlen($exp_data);
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename={$exp_name}");
    header("Content-Length: {$exp_size}");
    echo $exp_data;
    exit;
}
if ($act == "expkey") {
    if (!$a_ca[$id]) {
        redirectHeader("system_camanager.php");
        exit;
    }
    $exp_name = urlencode("{$a_ca[$id]['descr']}.key");
    $exp_data = base64_decode($a_ca[$id]['prv']);
    $exp_size = strlen($exp_data);
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename={$exp_name}");
    header("Content-Length: {$exp_size}");
    echo $exp_data;
    exit;
}
if ($_POST) {
    unset($input_errors);
    $input_errors = array();
    $pconfig = $_POST;
Example #10
0
}
$act = isset($_POST['act']) ? $_POST['act'] : '';
if ($act == "delgroup") {
    if (!isset($id) || !isset($_POST['groupname']) || !isset($a_group[$id]) || $_POST['groupname'] != $a_group[$id]['name']) {
        redirectHeader("system_groupmanager.php");
        exit;
    }
    local_group_del($a_group[$id]);
    $groupdeleted = $a_group[$id]['name'];
    unset($a_group[$id]);
    write_config();
    $savemsg = gettext("Group") . " {$groupdeleted} " . gettext("successfully deleted") . "<br />";
}
if ($act == "delpriv") {
    if (!isset($id) || !isset($a_group[$id])) {
        redirectHeader("system_groupmanager.php");
        exit;
    }
    $privdeleted = $priv_list[$a_group[$id]['priv'][$_POST['privid']]]['name'];
    unset($a_group[$id]['priv'][$_POST['privid']]);
    if (is_array($a_group[$id]['member'])) {
        foreach ($a_group[$id]['member'] as $uid) {
            $user = getUserEntryByUID($uid);
            if ($user) {
                local_user_set($user);
            }
        }
    }
    write_config();
    $act = "edit";
    $savemsg = gettext("Privilege") . " {$privdeleted} " . gettext("successfully deleted") . "<br />";
Example #11
0
    }
    if (!$input_errors && is_array($imported_ips)) {
        $alias = array();
        $alias['address'] = implode(" ", $imported_ips);
        $alias['detail'] = implode("||", $imported_descs);
        $alias['name'] = $_POST['name'];
        $alias['type'] = "network";
        $alias['descr'] = $_POST['descr'];
        unset($imported_ips, $imported_descs);
        $a_aliases[] = $alias;
        // Sort list
        $a_aliases = msort($a_aliases, "name");
        if (write_config()) {
            mark_subsystem_dirty('aliases');
        }
        redirectHeader("firewall_aliases.php");
        exit;
    }
}
include "head.inc";
?>
<body>
<?php 
include "fbegin.inc";
?>


	<section class="page-content-main">
		<div class="container-fluid">
			<div class="row">
            $a_group['priv'] = $pconfig['sysprivs'];
        } else {
            $a_group['priv'] = array_merge($a_group['priv'], $pconfig['sysprivs']);
        }
        if (is_array($a_group['member'])) {
            foreach ($a_group['member'] as $uid) {
                $user = getUserEntryByUID($uid);
                if ($user) {
                    local_user_set($user);
                }
            }
        }
        admin_groups_sort();
        $retval = write_config();
        $savemsg = get_std_save_message($retval);
        redirectHeader("system_groupmanager.php?act=edit&amp;id={$groupid}");
        exit;
    }
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
    print_info_box_np($savemsg);
}
include "head.inc";
?>

<body onload="<?php 
echo $jsevents["body"]["onload"];
?>
">
<?php 
Example #13
0
            sync_package_miniupnpd();
            parse_package_templates();
            /* if start_command is defined, restart w/ this */
            if (!empty($pkg['start_command'])) {
                exec($pkg['start_command'] . ">/dev/null 2&>1");
            }
            /* if restart_command is defined, restart w/ this */
            if (!empty($pkg['restart_command'])) {
                exec($pkg['restart_command'] . ">/dev/null 2&>1");
            }
            if (!empty($pkg['aftersaveredirect'])) {
                redirectHeader($pkg['aftersaveredirect']);
            } elseif (empty($pkg['adddeleteeditpagefields'])) {
                redirectHeader("services_upnp.php?id=0");
            } elseif (empty($pkg['preoutput'])) {
                redirectHeader("services_upnp.php");
            }
            exit;
        } else {
            $get_from_post = true;
        }
    } elseif (!$input_errors) {
        exit;
    }
}
include "head.inc";
?>

<body>

<?php 
Example #14
0
        $savemsg = get_std_save_message();
        clear_subsystem_dirty('sysctl');
    }
    if ($_POST['Submit'] == gettext("Save")) {
        $tunableent = array();
        $tunableent['tunable'] = $_POST['tunable'];
        $tunableent['value'] = $_POST['value'];
        $tunableent['descr'] = $_POST['descr'];
        if (isset($id) && $a_tunable[$id]) {
            $a_tunable[$id] = $tunableent;
        } else {
            $a_tunable[] = $tunableent;
        }
        mark_subsystem_dirty('sysctl');
        write_config();
        redirectHeader("system_advanced_sysctl.php");
        exit;
    }
}
$pgtitle = array(gettext('System'), gettext('Settings'), gettext('Tunables'));
include "head.inc";
?>

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


<!-- row -->
<section class="page-content-main">
Example #15
0
                $acl_entry['aclname'] = $pconfig['aclname'];
                $acl_entry['aclaction'] = $pconfig['aclaction'];
                $acl_entry['description'] = $pconfig['description'];
                $acl_entry['aclid'] = $pconfig['aclid'];
                $acl_entry['row'] = array();
                foreach ($networkacl as $acl) {
                    $acl_entry['row'][] = $acl;
                }
                if (isset($id) && $a_acls[$id]) {
                    $a_acls[$id] = $acl_entry;
                } else {
                    $a_acls[] = $acl_entry;
                }
                mark_subsystem_dirty("unbound");
                write_config();
                redirectHeader("/services_unbound_acls.php");
                exit;
            }
        }
    }
}
$closehead = false;
$pgtitle = "Services: DNS Resolver: Access Lists";
include "head.inc";
?>

<body>

<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
<script type="text/javascript" src="/javascript/row_helper.js"></script>
Example #16
0
            }
            parse_package_templates();
            /* if start_command is defined, restart w/ this */
            if ($pkg['start_command'] != "") {
                exec($pkg['start_command'] . ">/dev/null 2&>1");
            }
            /* if restart_command is defined, restart w/ this */
            if ($pkg['restart_command'] != "") {
                exec($pkg['restart_command'] . ">/dev/null 2&>1");
            }
            if ($pkg['aftersaveredirect'] != "") {
                redirectHeader($pkg['aftersaveredirect']);
            } elseif (!$pkg['adddeleteeditpagefields']) {
                redirectHeader("pkg_edit.php?xml={$xml}&amp;id=0");
            } elseif (!$pkg['preoutput']) {
                redirectHeader("pkg.php?xml=" . $xml);
            }
            exit;
        } else {
            $get_from_post = true;
        }
    } elseif (!$input_errors) {
        exit;
    }
}
if ($pkg['title'] != "") {
    $edit = $only_edit ? '' : ": " . gettext("Edit");
    $title = $pkg['title'] . $edit;
} else {
    $title = gettext("Package Editor");
}