Example #1
0
$group = new Form_Group('IPv6 Upstream gateway');
$group->add(new Form_Select('gatewayv6', 'IPv4 Upstream Gateway', $pconfig['gatewayv6'], build_gatewayv6_list()));
$group->add(new Form_Button('addgw6', 'Add a new gateway'))->removeClass('btn-primary')->setAttribute('data-target', '#newgateway6')->setAttribute('data-toggle', 'modal');
$group->setHelp('If this interface is an Internet connection, select an existing Gateway from the list or add a new one using the "Add" button.' . '<br />' . 'On local LANs the upstream gateway should be "none". ');
$section->add($group);
$form->add($section);
// Add new gateway modal pop-up for IPv6
$modal = new Modal('New IPv6 gateway', 'newgateway6', 'large');
$modal->addInput(new Form_Checkbox('defaultgw6', 'Default', 'Default gateway', $if == "wan" || $if == "WAN"));
$modal->addInput(new Form_Input('name6', 'Gateway name', 'text', $wancfg['descr'] . "GWv6"));
$modal->addInput(new Form_IpAddress('gatewayip6', 'Gateway IPv6', null));
$modal->addInput(new Form_Input('gatewaydescr6', 'Description', 'text'));
$btnaddgw6 = new Form_Button('add6', 'Add');
$btnaddgw6->removeClass('btn-primary')->addClass('btn-success');
$btncnxgw6 = new Form_Button('cnx6', 'Cancel');
$btncnxgw6->removeClass('btn-primary')->addClass('btn-default');
$modal->addInput(new Form_StaticText(null, $btnaddgw6 . $btncnxgw6));
$form->add($modal);
// ==== DHCP client configuration =============================
$section = new Form_Section('DHCP client configuration');
$section->addClass('dhcp');
$group = new Form_Group('Options');
$group->add(new Form_Checkbox('dhcpadv', null, 'Show DHCP advanced options', false));
$group->add(new Form_Checkbox('dhcpovr', null, 'Config file override', false));
$section->add($group);
$section->addInput(new Form_Input('dhcphostname', 'Hostname', 'text', $pconfig['dhcphostname']))->setHelp('The value in this field is sent as the DHCP client identifier and hostname when requesting a DHCP lease. Some ISPs may require this (for client identification).');
$section->addInput(new Form_IpAddress('alias-address', 'Alias IPv4 address', $pconfig['alias-address']))->addMask('alias-subnet', $pconfig['alias-subnet'], 32)->setHelp('The value in this field is used as a fixed alias IPv4 address by the DHCP client.');
$section->addInput(new Form_Input('dhcprejectfrom', 'Reject leases from', 'text', $pconfig['dhcprejectfrom']))->setHelp('If there is a certain upstream DHCP server that should be ignored, place the IP address or subnet of the DHCP server to be ignored here. ' . 'This is useful for rejecting leases from cable modems that offer private IPs when they lose upstream sync.');
$group = new Form_Group('Protocol timing');
$group->addClass('dhcpadvanced');
$group->add(new Form_Input('adv_dhcp_pt_timeout', null, 'number', $pconfig['adv_dhcp_pt_timeout']))->setHelp('Timeout');
Example #2
0
    $robtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
    $lbl .= ' ' . $robtn;
}
$section->addInput(new Form_StaticText('Read/Write status', $lbl))->setHelp('This setting is only temporary, and can be switched dynamically in the background.');
$section->addInput(new Form_Checkbox('nanobsd_force_rw', 'Permanent Read/Write', 'Keep media mounted read/write at all times. ', isset($config['system']['nanobsd_force_rw'])));
$permbtn = new Form_Button('setrw', 'Save');
$permbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText(null, $permbtn));
$section->addInput(new Form_Input('destslice', null, 'hidden', $COMPLETE_PATH));
$dupbtn = new Form_Button('duplicateslice', 'Duplicate ' . $COMPLETE_BOOT_PATH . ' -> ' . $TOFLASH);
$dupbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('Duplicate boot slice', $dupbtn))->setHelp('This will duplicate the bootup slice to the alternate slice.  Use this if you would like to duplicate the known good working boot partition to the alternate.');
$section->addInput(new Form_StaticText('RRD/DHCP Backup', 'These options have been relocated to the ' . '<a href="system_advanced_misc.php">' . 'System > Advanced, Miscellaneous</a> tab.'));
if (file_exists("/conf/upgrade_log.txt")) {
    $viewbtn = new Form_Button('viewupgradelog', 'View log');
    $viewbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
    $section->addInput(new Form_StaticText('View previous upgrade log', $viewbtn));
}
$form->add($section);
print $form;
if (file_exists("/conf/upgrade_log.txt") && $_POST['viewupgradelog']) {
    ?>
	<div class="panel panel-default">
		<div class="panel-heading"><h2 class="panel-title"><?php 
    echo gettext("Previous upgrade log");
    ?>
</h2></div>
			<!-- No white space between the <pre> and the first output or it will appear on the page! -->
			<pre><?php 
    echo str_ireplace("pfsense", $g['product_name'], file_get_contents("/conf/upgrade_log.txt"));
    ?>
Example #3
0
    $tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
}
$tab_array[] = array(gettext("Reset States"), false, "diag_resetstate.php");
display_top_tabs($tab_array);
// Start of tab content
$current_statecount = `pfctl -si | grep "current entries" | awk '{ print \$3 }'`;
require_once 'classes/Form.class.php';
$form = new Form(false);
$section = new Form_Section('State filter');
$section->addInput(new Form_Input('filter', 'Filter expression', 'text', $_POST['filter'], ['placeholder' => 'Simple filter such as 192.168, v6, icmp or ESTABLISHED']));
$filterbtn = new Form_Button('filterbtn', 'Filter', null);
$filterbtn->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('', $filterbtn));
if (isset($_POST['filter']) && (is_ipaddr($_POST['filter']) || is_subnet($_POST['filter']))) {
    $killbtn = new Form_Button('killfilter', 'Kill States');
    $killbtn->removeClass('btn-primary')->addClass('btn-danger btn-sm');
    $section->addInput(new Form_StaticText('Kill filtered states', $killbtn))->setHelp('Remove all states to and from the filtered address');
}
$form->add($section);
print $form;
?>
<table class="table table-striped">
	<thead>
		<tr>
			<th><?php 
echo gettext("Int");
?>
</th>
			<th><?php 
echo gettext("Proto");
?>
    $group->add(new Form_Select($type . 'endport', $name . ' port end', $pconfig[$type . 'endport'], $portValues))->setHelp('To');
    $group->add(new Form_Input($type . 'endport_cust', null, 'text', isset($portValues[$pconfig[$type . 'endport']]) ? null : $pconfig[$type . 'endport']))->setHelp('Custom');
    if ($type == 'src') {
        $group->setHelp('Specify the source port or port range for this rule. This is ' . 'usually random and almost never equal to the destination port range (and ' . 'should usually be <b>any</b>). You can leave the "To" field ' . 'empty if you only want to filter a single port.');
    } else {
        $group->setHelp('Specify the destination port or port range for this rule. ' . 'You can leave the "To" field empty if you only want to filter a ' . 'single port.');
    }
    $group->addClass($type == 'src' ? 'srcprtr' : 'dstprtr');
    $section->add($group);
    $form->add($section);
}
$section = new Form_Section('Extra options');
$section->addInput(new Form_Checkbox('log', 'Log', 'Log packets that are handled by this rule', $pconfig['log']))->setHelp('Hint: the firewall has limited local log space. Don\'t turn on logging ' . 'for everything. If you want to do a lot of logging, consider using a remote ' . 'syslog server (see the <a href="diag_logs_settings.php">Diagnostics: System logs: ' . 'Settings</a> page).');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference.');
$btnadvanced = new Form_Button('toggle-advanced', 'Advanced options');
$btnadvanced->removeClass('btn-primary')->addClass('btn-info');
$section->addInput(new Form_StaticText(null, $btnadvanced));
$form->add($section);
$section = new Form_Section('Advanced options');
$section->addClass('advanced-options');
$section->addInput(new Form_Select('os', 'Source OS', empty($pconfig['os']) ? '' : $pconfig['os'], ['' => 'Any'] + array_combine($ostypes, $ostypes)))->setHelp('Note: this only works for TCP rules. General OS choice matches all subtypes.');
$section->addInput(new Form_Select('dscp', 'Diffserv Code Point', $pconfig['dscp'], ["" => ''] + array_combine($firewall_rules_dscp_types, $firewall_rules_dscp_types)));
$section->addInput(new Form_Checkbox('allowopts', 'Allow IP options', 'Allow packets with IP options to pass. Otherwise they are blocked by ' . 'default. This is usually only seen with multicast traffic.', $pconfig['allowopts']));
$section->addInput(new Form_Checkbox('disablereplyto', 'Disable reply-to', 'Disable auto generated reply-to for this rule.', $pconfig['disablereplyto']));
$section->addInput(new Form_Input('tag', 'Tag', 'text', $pconfig['tag']))->setHelp('You can mark a packet matching this rule and use this mark to match ' . 'on other NAT/filter rules. It is called <b>Policy filtering</b>.');
$section->addInput(new Form_Input('tagged', 'Tagged', 'text', $pconfig['tagged']))->setHelp('You can match packet on a mark placed before on another rule.');
$section->addInput(new Form_Input('max', 'Max. states', 'number', $pconfig['max']))->setHelp('Maximum state entries this rule can create.');
$section->addInput(new Form_Input('max-src-nodes', 'Max. src nodes', 'number', $pconfig['max-src-nodes']))->setHelp('Maximum number of unique source hosts.');
$section->addInput(new Form_Input('max-src-conn', 'Max. connections', 'number', $pconfig['max-src-conn']))->setHelp('Maximum number of established connections per host (TCP only).');
$section->addInput(new Form_Input('max-src-states', 'Max. src. states', 'number', $pconfig['max-src-states']))->setHelp('Maximum state entries per host.');
$section->addInput(new Form_Input('max-src-conn-rate', 'Max. src. conn. Rate', 'number', $pconfig['max-src-conn-rate']))->setHelp('Maximum state entries per host');
Example #5
0
$section->addInput(new Form_IpAddress('ntp1', 'NTP Server 1', $pconfig['ntp1']));
$section->addInput(new Form_IpAddress('ntp2', 'NTP Server 2', $pconfig['ntp2']));
// Advanced TFTP
$btnadv = new Form_Button('btnadvtftp', 'Advanced');
$btnadv->removeClass('btn-primary')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('TFTP', $btnadv));
$section->addInput(new Form_IpAddress('tftp', 'TFTP Server', $pconfig['tftp']))->setHelp('Leave blank to disable.  Enter a full hostname or IP for the TFTP server')->setPattern('[.a-zA-Z0-9_]+');
// Advanced LDAP
$btnadv = new Form_Button('btnadvldap', 'Advanced');
$btnadv->removeClass('btn-primary')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('LDAP', $btnadv));
$section->addInput(new Form_Input('ldap', 'LDAP Server URI', 'text', $pconfig['ldap']))->setHelp('Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com ');
$form->add($section);
// Advanced Additional options
$btnadv = new Form_Button('btnadvopts', 'Advanced');
$btnadv->removeClass('btn-primary')->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText('Additional BOOTP/DHCP Options', $btnadv));
$section = new Form_Section('Additional BOOTP/DHCP Options');
$section->addClass('adnlopts');
$section->addInput(new Form_StaticText(null, '<div class="alert alert-info"> ' . gettext('Enter the DHCP option number and the value for each item you would like to include in the DHCP lease information.') . ' ' . sprintf(gettext('For a list of available options please visit this %1$s URL%2$s'), '<a href="http://www.iana.org/assignments/bootp-dhcp-parameters/" target="_blank">', '</a></div>')));
if (!$pconfig['numberoptions']) {
    $pconfig['numberoptions']['item'] = array(array('number' => '', 'type' => 'text', 'value' => ''));
}
$customitemtypes = array('text' => gettext('Text'), 'string' => gettext('String'), 'boolean' => gettext('Boolean'), 'unsigned integer 8' => gettext('Unsigned 8-bit integer'), 'unsigned integer 16' => gettext('Unsigned 16-bit integer'), 'unsigned integer 32' => gettext('Unsigned 32-bit integer'), 'signed integer 8' => gettext('Signed 8-bit integer'), 'signed integer 16' => gettext('Signed 16-bit integer'), 'signed integer 32' => gettext('Signed 32-bit integer'), 'ip-address' => gettext('IP address or host'));
$numrows = count($item) - 1;
$counter = 0;
$numrows = count($pconfig['numberoptions']['item']) - 1;
foreach ($pconfig['numberoptions']['item'] as $item) {
    $number = $item['number'];
    $itemtype = $item['type'];
    $value = base64_decode($item['value']);
$section = new Form_Section('Domain override options');
$section->addInput(new Form_Input('host', 'Host', 'text', $pconfig['host']))->setHelp('Name of the host, without the domain part' . '<br />' . 'e.g.: "myhost"');
$section->addInput(new Form_Input('domain', 'Domain', 'text', $pconfig['domain']))->setHelp('Domain of the host' . '<br />' . 'e.g.: "example.com"');
$section->addInput(new Form_IpAddress('ip', 'IP Address', $pconfig['ip']))->setHelp('IP address of the host' . '<br />' . 'e.g.: 192.168.100.100 or fd00:abcd::1');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed).');
if (isset($id) && $a_hosts[$id]) {
    $section->addInput(new Form_Input('id', null, 'hidden', $pconfig['id']));
}
$form->add($section);
$section = new Form_Section('Additional names for this host');
if ($pconfig['aliases']['item']) {
    $counter = 0;
    $last = count($pconfig['aliases']['item']) - 1;
    foreach ($pconfig['aliases']['item'] as $item) {
        $group = new Form_Group(null);
        $group->add(new Form_Input('aliashost' . $counter, null, 'text', $item['host']))->setHelp($counter == $last ? 'Host name' : null);
        $group->add(new Form_Input('aliasdomain' . $counter, null, 'text', $item['domain']))->setHelp($counter == $last ? 'Value' : null);
        $group->add(new Form_Input('aliasdescription' . $counter, null, 'text', $item['description']))->setHelp($counter == $last ? 'Description' : null);
        $btn = new Form_Button('btn' . $counter, 'Delete', 'services_dnsmasq_edit.php?act=delopt' . '&id=' . $counter);
        $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm');
        $group->add($btn);
        $section->add($group);
        $counter++;
    }
}
$btnaddopt = new Form_Button('btnaddopt', 'Add Option', 'services_dnsmasq_edit.php?act=addopt');
$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm');
$section->addInput($btnaddopt);
$form->add($section);
print $form;
include "foot.inc";
Example #7
0
        $wws = explode(":", $ww);
        $user = $wws[0];
        $passwd = base64_decode($wws[1]);
        $ip = $wws[2];
        $group = new Form_Group($counter == 0 ? 'User table' : null);
        $group->addClass('repeatable');
        $group->add(new Form_Input('username' . $counter, null, 'text', $user))->setHelp($numrows == $counter ? 'User name' : null);
        $group->add(new Form_Input('password' . $counter, null, 'password', $passwd))->setHelp($numrows == $counter ? 'Password' : null);
        $group->add(new Form_IpAddress('ip' . $counter, null, $ip))->setHelp($numrows == $counter ? 'IP Address' : null);
        $group->add(new Form_Button('deleterow' . $counter, 'Delete'))->removeClass('btn-primary')->addClass('btn-warning');
        $section->add($group);
        $counter++;
    }
}
$btnaddrow = new Form_Button('addrow', 'Add user');
$btnaddrow->removeClass('btn-primary')->addClass('btn-success');
$section->addInput(new Form_StaticText(null, '&nbsp;' . $btnaddrow));
// Hidden fields
if (isset($id)) {
    $section->addInput(new Form_Input('id', null, 'hidden', htmlspecialchars($id, ENT_QUOTES | ENT_HTML401)));
}
if (isset($pconfig['pppoeid'])) {
    $section->addInput(new Form_Input('pppoeid', null, 'hidden', $pconfig['pppoeid']));
}
$form->add($section);
print $form;
print_info_box(gettext('Don\'t forget to add a firewall rule to permit traffic from PPPoE clients'));
?>
<script type="text/javascript">
//<![CDATA[
events.push(function() {
Example #8
0
$tab_array = array();
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) {
    $tab_array[] = array(gettext("General"), $logfile == 'system', "/diag_logs.php");
    $tab_array[] = array(gettext("Gateways"), $logfile == 'gateways', "/diag_logs.php?logfile=gateways");
    $tab_array[] = array(gettext("Routing"), $logfile == 'routing', "/diag_logs.php?logfile=routing");
    $tab_array[] = array(gettext("Resolver"), $logfile == 'resolver', "/diag_logs.php?logfile=resolver");
    $tab_array[] = array(gettext("Wireless"), $logfile == 'wireless', "/diag_logs.php?logfile=wireless");
    display_top_tabs($tab_array, false, 'nav nav-tabs');
}
$form = new Form(false);
$section = new Form_Section('Log file filter');
$section->addInput(new Form_Input('filtertext', 'Filter', 'text', $filtertext, ['placeholder' => 'Filter text']));
$btnsubmit = new Form_Button('filtersubmit', 'Filter', null, 'fa-filter');
$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
$btnclear = new Form_Button('clear', 'Clear log', null, 'fa-trash');
$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
$section->addInput(new Form_StaticText('', $btnsubmit . $btnclear));
$form->add($section);
print $form;
if ($logfile == 'dhcpd') {
    print_info_box('Warning: Clearing the log file will restart the DHCP daemon.');
}
?>

<div class="panel panel-default">
	<div class="panel-heading"><h2 class="panel-title"><?php 
echo gettext("Last ");
echo $nentries;
?>
 <?php 
echo $logfile;
Example #9
0
function filter_form_vpn()
{
    global $filter_active, $rawfilter, $filterfieldsarray, $filtertext, $filterlogentries_qty, $nentries, $Include_Act, $interfacefilter;
    global $logfile;
    global $system_logs_filter_form_hidden;
    if ($filter_active) {
        $panel_state = 'in';
        $panel_body_state = SEC_OPEN;
    } else {
        if ($system_logs_filter_form_hidden) {
            $panel_state = 'out';
            $panel_body_state = SEC_OPEN;
        } else {
            $panel_state = 'in';
            $panel_body_state = SEC_CLOSED;
        }
    }
    if (!$rawfilter) {
        // Advanced log filter form
        $form = new Form(false);
        $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
        $section = new Form_Section('Advanced Log Filter', 'filter-panel', COLLAPSIBLE | $panel_body_state);
        if ($logfile == "vpn") {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_action', null, 'text', $filterfieldsarray['action']))->setWidth(3)->setHelp('Action');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_user', null, 'text', $filterfieldsarray['user']))->setWidth(3)->setHelp('User');
            $group->add(new Form_Input('filterlogentries_ip_address', null, 'text', $filterfieldsarray['ip_address']))->setWidth(4)->setHelp('IP Address');
        } else {
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_time', null, 'text', $filterfieldsarray['time']))->setWidth(3)->setHelp('Time');
            $group->add(new Form_Input('filterlogentries_type', null, 'text', $filterfieldsarray['type']))->setWidth(2)->setHelp('Type');
            $group->add(new Form_Input('filterlogentries_pid', null, 'text', $filterfieldsarray['pid']))->setWidth(2)->setHelp('PID');
            $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
            $section->add($group);
            $group = new Form_Group('');
            $group->add(new Form_Input('filterlogentries_message', null, 'text', $filterfieldsarray['message']))->setWidth(7)->setHelp('Log Message');
        }
        $btnsubmit = new Form_Button('filterlogentries_submit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
    } else {
        // Simple log filter form
        $form = new Form(false);
        $form->setAttribute('id', 'filter-form')->addClass('collapse ' . $panel_state);
        $section = new Form_Section('Log Filter', 'filter-panel', COLLAPSIBLE | $panel_body_state);
        $group = new Form_Group('');
        $group->add(new Form_Input('filtertext', null, 'text', $filtertext))->setWidth(6)->setHelp('Filter Expression');
        $group->add(new Form_Input('filterlogentries_qty', null, 'number', $filterlogentries_qty, ['placeholder' => $nentries]))->setWidth(2)->setHelp('Quantity');
        $btnsubmit = new Form_Button('filtersubmit', ' ' . gettext('Apply Filter'), null, 'fa-filter');
    }
    $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
    $group->add(new Form_StaticText('', $btnsubmit));
    $group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
    $section->add($group);
    $form->add($section);
    print $form;
}
    }
}
// Get the MAC address
$ip = $_SERVER['REMOTE_ADDR'];
$mymac = `/usr/sbin/arp -an | grep '('{$ip}')' | head -n 1 | cut -d" " -f4`;
$mymac = str_replace("\n", "", $mymac);
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
$form = new Form();
$section = new Form_Section('Edit MAC Address Rules');
$section->addInput(new Form_Select('action', 'Action', strtolower($pconfig['action']), array('pass' => gettext('Pass'), 'block' => gettext('Block'))))->setHelp('Choose what to do with packets coming from this MAC address.');
$macaddress = new Form_Input('mac', 'MAC Address', 'text', $pconfig['mac'], ['placeholder' => 'xx:xx:xx:xx:xx:xx']);
$btnmymac = new Form_Button('btnmymac', 'Copy My MAC');
$btnmymac->removeClass('btn-primary')->addClass('btn-success btn-sm');
$group = new Form_Group('MAC Address');
$group->add($macaddress);
$group->add($btnmymac);
$group->setHelp('6 hex octets separated by colons');
$section->add($group);
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference (not parsed)');
$section->addInput(new Form_Input('bw_up', 'Bandwidth up', 'text', $pconfig['bw_up']))->setHelp('Enter an upload limit to be enforced on this MAC in Kbit/s');
$section->addInput(new Form_Input('bw_down', 'Bandwidth down', 'text', $pconfig['bw_down']))->setHelp('Enter a download limit to be enforced on this MAC in Kbit/s');
$section->addInput(new Form_Input('zone', null, 'hidden', $cpzone));
if (isset($id) && $a_passthrumacs[$id]) {
    $section->addInput(new Form_Input('id', null, 'hidden', $id));
}
if (isset($pconfig['username']) && $pconfig['username']) {
    $section->addInput(new Form_Input('username', null, 'hidden', $pconfig['username']));
}
    if (empty($ous)) {
        print '<span class="text-danger">Could not connect to the LDAP server. Please check the LDAP configuration.</span>';
    } else {
        $modal = new Modal("Select LDAP containers for authentication", "containers", true);
        $group = new Form_MultiCheckboxGroup('Containers');
        if (is_array($ous)) {
            $idx = 0;
            foreach ($ous as $ou) {
                $group->add(new Form_MultiCheckbox('ou' . $idx, '', $ou, in_array($ou, $authcfg['ldap_authcn']), $ou));
                $idx++;
            }
        }
        $modal->add($group);
        // Create a "Save button"
        $btnsv = new Form_Button('svcontbtn', 'Save', null, 'fa-save');
        $btnsv->removeClass("btn-default)")->addClass("btn-primary");
        $modal->addInput(new Form_StaticText('', $btnsv));
        print $modal;
    }
    exit;
}
if (is_numericint($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_POST['id']) && is_numericint($_POST['id'])) {
    $id = $_POST['id'];
}
if (!is_array($config['system']['authserver'])) {
    $config['system']['authserver'] = array();
}
$a_servers = auth_get_authserver_list();
Example #12
0
$pgtitle = array(gettext("Diagnostics"), gettext("Reset state"));
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print_info_box($savemsg, 'alert-success');
}
$statetablehelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' . 'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' . 'firewall and/or NAT rules, especially if there are IP protocol mappings (e.g. for PPTP or IPv6) with open connections.' . '<br /><br />' . 'The firewall will normally leave the state tables intact when changing rules.' . '<br /><br />' . '<strong>NOTE:</strong> If you reset the firewall state table, the browser session may appear to be hung after clicking &quot;Reset&quot;. ' . 'Simply refresh the page to continue.';
$sourcetablehelp = 'Resetting the source tracking table will remove all source/destination associations. ' . 'This means that the \\"sticky\\" source/destination association ' . 'will be cleared for all clients.' . ' <br /><br />' . 'This does not clear active connection states, only source tracking.';
$tab_array = array();
$tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
if (isset($config['system']['lb_use_sticky'])) {
    $tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
}
$tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php");
display_top_tabs($tab_array);
$resetbtn = new Form_Button('Submit', 'Reset');
$resetbtn->removeClass('btn-primary')->addClass('btn-danger');
$form = new Form($resetbtn);
$section = new Form_Section('Select states to reset');
$section->addInput(new Form_Checkbox('statetable', 'State Table', 'Reset the firewall state table', true))->setHelp($statetablehelp);
if (isset($config['system']['lb_use_sticky'])) {
    $section->addInput(new Form_Checkbox('sourcetracking', 'Source Tracking', 'Reset firewall source tracking', true))->setHelp($sourcetablehelp);
}
$form->add($section);
print $form;
?>

<?php 
include "foot.inc";
Example #13
0
        $section->add($group);
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)));
        $section->addInput(new Form_StaticText('', $btntest));
        $form->add($section);
        print $form;
        // Logs
        $form = new Form(false);
        $btnview = new Form_Button('submit', 'View');
        $section = new Form_Section('View Logs');
        $section->addInput(new Form_Input('action', null, 'hidden', 'logs'));
        $group = new Form_Group('Log type');
        $group->add(new Form_Checkbox('type', null, 'Error', true, 'error'))->displayAsRadio();
        $group->add(new Form_Checkbox('type', null, 'Self-test', false, 'selftest'))->displayAsRadio();
        $section->add($group);
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)));
        $section->addInput(new Form_StaticText('', $btnview));
        $form->add($section);
        print $form;
        // Abort
        $btnabort = new Form_Button('submit', 'Abort');
        $btnabort->removeClass('btn-primary')->addClass('btn-danger');
        $form = new Form(false);
        $section = new Form_Section('Abort');
        $section->addInput(new Form_Input('action', null, 'hidden', 'abort'));
        $section->addInput(new Form_Select('device', 'Device: /dev/', false, array_combine($devs, $devs)));
        $section->addInput(new Form_StaticText('', $btnabort));
        $form->add($section);
        print $form;
        break;
}
include "foot.inc";
Example #14
0
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
    $interfaces['pppoe'] = "PPPoE Server";
}
/* add ipsec interfaces */
if (ipsec_enabled() && have_ruleint_access("enc0")) {
    $interfaces["enc0"] = "IPsec";
}
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
    $interfaces["openvpn"] = "OpenVPN";
}
$section->addInput(new Form_Select('interface', 'Interface', $pconfig['interface'], $interfaces))->setHelp('Choose which interface this rule applies to. In most cases "WAN" is specified.');
$protocols = "TCP UDP TCP/UDP ICMP ESP AH GRE IPV6 IGMP PIM OSPF";
$section->addInput(new Form_Select('proto', 'Protocol', $pconfig['proto'], array_combine(explode(" ", strtolower($protocols)), explode(" ", $protocols))))->setHelp('Choose which protocol this rule should match. In most cases "TCP" is specified.');
$btnsrcadv = new Form_Button('srcadv', 'Advanced');
$btnsrcadv->removeClass('btn-primary')->addClass('btn-default');
$section->addInput(new Form_StaticText('Source', $btnsrcadv));
$group = new Form_Group('Source');
$group->addClass('srcadv');
$group->add(new Form_Checkbox('srcnot', 'Source not', 'Invert match.', $pconfig['srcnot']))->setWidth(2);
$group->add(new Form_Select('srctype', null, srctype_selected(), build_srctype_list()))->setHelp('Type');
$group->add(new Form_IpAddress('src', null, is_specialnet($pconfig['src']) ? '' : $pconfig['src']))->setPattern('[.a-zA-Z0-9_]+')->addMask('srcmask', $pconfig['srcmask'])->setHelp('Address/mask');
$section->add($group);
$portlist = array("" => 'Other', 'any' => 'Any');
foreach ($wkports as $wkport => $wkportdesc) {
    $portlist[$wkport] = $wkportdesc;
}
$group = new Form_Group('Source port range');
$group->addClass('srcportrange');
$group->add(new Form_Select('srcbeginport', null, $pconfig['srcbeginport'], $portlist))->setHelp('From port');
$group->add(new Form_Input('srcbeginport_cust', null, 'text', $pconfig['srcbeginport'], ['min' => '1', 'max' => '65536']))->setHelp('Custom');
Example #15
0
$section->addInput(new Form_StaticText('Dynamic DNS', $btndyndns . '&nbsp;' . 'Show dynamic DNS settings'));
$section->addInput(new Form_Checkbox('ddnsupdate', 'DHCP Registration', 'Enable registration of DHCP client names in DNS.', $pconfig['ddnsupdate']));
$section->addInput(new Form_Input('ddnsdomain', 'DDNS Domain', 'text', $pconfig['ddnsdomain']))->setHelp('Leave blank to disable dynamic DNS registration. Enter the dynamic DNS domain which will be used to register client names in the DNS server.');
$section->addInput(new Form_IpAddress('ddnsdomainprimary', 'DDNS Server IP', $pconfig['ddnsdomainprimary']))->setHelp('Enter the primary domain name server IP address for the dynamic domain name.');
$section->addInput(new Form_Input('ddnsdomainkeyname', 'DDNS Domain Key name', 'text', $pconfig['ddnsdomainkeyname']))->setHelp('Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.');
$section->addInput(new Form_Input('ddnsdomainkey', 'DDNS Domain Key secret', 'text', $pconfig['ddnsdomainkey']))->setHelp('Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.');
$btnntp = new Form_Button('btnntp', 'Advanced');
$btnntp->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('NTP servers', $btnntp . '&nbsp;' . 'Show NTP Configuration'));
$group = new Form_Group('NTP Servers');
$group->add(new Form_Input('ntp1', 'NTP Server 1', 'text', $pconfig['ntp1'], ['placeholder' => 'NTP 1']));
$group->add(new Form_Input('ntp2', 'NTP Server 2', 'text', $pconfig['ntp2'], ['placeholder' => 'NTP 2']));
$group->addClass('ntpclass');
$section->add($group);
$btntftp = new Form_Button('btntftp', 'Advanced');
$btntftp->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('TFTP servers', $btntftp . '&nbsp;' . 'Show TFTP Configuration'));
$section->addInput(new Form_Input('tftp', 'TFTP Server', 'text', $pconfig['tftp']))->setHelp('Leave blank to disable. Enter a full hostname or IP for the TFTP server.');
$form->add($section);
print $form;
?>

<script type="text/javascript">
//<![CDATA[
events.push(function() {

	function hideDDNS(hide) {
		hideCheckbox('ddnsupdate', hide);
		hideInput('ddnsdomain', hide);
		hideInput('ddnsdomainprimary', hide);
		hideInput('ddnsdomainkeyname', hide);
    $group->add(new Form_Input($type . 'endport_cust', null, 'text', isset($portValues[$pconfig[$type . 'endport']]) ? null : $pconfig[$type . 'endport']))->setHelp('Custom');
    if ($type == 'src') {
        $group->setHelp('Specify the source port or port range for this rule. This is ' . 'usually random and almost never equal to the destination port range (and ' . 'should usually be <b>any</b>). You can leave the "To" field ' . 'empty if you only want to filter a single port.');
    } else {
        $group->setHelp('Specify the destination port or port range for this rule. ' . 'You can leave the "To" field empty if you only want to filter a ' . 'single port.');
    }
    $group->addClass($type == 'src' ? 'srcprtr' : 'dstprtr');
    $section->add($group);
    $form->add($section);
}
$section = new Form_Section('Extra options');
$section->addInput(new Form_Checkbox('log', 'Log', 'Log packets that are handled by this rule', $pconfig['log']))->setHelp('Hint: the firewall has limited local log space. Don\'t turn on logging ' . 'for everything. If you want to do a lot of logging, consider using a remote ' . 'syslog server (see the <a href="status_logs_settings.php">Status: System logs: ' . 'Settings</a> page).');
$section->addInput(new Form_Input('descr', 'Description', 'text', $pconfig['descr']))->setHelp('You may enter a description here for your reference.');
$adv_open = is_aoadv_used($pconfig);
$btnadvanced = new Form_Button('toggle-advanced', 'Advanced options');
$btnadvanced->removeClass('btn-primary')->addClass('btn-default');
if (!$adv_open) {
    $section->addInput(new Form_StaticText(null, $btnadvanced));
}
$form->add($section);
$section = new Form_Section('Advanced options');
$section->addClass('advanced-options');
$section->addInput(new Form_Select('os', 'Source OS', empty($pconfig['os']) ? '' : $pconfig['os'], ['' => gettext('Any')] + array_combine($ostypes, $ostypes)))->setHelp('Note: this only works for TCP rules. General OS choice matches all subtypes.');
$section->addInput(new Form_Select('dscp', 'Diffserv Code Point', $pconfig['dscp'], ["" => ''] + array_combine($firewall_rules_dscp_types, $firewall_rules_dscp_types)));
$section->addInput(new Form_Checkbox('allowopts', 'Allow IP options', 'Allow packets with IP options to pass. Otherwise they are blocked by ' . 'default. This is usually only seen with multicast traffic.', $pconfig['allowopts']));
$section->addInput(new Form_Checkbox('disablereplyto', 'Disable reply-to', 'Disable auto generated reply-to for this rule.', $pconfig['disablereplyto']));
$section->addInput(new Form_Input('tag', 'Tag', 'text', $pconfig['tag']))->setHelp('You can mark a packet matching this rule and use this mark to match ' . 'on other NAT/filter rules. It is called <b>Policy filtering</b>.');
$section->addInput(new Form_Input('tagged', 'Tagged', 'text', $pconfig['tagged']))->setHelp('You can match packet on a mark placed before on another rule.');
$section->addInput(new Form_Input('max', 'Max. states', 'number', $pconfig['max']))->setHelp('Maximum state entries this rule can create.');
$section->addInput(new Form_Input('max-src-nodes', 'Max. src nodes', 'number', $pconfig['max-src-nodes']))->setHelp('Maximum number of unique source hosts.');
$section->addInput(new Form_Input('max-src-conn', 'Max. connections', 'number', $pconfig['max-src-conn']))->setHelp('Maximum number of established connections per host (TCP only).');
Example #17
0
$form = new Form();
$section = new Form_Section('General DNS Resolver Options');
$section->addInput(new Form_Checkbox('enable', 'Enable', 'Enable DNS resolver', $pconfig['enable']));
$section->addInput(new Form_Input('port', 'Listen Port', 'number', $pconfig['port'], ['placeholder' => '53']))->setHelp('The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.');
$activeiflist = build_if_list($pconfig['active_interface']);
$section->addInput(new Form_Select('active_interface', 'Network Interfaces', $activeiflist['selected'], $activeiflist['options'], true))->addClass('general')->setHelp('Interface IPs used by the DNS Resolver for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. ' . 'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
$outiflist = build_if_list($pconfig['outgoing_interface']);
$section->addInput(new Form_Select('outgoing_interface', 'Outgoing Network Interfaces', $outiflist['selected'], $outiflist['options'], true))->addClass('general')->setHelp('Utilize different network interface(s) that the DNS Resolver will use to send queries to authoritative servers and receive their replies. By default all interfaces are used.');
$unbound_local_zone_types = array("deny" => gettext("Deny"), "refuse" => gettext("Refuse"), "static" => gettext("Static"), "transparent" => gettext("Transparent"), "typetransparent" => gettext("Type Transparent"), "redirect" => gettext("Redirect"), "inform" => gettext("Inform"), "inform_deny" => gettext("Inform Deny"), "nodefault" => gettext("No Default"));
$section->addInput(new Form_Select('system_domain_local_zone_type', 'System Domain Local Zone Type', $pconfig['system_domain_local_zone_type'], $unbound_local_zone_types))->setHelp('The local-zone type used for the pfSense system domain (System | General Setup | Domain).  Transparent is the default.  Local-Zone type descriptions are available in the unbound.conf(5) manual pages.');
$section->addInput(new Form_Checkbox('dnssec', 'DNSSEC', 'Enable DNSSEC Support', $pconfig['dnssec']));
$section->addInput(new Form_Checkbox('forwarding', 'DNS Query Forwarding', 'Enable Forwarding Mode', $pconfig['forwarding']));
$section->addInput(new Form_Checkbox('regdhcp', 'DHCP Registration', 'Register DHCP leases in the DNS Resolver', $pconfig['regdhcp']))->setHelp(sprintf('If this option is set, then machines that specify their hostname when requesting a DHCP lease will be registered' . ' in the DNS Resolver, so that their name can be resolved.' . ' You should also set the domain in %sSystem: General setup%s to the proper value.', '<a href="system.php">', '</a>'));
$section->addInput(new Form_Checkbox('regdhcpstatic', 'Static DHCP', 'Register DHCP static mappings in the DNS Resolver', $pconfig['regdhcpstatic']))->setHelp(sprintf('If this option is set, then DHCP static mappings will be registered in the DNS Resolver, so that their name can be ' . 'resolved. You should also set the domain in %s' . 'System: General setup%s to the proper value.', '<a href="system.php">', '</a>'));
$btnadvdns = new Form_Button('btnadvdns', 'Custom options');
$btnadvdns->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText('Custom options', $btnadvdns . '&nbsp;' . 'Show custom options'));
$section->addInput(new Form_Textarea('custom_options', 'Custom options', $pconfig['custom_options']))->setHelp('Enter any additional configuration parameters to add to the DNS Resolver configuration here, separated by a newline');
$form->add($section);
print $form;
?>

<script type="text/javascript">
//<![CDATA[
events.push(function() {

	// If the enable checkbox is not checked, hide all inputs
	function hideGeneral() {
		var hide = ! $('#enable').prop('checked');

		hideMultiClass('general', hide);
Example #18
0
$section->addInput(new Form_StaticText('Dynamic DNS', $btndyndns . '&nbsp;' . 'Show dynamic DNS settings'));
$section->addInput(new Form_Checkbox('ddnsupdate', 'DHCP Registration', 'Enable registration of DHCP client names in DNS.', $pconfig['ddnsupdate']));
$section->addInput(new Form_Input('ddnsdomain', 'DDNS Domain', 'text', $pconfig['ddnsdomain']))->setHelp('Leave blank to disable dynamic DNS registration. Enter the dynamic DNS domain which will be used to register client names in the DNS server.');
$section->addInput(new Form_IpAddress('ddnsdomainprimary', 'DDNS Server IP', $pconfig['ddnsdomainprimary']))->setHelp('Enter the primary domain name server IP address for the dynamic domain name.');
$section->addInput(new Form_Input('ddnsdomainkeyname', 'DDNS Domain Key name', 'text', $pconfig['ddnsdomainkeyname']))->setHelp('Enter the dynamic DNS domain key name which will be used to register client names in the DNS server.');
$section->addInput(new Form_Input('ddnsdomainkey', 'DDNS Domain Key secret', 'text', $pconfig['ddnsdomainkey']))->setHelp('Enter the dynamic DNS domain key secret which will be used to register client names in the DNS server.');
$btnntp = new Form_Button('btnntp', 'Advanced');
$btnntp->removeClass('btn-primary')->addClass('btn-success btn-sm');
$section->addInput(new Form_StaticText('NTP servers', $btnntp . '&nbsp;' . 'Show NTP Configuration'));
$group = new Form_Group('NTP Servers');
$group->add(new Form_Input('ntp1', 'NTP Server 1', 'text', $pconfig['ntp1'], ['placeholder' => 'NTP 1']));
$group->add(new Form_Input('ntp2', 'NTP Server 1', 'text', $pconfig['ntp2'], ['placeholder' => 'NTP 2']));
$group->addClass('ntpclass');
$section->add($group);
$btntftp = new Form_Button('btntftp', 'Advanced');
$btntftp->removeClass('btn-primary')->addClass('btn-success btn-sm');
$section->addInput(new Form_StaticText('TFTP servers', $btntftp . '&nbsp;' . 'Show TFTP Configuration'));
$section->addInput(new Form_Input('tftp', 'TFTP Server', 'text', $pconfig['tftp']))->setHelp('Leave blank to disable. Enter a full hostname or IP for the TFTP server.');
$form->add($section);
print $form;
?>

<script>
//<![CDATA[
events.push(function(){
	// Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden
	function hideInput(id, hide) {
		if(hide)
			$('#' + id).parent().parent('div').addClass('hidden');
		else
			$('#' + id).parent().parent('div').removeClass('hidden');