This commit is contained in:
Laurent Quillerou 2018-06-20 23:51:41 +02:00
commit 4a1de53ecb
24 changed files with 381 additions and 115 deletions

View File

@ -1014,7 +1014,7 @@ function ldap_test_bind($authcfg) {
$ldapbindpw = $authcfg['ldap_bindpw'];
$ldapver = $authcfg['ldap_protver'];
$ldaptimeout = is_numeric($authcfg['ldap_timeout']) ? $authcfg['ldap_timeout'] : 5;
if (empty($ldapbndun) || empty($ldapbindpw)) {
if (empty($ldapbindun) || empty($ldapbindpw)) {
$ldapanon = true;
} else {
$ldapanon = false;

View File

@ -1994,6 +1994,12 @@ function filter_nat_rules_generate() {
$natif = $FilterIflist[$natif]['descr'];
/* Do not form an invalid NPt rule.
* See https://redmine.pfsense.org/issues/8575 */
if (!is_subnetv6($srcaddr) || !is_subnetv6($dstaddr)) {
continue;
}
$natrules .= "binat on \${$natif} inet6 from {$srcaddr} to any -> {$dstaddr}\n";
$natrules .= "binat on \${$natif} inet6 from any to {$dstaddr} -> {$srcaddr}\n";
@ -3624,8 +3630,9 @@ EOD;
}
$gw = get_interface_gateway($ifdescr);
$routeto = (substr($ifcfg['if'], 0, 5) != "ipsec") ? "route-to ( {$ifcfg['if']} {$gw} )" : "";
if (is_ipaddrv4($gw) && is_ipaddrv4($ifcfg['ip']) && is_subnetv4("{$ifcfg['sa']}/{$ifcfg['sn']}")) {
$ipfrules .= "pass out {$log['pass']} route-to ( {$ifcfg['if']} {$gw} ) from {$ifcfg['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
$ipfrules .= "pass out {$log['pass']} {$routeto} from {$ifcfg['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
if (is_array($ifcfg['vips'])) {
foreach ($ifcfg['vips'] as $vip) {
if ($vip['mode'] == "proxyarp") {
@ -3635,9 +3642,9 @@ EOD;
continue;
}
if (ip_in_subnet($vip['ip'], "{$ifcfg['sa']}/{$ifcfg['sn']}")) {
$ipfrules .= "pass out {$log['pass']} route-to ( {$ifcfg['if']} {$gw} ) from {$vip['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
$ipfrules .= "pass out {$log['pass']} {$routeto} from {$vip['ip']} to !{$ifcfg['sa']}/{$ifcfg['sn']} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
} else {
$ipfrules .= "pass out {$log['pass']} route-to ( {$ifcfg['if']} {$gw} ) from {$vip['ip']} to !" . gen_subnet($vip['ip'], $vip['sn']) . "/{$vip['sn']} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
$ipfrules .= "pass out {$log['pass']} {$routeto} from {$vip['ip']} to !" . gen_subnet($vip['ip'], $vip['sn']) . "/{$vip['sn']} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
}
}
}
@ -3646,14 +3653,15 @@ EOD;
$gwv6 = get_interface_gateway_v6($ifdescr);
$stf = get_real_interface($ifdescr, "inet6");
$pdlen = 64 - calculate_ipv6_delegation_length($ifdescr);
$routeto = (substr($ifcfg['if'], 0, 5) != "ipsec") ? "route-to ( {$stf} {$gwv6} )" : "";
if (is_ipaddrv6($gwv6) && is_ipaddrv6($ifcfg['ipv6']) && is_subnetv6("{$ifcfg['ipv6']}/{$pdlen}")) {
$ipfrules .= "pass out {$log['pass']} route-to ( {$stf} {$gwv6} ) inet6 from {$ifcfg['ipv6']} to !{$ifcfg['ipv6']}/{$pdlen} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
$ipfrules .= "pass out {$log['pass']} {$routeto} inet6 from {$ifcfg['ipv6']} to !{$ifcfg['ipv6']}/{$pdlen} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
if (is_array($ifcfg['vips6'])) {
foreach ($ifcfg['vips6'] as $vip) {
if (!is_ipaddrv6($vip['ip']) || !is_subnetv6("{$vip['ip']}/{$pdlen}")) {
continue;
}
$ipfrules .= "pass out {$log['pass']} route-to ( {$stf} {$gwv6} ) inet6 from {$vip['ip']} to !{$vip['ip']}/{$pdlen} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
$ipfrules .= "pass out {$log['pass']} {$routeto} inet6 from {$vip['ip']} to !{$vip['ip']}/{$pdlen} tracker {$increment_tracker($tracker)} keep state allow-opts label \"let out anything from firewall host itself\"\n";
}
}
}

View File

@ -1339,10 +1339,9 @@ function interface_ipsec_vti_configure($ph1ent) {
file_put_contents("/tmp/{$ipsecif}_router{$gwtype}", $addr['right']);
}
}
}
if (!platform_booting()) {
system_routing_configure($ipsecif);
if (!platform_booting()) {
system_routing_configure(convert_real_interface_to_friendly_interface_name($ipsecif));
}
}
}

View File

@ -1118,7 +1118,7 @@ function reload_all_sync() {
send_event("service restart webgui");
}
function load_loader_conf($loader_conf = NULL) {
function load_loader_conf($loader_conf = NULL, $local = false) {
if ($loader_conf == NULL) {
return (NULL);
@ -1136,22 +1136,23 @@ function load_loader_conf($loader_conf = NULL) {
* managed by us.
*/
$data = array();
$ignore = array("autoboot_delay", "console", "comconsole_speed",
"boot_multicons", "boot_serial", "hw.usb.no_pf",
"hint.uart.0.flags", "hint.uart.1.flags", "hint.mdio.0.at",
"hint.e6000sw.0", "vm.pmap.pti");
/* These values should be removed from loader.conf and loader.conf.local
* As they will be replaced when necessary. */
$remove = array("hw.usb.no_pf", "hint.mdio.0.at", "hint.e6000sw.0",
"vm.pmap.pti");
if (!$local) {
/* These values should only be filtered in loader.conf, not .local */
$remove = array_merge($remove,
array("autoboot_delay", "console", "comconsole_speed",
"boot_multicons", "boot_serial", "hint.uart.0.flags",
"hint.uart.1.flags"));
}
foreach ($input_split as $line) {
if (empty($line)) {
continue;
}
$found = false;
foreach ($ignore as $ignstr) {
if (stripos($line, $ignstr) !== false) {
$found = true;
break;
}
}
if ($found === false) {
list($name, $value) = explode('=', $line, 2);
if (!in_array(trim($name), $remove)) {
$data[] = $line;
}
}
@ -1256,7 +1257,7 @@ function setup_loader_settings($path = "", $upgrade = false) {
/* Filter loader.conf.local to avoid duplicate settings. */
$loader_conf_file = "{$path}/boot/loader.conf.local";
$data = load_loader_conf($loader_conf_file);
$data = load_loader_conf($loader_conf_file, true);
if (empty($data)) {
@unlink($loader_conf_file);
} else {

View File

@ -116,8 +116,13 @@ function &get_reference_to_me_in_config(&$mypath) {
$ptr =& $config['shaper'];
foreach ($mypath as $indeks) {
$t_ptr = $ptr['queue'][$indeks];
$ptr =& $t_ptr;
if (!is_array($ptr['queue'])) {
$ptr['queue'] = array();
}
if (!is_array($ptr['queue'][$indeks])) {
$ptr['queue'][$indeks] = array();
}
$ptr =& $ptr['queue'][$indeks];
}
return $ptr;
@ -4515,9 +4520,9 @@ function read_altq_config() {
foreach ($a_int as $key => $conf) {
$int = $conf['interface'];
$__tmp_root = new altq_root_queue(); $root =& $__tmp_root;
$root = new altq_root_queue();
$root->SetInterface($int);
$altq_list_queues[$root->GetInterface()] = &$root;
$altq_list_queues[$root->GetInterface()] = $root;
$root->ReadConfig($conf);
array_push($path, $key);
$root->SetLink($path);

View File

@ -1444,12 +1444,12 @@ EOD;
$ipsecfin = "\nconn con-mobile\n";
}
else {
$ipsecfin = "\nconn con{$ph1ent['ikeid']}\n";
$ipsecfin = "\nconn con{$ph1ent['ikeid']}000\n";
}
//if (!empty($reqids[$idx])) {
// $ipsecfin .= "\treqid = " . $reqids[0] . "\n";
//}
if (!empty($vtireq[$idx])) {
if (!empty($vtireq)) {
$ipsecfin .= "\treqid = {$ph1ent['ikeid']}000\n";
}
$ipsecfin .= $ipsecconnect;

View File

@ -96,7 +96,7 @@ if (!empty($new_domain_name_servers)) {
}
}
if (count($valid_ns > 0)) {
if (count($valid_ns) > 0) {
file_put_contents("{$g['varetc_path']}/nameserver_v6{$interface}", implode("\n", $valid_ns));
}
}

View File

@ -195,12 +195,11 @@ if (is_array($config['dhcpd'][$argv[1]])) {
continue;
if ($data['act'] != "static") {
if (is_inrange_v4($data['ip'], $config['dhcpd'][$dhcpif]['range']['from'], $config['dhcpd'][$dhcpif]['range']['to'])) {
$result['active'] = $result['active'] + 1;
$result['active'] = intval($result['active']) + 1;
}
}
else {
if (is_inrange_v4(intval($data['ip']), $subnet_start, $subnet_end)) {
$result['static'] = $result['static'] + 1;
} else {
if (is_inrange_v4($data['ip'], $subnet_start, $subnet_end)) {
$result['static'] = intval($result['static']) + 1;
}
}
}

View File

@ -43,7 +43,7 @@ if (!is_array($config['nat']['rule'])) {
$a_nat = &$config['nat']['rule'];
/* update rule order, POST[rule] is an array of ordered IDs */
if (array_key_exists('order-store', $_REQUEST)) {
if (array_key_exists('order-store', $_REQUEST) && have_natpfruleint_access($natent['interface'])) {
if (is_array($_REQUEST['rule']) && !empty($_REQUEST['rule'])) {
$a_nat_new = array();
@ -78,7 +78,7 @@ if ($_REQUEST['savemsg']) {
$savemsg = $_REQUEST['savemsg'];
}
if ($_POST['apply']) {
if ($_POST['apply'] && have_natpfruleint_access($natent['interface'])) {
$retval = 0;
@ -93,7 +93,7 @@ if ($_POST['apply']) {
}
if ($_POST['act'] == "del") {
if (($_POST['act'] == "del") && have_natpfruleint_access($natent['interface'])) {
if ($a_nat[$_POST['id']]) {
if (isset($a_nat[$_POST['id']]['associated-rule-id'])) {
@ -121,7 +121,7 @@ if ($_POST['act'] == "del") {
}
}
if (isset($_POST['del_x'])) {
if (isset($_POST['del_x']) && have_natpfruleint_access($natent['interface'])) {
/* delete selected rules */
if (is_array($_POST['rule']) && count($_POST['rule'])) {
@ -154,7 +154,7 @@ if (isset($_POST['del_x'])) {
header("Location: firewall_nat.php");
exit;
}
} else if ($_POST['act'] == "toggle") {
} elseif (($_POST['act'] == "toggle") && have_natpfruleint_access($natent['interface'])) {
if ($a_nat[$_POST['id']]) {
if (isset($a_nat[$_POST['id']]['disabled'])) {
unset($a_nat[$_POST['id']]['disabled']);
@ -188,7 +188,7 @@ if ($_POST['apply']) {
print_apply_result_box($retval);
}
if (is_subsystem_dirty('natconf')) {
if (is_subsystem_dirty('natconf') && have_natpfruleint_access($natent['interface'])) {
print_apply_box(gettext('The NAT configuration has been changed.') . '<br />' .
gettext('The changes must be applied for them to take effect.'));
}
@ -268,11 +268,6 @@ foreach ($a_nat as $natent):
$localport
);
/* if user does not have access to edit an interface skip on to the next record */
if (!have_natpfruleint_access($natent['interface'])) {
continue;
}
if (isset($natent['disabled'])) {
$iconfn = "pass_d";
$trclass = 'class="disabled"';
@ -284,15 +279,19 @@ foreach ($a_nat as $natent):
<tr id="fr<?=$nnats;?>" <?=$trclass?> onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';">
<td >
<?php if (have_natpfruleint_access($natent['interface'])): ?>
<input type="checkbox" id="frc<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" name="rule[]" value="<?=$i;?>"/>
<?php endif; ?>
</td>
<td>
<?php if (have_natpfruleint_access($natent['interface'])): ?>
<a href="?act=toggle&amp;id=<?=$i?>" usepost>
<i class="fa fa-check" title="<?=gettext("click to toggle enabled/disabled status")?>"></i>
</a>
<?php endif; ?>
<?php if (isset($natent['nordr'])) { ?>
&nbsp;<i class="fa fa-hand-stop-o text-danger" title="<?=gettext("Negated: This rule excludes NAT from a later rule")?>"></i>
<?php } ?>
</a>
</td>
<td>
<?php
@ -434,9 +433,13 @@ foreach ($a_nat as $natent):
<?=htmlspecialchars($natent['descr'])?>
</td>
<td>
<?php if (have_natpfruleint_access($natent['interface'])): ?>
<a class="fa fa-pencil" title="<?=gettext("Edit rule"); ?>" href="firewall_nat_edit.php?id=<?=$i?>"></a>
<a class="fa fa-clone" title="<?=gettext("Add a new NAT based on this one")?>" href="firewall_nat_edit.php?dup=<?=$i?>"></a>
<a class="fa fa-trash" title="<?=gettext("Delete rule")?>" href="firewall_nat.php?act=del&amp;id=<?=$i?>" usepost></a>
<?php else: ?>
-
<?php endif; ?>
</td>
</tr>
<?php
@ -455,6 +458,7 @@ if ($seprows[$nnats]) {
</div>
</div>
<?php if (have_natpfruleint_access($natent['interface'])): ?>
<nav class="action-buttons">
<a href="firewall_nat_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the top of the list')?>">
<i class="fa fa-level-up icon-embed-btn"></i>
@ -477,6 +481,7 @@ if ($seprows[$nnats]) {
<?=gettext("Separator")?>
</button>
</nav>
<?php endif; ?>
</form>
<script type="text/javascript">

View File

@ -100,6 +100,13 @@ if ($_POST['save']) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (!is_ipaddrv6(trim($_POST['src']))) {
$input_errors[] = gettext("The specified source address is not a valid IPv6 prefix");
}
if (!is_ipaddrv6(trim($_POST['dst']))) {
$input_errors[] = gettext("The specified destination address is not a valid IPv6 prefix");
}
if (!$input_errors) {
$natent = array();

View File

@ -133,6 +133,9 @@ if ($_POST['act'] == "del") {
$subnet .= "/" . $a_vip[$_POST['id']]['subnet_bits'];
$if_subnet .= "/" . $if_subnet_bits;
/* Determine if this VIP is in the same subnet as any gateway
* which can only be reached by VIPs */
$viponlygws = array();
if (is_array($config['gateways']['gateway_item'])) {
foreach ($config['gateways']['gateway_item'] as $gateway) {
if ($a_vip[$_POST['id']]['interface'] != $gateway['interface']) {
@ -147,15 +150,36 @@ if ($_POST['act'] == "del") {
if (ip_in_subnet($gateway['gateway'], $if_subnet)) {
continue;
}
if (ip_in_subnet($gateway['gateway'], $subnet)) {
$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by at least one Gateway.");
break;
$viponlygws[] = $gateway;
}
}
}
/*
* If gateways for this subnet are only reachable via VIPs,
* make sure this is not the last VIP through which that gateway
* can be reached. See https://redmine.pfsense.org/issues/4438
*/
foreach ($viponlygws as $vgw) {
$numrefs = 0;
foreach ($a_vip as $refvip) {
if (($refvip['interface'] != $vgw['interface']) ||
(is_ipaddrv4($refvip['subnet']) && ($vgw['ipprotocol'] == 'inet6')) ||
(is_ipaddrv6($refvip['subnet']) && ($vgw['ipprotocol'] == 'inet'))) {
continue;
}
if (ip_in_subnet($vgw['gateway'],
gen_subnet($refvip['subnet'], $refvip['subnet_bits']) . '/' . $refvip['subnet_bits'])) {
$numrefs++;
}
}
if ($numrefs <= 1) {
$input_errors[] = sprintf(gettext("This entry cannot be deleted because it is required to reach Gateway: %s."), $vgw['name']);
break;
}
}
if ($a_vip[$_POST['id']]['mode'] == "ipalias") {
$subnet = gen_subnet($a_vip[$_POST['id']]['subnet'], $a_vip[$_POST['id']]['subnet_bits']) . "/" . $a_vip[$_POST['id']]['subnet_bits'];
$found_if = false;

View File

@ -63,7 +63,7 @@ $pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone][
$pglinks = array("", "services_captiveportal_zones.php", "services_captiveportal.php?zone=" . $cpzone, "@self");
$shortcut_section = "captiveportal";
if ($_POST['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
if ($_POST['act'] == "del" && !empty($cpzone)) {
$a_allowedhostnames =& $a_cp[$cpzone]['allowedhostname'];
if ($a_allowedhostnames[$_POST['id']]) {
$ipent = $a_allowedhostnames[$_POST['id']];

View File

@ -60,7 +60,7 @@ $pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone][
$pglinks = array("", "services_captiveportal_zones.php", "services_captiveportal.php?zone=" . $cpzone, "@self");
$shortcut_section = "captiveportal";
if ($_POST['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
if ($_POST['act'] == "del" && !empty($cpzone)) {
$a_allowedips =& $config['captiveportal'][$cpzone]['allowedip'];
if ($a_allowedips[$_POST['id']]) {

View File

@ -123,7 +123,7 @@ if ($_POST['save']) {
}
if (!$input_errors) {
if (strtolower($pconfig['save']) == gettext("save")) {
if (strtolower($pconfig['save']) == strtolower(gettext("save"))) {
$acl_entry = array();
$acl_entry['aclid'] = $pconfig['aclid'];
$acl_entry['aclname'] = $pconfig['aclname'];
@ -152,12 +152,12 @@ if ($_POST['save']) {
}
$actionHelp =
sprintf(gettext('%1$sDeny:%2$s Stops queries from hosts within the netblock defined below.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sRefuse:%2$s Stops queries from hosts within the netblock defined below, but sends a DNS rcode REFUSED error message back to the client.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sAllow:%2$s Allow queries from hosts within the netblock defined below.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sAllow Snoop:%2$s Allow recursive and nonrecursive access from hosts within the netblock defined below. Used for cache snooping and ideally should only be configured for the administrative host.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sDeny Nonlocal:%2$s Allow only authoritative local-data queries from hosts within the netblock defined below. Messages that are disallowed are dropped.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sRefuse Nonlocal:%2$s Allow only authoritative local-data queries from hosts within the netblock defined below. Sends a DNS rcode REFUSED error message back to the client for messages that are disallowed.'), '<span class="text-success"><strong>', '</strong></span>');
sprintf(gettext('%1$sDeny:%2$s Stops queries from hosts within the netblock defined below.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sRefuse:%2$s Stops queries from hosts within the netblock defined below, but sends a DNS rcode REFUSED error message back to the client.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sAllow:%2$s Allow queries from hosts within the netblock defined below.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sAllow Snoop:%2$s Allow recursive and nonrecursive access from hosts within the netblock defined below. Used for cache snooping and ideally should only be configured for the administrative host.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sDeny Nonlocal:%2$s Allow only authoritative local-data queries from hosts within the netblock defined below. Messages that are disallowed are dropped.%3$s'), '<span class="text-success"><strong>', '</strong></span>', '<br />') .
sprintf(gettext('%1$sRefuse Nonlocal:%2$s Allow only authoritative local-data queries from hosts within the netblock defined below. Sends a DNS rcode REFUSED error message back to the client for messages that are disallowed.'), '<span class="text-success"><strong>', '</strong></span>');
$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("Access Lists"));
$pglinks = array("", "services_unbound.php", "@self");

View File

@ -0,0 +1,188 @@
<?php
/*
* autoconfigbackup_settings.php
*
* part of pfSense (https://www.pfsense.org)
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
* All rights reserved.
*
* originally based on m0n0wall (http://m0n0.ch/wall)
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
##|+PRIV
##|*IDENT=page-system-autoconfigbackup
##|*NAME=System: Auto COnfig Backup
##|*DESCR=Configure the auto config backup system.
##|*MATCH=autoconfigbackup-settings.php*
##|-PRIV
require_once("guiconfig.inc");
require_once("functions.inc");
$pconfig = $config['system']['acb'];
if (isset($_POST['save'])) {
unset($input_errors);
$pconfig = $_POST;
/* input validation */
$reqdfields = explode(" ", "encryption_password");
$reqdfieldsn = array(gettext("Encryption password"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (strlen($_POST['encryption_password']) < 8) {
$input_errors[] = gettext("The encryption password must contain at least 8 characters");
}
if (($pconfig['legacy'] == 'yes') && (strlen($_POST['gold_password']) < 8)) {
$input_errors[] = gettext("The legacy Gold password must contain at least 8 characters");
}
$update_ep = false;
if ($_POST['encryption_password'] != "********") {
if ($_POST['encryption_password'] != $_POST['encryption_password_confirm']) {
$input_errors[] = gettext("Encryption password and confirmation do not match");
} else {
$update_ep = true;
}
}
$update_gp = false;
if ($pconfig['legacy'] == 'yes') {
if ($_POST['gold_password'] != "********") {
if ($_POST['gold_password'] != $_POST['gold_password_confirm']) {
$input_errors[] = gettext("Legacy Gold password and confirmation do not match");
} else {
$update_gp = true;
}
}
if (strlen($_POST['gold_username']) == 0) {
$input_errors[] = gettext("Legacy Gold username may not be blank");
}
}
if (!$input_errors) {
if($update_ep) {
$config['system']['acb']['encryption_password'] = $pconfig['encryption_password'];
}
$config['system']['acb']['acb_enable'] = $pconfig['acb_enable'];
if($update_gp) {
$config['system']['acb']['gold_password'] = $pconfig['gold_password'];
}
$config['system']['acb']['gold_username'] = $pconfig['gold_username'];
write_config("AutoCcnfigBackup settings updated");
}
}
$pgtitle = array(gettext("System"), gettext("Auto Config Backup"), gettext("Settings"));
include("head.inc");
if ($input_errors) {
print_input_errors($input_errors);
}
$form = new Form;
$section = new Form_Section('Auto Config Backup');
$section->addInput(new Form_Input(
'legacy',
'',
"hidden",
$pconfig['legacy']
));
$section->addInput(new Form_Checkbox(
'acb_enable',
'Enable ACB',
'Enable automatic configuration backups',
($pconfig['acb_enable'] == "yes")
));
$section->addPassword(new Form_Input(
'encryption_password',
'*Encryption Password',
'password',
$pconfig['encryption_password']
));
$form->add($section);
$section = new Form_Section('Legacy "Gold" settings', 'legacy_panel');
$section->addInput(new Form_Input(
'gold_username',
'*Username',
'text',
$pconfig['gold_username']
));
$section->addPassword(new Form_Input(
'gold_password',
'*Password',
'password',
$pconfig['gold_password']
));
$form->add($section);
$form->addGlobal(new Form_Button(
'btnlegacy',
'Legacy "Gold" settings',
null,
null
))->removeClass('btn-primary')->addClass('btn-success btn-xs pull-right');
print $form;
?>
</div>
<script type="text/javascript">
//<![CDATA[
events.push(function() {
$('#btnlegacy').prop('type', 'button');
// Hide the legacy settings
if ($('#legacy').val() != 'yes') {
$('#legacy_panel').addClass('hidden');
}
$('#btnlegacy').click(function() {
if ($('#legacy').val() != "yes") {
$('#legacy_panel').removeClass('hidden');
$('#legacy').val('yes');
} else {
$('#legacy_panel').addClass('hidden');
$('#legacy').val('no');
}
});
});
//]]>
</script>
<?php
include("foot.inc");
?>

View File

@ -36,6 +36,9 @@
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
$logging_level = LOG_WARNING;
$logging_prefix = gettext("Local User Database");
if (!is_array($config['system']['group'])) {
$config['system']['group'] = array();
}
@ -72,8 +75,10 @@ if ($_POST['act'] == "delgroup") {
unset($a_group[$id]);
/* Reindex the array to avoid operating on an incorrect index https://redmine.pfsense.org/issues/7733 */
$a_group = array_values($a_group);
write_config();
$savemsg = sprintf(gettext("Group %s successfully deleted."), $groupdeleted);
$savemsg = sprintf(gettext("Successfully deleted group: %s"), $groupdeleted);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
}
if ($_POST['act'] == "delpriv") {
@ -95,9 +100,11 @@ if ($_POST['act'] == "delpriv") {
}
}
write_config();
$savemsg = sprintf(gettext("Removed Privilege \"%s\" from group %s"), $privdeleted, $a_group[$id]['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
$act = "edit";
$savemsg = sprintf(gettext("Privilege %s successfully deleted."), $privdeleted);
}
if ($act == "edit") {
@ -114,18 +121,22 @@ if ($act == "edit") {
if (isset($_POST['dellall_x'])) {
$del_groups = $_POST['delete_check'];
$deleted_groups = array();
if (!empty($del_groups)) {
foreach ($del_groups as $groupid) {
if (isset($a_group[$groupid]) && $a_group[$groupid]['scope'] != "system") {
$deleted_groups[] = $a_group[$groupid]['name'];
local_group_del($a_group[$groupid]);
unset($a_group[$groupid]);
}
}
$savemsg = sprintf(gettext("Successfully deleted %s: %s"), (count($deleted_groups) == 1) ? gettext("group") : gettext("groups"), implode(', ', $deleted_groups));
/* Reindex the array to avoid operating on an incorrect index https://redmine.pfsense.org/issues/7733 */
$a_group = array_values($a_group);
$savemsg = gettext("Selected groups removed successfully.");
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
}
}
@ -214,7 +225,9 @@ if (isset($_POST['save'])) {
return strcmp($a['name'], $b['name']);
});
write_config();
$savemsg = sprintf(gettext("Successfully %s group %s"), (strlen($id) > 0) ? gettext("edited") : gettext("created"), $group['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
header("Location: system_groupmanager.php");
exit;

View File

@ -35,6 +35,9 @@
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
$logging_level = LOG_WARNING;
$logging_prefix = gettext("Local User Database");
$groupid = $_REQUEST['groupid'];
$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Groups"), gettext("Edit"), gettext("Add Privileges"));
@ -87,7 +90,9 @@ if ($_POST['save']) {
}
}
write_config();
$savemsg = sprintf(gettext("Privileges changed for group: %s"), $a_group['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
pfSenseHeader("system_groupmanager.php?act=edit&groupid={$groupid}");
exit;

View File

@ -37,6 +37,9 @@ require_once("certs.inc");
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
$logging_level = LOG_WARNING;
$logging_prefix = gettext("Local User Database");
// start admin user code
if (isset($_REQUEST['userid']) && is_numericint($_REQUEST['userid'])) {
$id = $_REQUEST['userid'];
@ -96,8 +99,9 @@ if ($_POST['act'] == "deluser") {
unset($a_user[$id]);
/* Reindex the array to avoid operating on an incorrect index https://redmine.pfsense.org/issues/7733 */
$a_user = array_values($a_user);
write_config();
$savemsg = sprintf(gettext("User %s successfully deleted."), $userdeleted);
$savemsg = sprintf(gettext("Successfully deleted user: %s"), $userdeleted);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
}
} else if ($act == "new") {
@ -125,9 +129,7 @@ if ($_POST['act'] == "deluser") {
if (isset($_POST['dellall'])) {
$del_users = $_POST['delete_check'];
$deleted_users = "";
$deleted_count = 0;
$comma = "";
$deleted_users = array();
if (!empty($del_users)) {
foreach ($del_users as $userid) {
@ -135,9 +137,7 @@ if (isset($_POST['dellall'])) {
if ($a_user[$userid]['name'] == $_SESSION['Username']) {
$delete_errors[] = sprintf(gettext("Cannot delete user %s because you are currently logged in as that user."), $a_user[$userid]['name']);
} else {
$deleted_users = $deleted_users . $comma . $a_user[$userid]['name'];
$comma = ", ";
$deleted_count++;
$deleted_users[] = $a_user[$userid]['name'];
local_user_del($a_user[$userid]);
unset($a_user[$userid]);
}
@ -146,15 +146,12 @@ if (isset($_POST['dellall'])) {
}
}
if ($deleted_count > 0) {
if ($deleted_count == 1) {
$savemsg = sprintf(gettext("User %s successfully deleted."), $deleted_users);
} else {
$savemsg = sprintf(gettext("Users %s successfully deleted."), $deleted_users);
}
if (count($deleted_users) > 0) {
$savemsg = sprintf(gettext("Successfully deleted %s: %s"), (count($deleted_users) == 1) ? gettext("user") : gettext("users"), implode(', ', $deleted_users));
/* Reindex the array to avoid operating on an incorrect index https://redmine.pfsense.org/issues/7733 */
$a_user = array_values($a_user);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
}
}
}
@ -169,18 +166,20 @@ if ($_POST['act'] == "delcert") {
$certdeleted = lookup_cert($a_user[$id]['cert'][$_POST['certid']]);
$certdeleted = $certdeleted['descr'];
unset($a_user[$id]['cert'][$_POST['certid']]);
write_config();
$savemsg = sprintf(gettext("Removed certificate association \"%s\" from user %s"), $certdeleted, $a_user[$id]['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
$_POST['act'] = "edit";
$savemsg = sprintf(gettext("Certificate %s association removed."), $certdeleted);
}
if ($_POST['act'] == "delprivid") {
$privdeleted = $priv_list[$a_user[$id]['priv'][$_POST['privid']]]['name'];
unset($a_user[$id]['priv'][$_POST['privid']]);
local_user_set($a_user[$id]);
write_config();
$savemsg = sprintf(gettext("Removed Privilege \"%s\" from user %s"), $privdeleted, $a_user[$id]['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
$_POST['act'] = "edit";
$savemsg = sprintf(gettext("Privilege %s removed."), $privdeleted);
}
if ($_POST['save']) {
@ -454,8 +453,9 @@ if ($_POST['save']) {
local_user_set($userent);
/* Add user to groups again to ensure they are set everywhere, otherwise the user may not appear to be a member of the group. See commit:5372d26d9d25d751d16865ed9d46869d3b0ec5e1. */
local_user_set_groups($userent, $_POST['groups']);
write_config();
$savemsg = sprintf(gettext("Successfully %s user %s"), (isset($id)) ? gettext("edited") : gettext("created"), $userent['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
if (is_dir("/etc/inc/privhooks")) {
run_plugins("/etc/inc/privhooks");
}

View File

@ -31,6 +31,9 @@
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
$logging_level = LOG_WARNING;
$logging_prefix = gettext("Local User Database");
if (isset($_REQUEST['userid']) && is_numericint($_REQUEST['userid'])) {
$userid = $_REQUEST['userid'];
}
@ -77,7 +80,10 @@ if ($_POST['save']) {
$a_user['priv'] = sort_user_privs($a_user['priv']);
local_user_set($a_user);
write_config();
$savemsg = sprintf(gettext("Privileges changed for user: %s"), $a_user['name']);
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
post_redirect("system_usermanager.php", array('act' => 'edit', 'userid' => $userid));

View File

@ -30,6 +30,9 @@ require_once("auth.inc");
require_once("certs.inc");
require_once("guiconfig.inc");
$logging_level = LOG_WARNING;
$logging_prefix = gettext("Local User Database");
$pgtitle = array(gettext("System"), gettext("User Password"));
if (isset($_POST['save'])) {
@ -51,12 +54,12 @@ if (isset($_POST['save'])) {
$userent =& $config['system']['user'][$userindex[$_SESSION['Username']]];
local_user_set_password($userent, $_POST['passwordfld1']);
local_user_set($userent);
$savemsg = sprintf(gettext("Password changed for user: %s"), $userent['name']);
unset($userent);
phpsession_end(true);
write_config();
$savemsg = gettext("Password successfully changed.");
write_config($savemsg);
syslog($logging_level, "{$logging_prefix}: {$savemsg}");
}
}

View File

@ -72,7 +72,7 @@ if ($_REQUEST && $_REQUEST['ajax']) {
continue;
}
$ikeid = "con{$ph1ent['ikeid']}";
$ikeid = "con{$ph1ent['ikeid']}000";
$ikenum[$ph1ent['ikeid']] = true;
}

View File

@ -795,10 +795,19 @@
</stepbeforeformdisplay>
<description>
<![CDATA[
<p>Congratulations! pfSense is now configured.</p>
Remember, we're here to help.</p><p>
Click <a target='_blank' href='https://www.netgate.com/more-support-info/'>here</a> to learn about Netgate 24/7/365 support.</p><p>
Click <a href='$myurl'>here</a> to continue on to pfSense webConfigurator.</p>
<div style="padding-right:25px;">
<p><h4>Congratulations! pfSense is now configured.</h4></p>
<p>
We recommend that you check to see if there are any software updates available. Keeping your software up to date is
one of the most important things you can do to maintain the security of your network.</p>
<input type="button" onclick="window.location.href='$myurlpkg_mgr_install.php?id=firmware'" class="btn btn-xs btn-success" value="Check for updates"/>
<p></p>
<p><h4>Remember, we're here to help.</h4></p>
<p>
<a target='_blank' href='https://www.netgate.com/more-support-info/'><strong><span style="font-size:16px"> Click here</span></strong></a> to learn about Netgate 24/7/365 support services.</p><p>
<input type="button" onclick="window.location.href='$myurl'" class="btn btn-sm btn-success" value="Finish"/>
</p>
</div>
]]>
</description>
</step>

View File

@ -920,12 +920,9 @@ create_memstick_serial_image() {
create_distribution_tarball
FSLABEL=$(echo ${PRODUCT_NAME} | tr '[:lower:]' '[:upper:]')
sh ${FREEBSD_SRC_DIR}/release/${TARGET}/mkisoimages.sh -b \
${FSLABEL} \
${MEMSTICKSERIALPATH} \
${INSTALLER_CHROOT_DIR}
sh ${FREEBSD_SRC_DIR}/release/${TARGET}/make-memstick.sh \
${INSTALLER_CHROOT_DIR} \
${MEMSTICKSERIALPATH}
if [ ! -f "${MEMSTICKSERIALPATH}" ]; then
echo "ERROR! memstick serial image was not built"
@ -973,12 +970,9 @@ create_memstick_adi_image() {
create_distribution_tarball
FSLABEL=$(echo ${PRODUCT_NAME} | tr '[:lower:]' '[:upper:]')
sh ${FREEBSD_SRC_DIR}/release/${TARGET}/mkisoimages.sh -b \
${FSLABEL} \
${MEMSTICKADIPATH} \
${INSTALLER_CHROOT_DIR}
sh ${FREEBSD_SRC_DIR}/release/${TARGET}/make-memstick.sh \
${INSTALLER_CHROOT_DIR} \
${MEMSTICKADIPATH}
if [ ! -f "${MEMSTICKADIPATH}" ]; then
echo "ERROR! memstick ADI image was not built"

View File

@ -203,8 +203,6 @@ if [ -z "${BUILTDATESTRING}" ]; then
fi
echo "$BUILTDATESTRING" > $BUILTDATESTRINGFILE
STAGING_HOSTNAME=${STAGING_HOSTNAME:-"release-staging.netgate.com"}
# Poudriere
export ZFS_TANK=${ZFS_TANK:-"zroot"}
export ZFS_ROOT=${ZFS_ROOT:-"/poudriere"}
@ -260,11 +258,13 @@ export BUILDER_PKG_DEPENDENCIES="devel/git ftp/curl net/rsync sysutils/screen \
emulators/qemu-user-static security/sssd security/pam_ldap \
security/pam_mkhomedir archivers/gtar textproc/xmlstarlet"
STAGING_HOSTNAME=${STAGING_HOSTNAME:-"release-staging.nyi.netgate.com"}
# Host to rsync pkg repos from poudriere
export PKG_RSYNC_HOSTNAME=${PKG_RSYNC_HOSTNAME:-${STAGING_HOSTNAME}}
export PKG_RSYNC_HOSTNAME=${PKG_RSYNC_HOSTNAME:-"nfs1.nyi.netgate.com"}
export PKG_RSYNC_USERNAME=${PKG_RSYNC_USERNAME:-"wwwsync"}
export PKG_RSYNC_SSH_PORT=${PKG_RSYNC_SSH_PORT:-"22"}
export PKG_RSYNC_DESTDIR=${PKG_RSYNC_DESTDIR:-"/staging/ce/packages"}
export PKG_RSYNC_DESTDIR=${PKG_RSYNC_DESTDIR:-"/storage/files/release-staging/ce/packages"}
# Final packages server
if [ -n "${_IS_RELEASE}" -o -n "${_IS_RC}" ]; then
@ -340,9 +340,9 @@ export VARIANTUPDATES=""
# Rsync data to send snapshots
if [ -n "${_IS_RELEASE}" -o -n "${SKIP_FINAL_RSYNC}" ]; then
export RSYNCIP=${RSYNCIP:-"release-staging.netgate.com"}
export RSYNCIP=${RSYNCIP:-"nfs1.nyi.netgate.com"}
export RSYNCUSER=${RSYNCUSER:-"wwwsync"}
export RSYNCPATH=${RSYNCPATH:-"/staging/ce/images"}
export RSYNCPATH=${RSYNCPATH:-"/storage/files/release-staging/ce/images"}
else
export RSYNCIP=${RSYNCIP:-"nfs1.nyi.netgate.com"}
export RSYNCUSER=${RSYNCUSER:-"wwwsync"}