mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Merge remote-tracking branch 'mainline/master' into inc
Conflicts: etc/inc/interfaces.inc etc/inc/priv.defs.inc etc/inc/shaper.inc etc/inc/system.inc
This commit is contained in:
commit
152ab4d0c0
@ -684,7 +684,7 @@ EOD;
|
||||
if ($reinit == false)
|
||||
unlock($captiveportallck);
|
||||
|
||||
/* filter on layer2 as well so we can check MAC addresses */
|
||||
/* activate ipfw(4) so CP can work */
|
||||
mwexec("/sbin/sysctl net.link.ether.ipfw=1");
|
||||
|
||||
return $cprules;
|
||||
@ -881,6 +881,17 @@ function captiveportal_disconnect($dbent, $radiusservers,$term_cause = 1,$stop_t
|
||||
|
||||
/* Release the ruleno so it can be reallocated to new clients. */
|
||||
captiveportal_free_ipfw_ruleno($dbent[1]);
|
||||
|
||||
// XMLRPC Call over to the master Voucher node
|
||||
$a_voucher = &$config['voucher'];
|
||||
if(!empty($a_voucher['vouchersyncdbip'])) {
|
||||
$syncip = $a_voucher['vouchersyncdbip'];
|
||||
$syncport = $a_voucher['vouchersyncport'];
|
||||
$syncpass = $a_voucher['vouchersyncpass'];
|
||||
$vouchersyncusername = $a_voucher['vouchersyncusername'];
|
||||
$remote_status = xmlrpc_sync_voucher_disconnect($dben, $syncip, $syncport, $syncpass, $vouchersyncusername, $term_cause, $stop_time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* remove a single client by sessionid */
|
||||
@ -1378,7 +1389,7 @@ function captiveportal_get_next_ipfw_ruleno($rulenos_start = 2000, $rulenos_rang
|
||||
* and the out pipe ruleno + 1. This removes limitation that where present in
|
||||
* previous version of the peruserbw.
|
||||
*/
|
||||
if (isset($config['captiveportal']['peruserbw']))
|
||||
if (isset($config['captiveportal']['peruserbw']) || $usebw == true)
|
||||
$ridx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -190,10 +190,10 @@ EOD;
|
||||
|
||||
echo <<<EOD
|
||||
|
||||
*NOTE* {$g['product_name']} requires {$g['minimum_nic_count_text']} assigned interfaces to function.
|
||||
*NOTE* {$g['product_name']} requires {$g['minimum_nic_count_text']} assigned interface(s) to function.
|
||||
If you do not have {$g['minimum_nic_count_text']} interfaces you CANNOT continue.
|
||||
|
||||
If you do not have at least {$g['minimum_nic_count']} *REAL* network interface cards
|
||||
If you do not have at least {$g['minimum_nic_count']} *REAL* network interface card(s)
|
||||
or one interface with multiple VLANs then {$g['product_name']}
|
||||
*WILL NOT* function correctly.
|
||||
|
||||
|
||||
@ -301,13 +301,16 @@ EOD;
|
||||
* null
|
||||
******/
|
||||
/* mount flash card read/write */
|
||||
function conf_mount_rw() {
|
||||
function conf_mount_rw($nobootcheck = false) {
|
||||
global $g;
|
||||
|
||||
/* do not mount on cdrom platform */
|
||||
if($g['platform'] == "cdrom" or $g['platform'] == "pfSense")
|
||||
return;
|
||||
|
||||
if($g['booting'] && !$nobootcheck)
|
||||
return;
|
||||
|
||||
if (refcount_reference(1000) > 1)
|
||||
return;
|
||||
|
||||
@ -321,7 +324,7 @@ function conf_mount_rw() {
|
||||
|
||||
/* if the platform is soekris or wrap or pfSense, lets mount the
|
||||
* compact flash cards root.
|
||||
*/
|
||||
*/
|
||||
$status = mwexec("/sbin/mount -u -w -o sync,noatime /");
|
||||
/* we could not mount this correctly. kick off fsck */
|
||||
if($status <> 0) {
|
||||
@ -339,14 +342,14 @@ function conf_mount_rw() {
|
||||
* RESULT
|
||||
* null
|
||||
******/
|
||||
function conf_mount_ro() {
|
||||
function conf_mount_ro($nobootcheck = false) {
|
||||
global $g;
|
||||
|
||||
/* do not umount on cdrom or pfSense platforms */
|
||||
if($g['platform'] == "cdrom" or $g['platform'] == "pfSense")
|
||||
return;
|
||||
|
||||
if($g['booting'])
|
||||
if($g['booting'] && !$nobootcheck)
|
||||
return;
|
||||
|
||||
if (refcount_unreference(1000) > 0)
|
||||
@ -397,12 +400,17 @@ function convert_config() {
|
||||
|
||||
include_once('auth.inc');
|
||||
include_once('upgrade_config.inc');
|
||||
if (file_exists("/etc/inc/upgrade_config_custom.inc"))
|
||||
include_once("upgrade_config_custom.inc");
|
||||
/* Loop and run upgrade_VER_to_VER() until we're at current version */
|
||||
while ($config['version'] < $g['latest_config']) {
|
||||
$cur = $config['version'] * 10;
|
||||
$next = $cur + 1;
|
||||
$migration_function = sprintf('upgrade_%03d_to_%03d', $cur, $next);
|
||||
$migration_function();
|
||||
$migration_function = "{$migration_function}_custom";
|
||||
if (function_exists($migration_function))
|
||||
$migration_function();
|
||||
$config['version'] = sprintf('%.1f', $next / 10);
|
||||
if($g['booting'])
|
||||
echo ".";
|
||||
|
||||
@ -1882,7 +1882,7 @@ function filter_generate_user_rule($rule) {
|
||||
} else
|
||||
$aline['flags'] .= "keep state ";
|
||||
|
||||
if($noadvoptions == false || $l7_present)
|
||||
if($noadvoptions == false)
|
||||
if( (isset($rule['source-track']) and $rule['source-track'] <> "") or
|
||||
(isset($rule['max']) and $rule['max'] <> "") or
|
||||
(isset($rule['max-src-nodes']) and $rule['max-src-nodes'] <> "") or
|
||||
@ -1891,7 +1891,7 @@ function filter_generate_user_rule($rule) {
|
||||
(isset($rule['max-src-conn-rates']) and $rule['max-src-conn-rates'] <> "") or
|
||||
(isset($rule['max-src-states']) and $rule['max-src-states'] <> "") or
|
||||
(isset($rule['statetimeout']) and $rule['statetimeout'] <> "") or
|
||||
isset($rule['sloppy']) or $l7_present) {
|
||||
isset($rule['sloppy'])) {
|
||||
$aline['flags'] .= "( ";
|
||||
if (isset($rule['sloppy']))
|
||||
$aline['flags'] .= "sloppy ";
|
||||
@ -1914,8 +1914,6 @@ function filter_generate_user_rule($rule) {
|
||||
$aline['flags'] .= "max-src-conn-rate " . $rule['max-src-conn-rate'] . " ";
|
||||
$aline['flags'] .= "/" . $rule['max-src-conn-rates'] . ", overload <virusprot> flush global ";
|
||||
}
|
||||
if(!empty($aline['divert']))
|
||||
$aline['flags'] .= "max-packets 5 ";
|
||||
|
||||
$aline['flags'] .= " ) ";
|
||||
}
|
||||
|
||||
@ -1215,8 +1215,8 @@ function interface_ppps_configure($interface) {
|
||||
$localips[$pid] = get_interface_ip($port); // try to get the interface IP from the port
|
||||
|
||||
if(!is_ipaddr($localips[$pid])){
|
||||
log_error(sprintf(gettext("Could not get a Local IP address for PPTP/L2TP link on %s in interfaces_ppps_configure."), $port));
|
||||
return 0;
|
||||
log_error("Could not get a Local IP address for PPTP/L2TP link on {$port} in interfaces_ppps_configure. Using 0.0.0.0 ip!");
|
||||
$localips[$pid] = "0.0.0.0";
|
||||
}
|
||||
/* XXX: This needs to go away soon! [It's commented out!] */
|
||||
/* Configure the gateway (remote IP ) */
|
||||
@ -1492,7 +1492,6 @@ EOD;
|
||||
$mpdconf .= <<<EOD
|
||||
set {$type} self {$localips[$pid]}
|
||||
set {$type} peer {$gateways[$pid]}
|
||||
set {$type} disable windowing
|
||||
|
||||
EOD;
|
||||
}
|
||||
|
||||
@ -295,11 +295,11 @@ function openvpn_reconfigure($mode, $settings) {
|
||||
$vpnid = $settings['vpnid'];
|
||||
$mode_id = $mode.$vpnid;
|
||||
|
||||
if (isset($settings['dev_mode']))
|
||||
$tunname = "{$settings['dev_mode']}{$vpnid}";
|
||||
if (isset($settings['device_mode']))
|
||||
$tunname = "{$settings['device_mode']}{$vpnid}";
|
||||
else { /* defaults to tun */
|
||||
$tunname = "tun{$vpnid}";
|
||||
$settings['dev_mode'] = "tun";
|
||||
$settings['device_mode'] = "tun";
|
||||
}
|
||||
|
||||
if ($mode == "server")
|
||||
@ -323,6 +323,7 @@ function openvpn_reconfigure($mode, $settings) {
|
||||
|
||||
$pfile = $g['varrun_path'] . "/openvpn_{$mode_id}.pid";
|
||||
$proto = ($settings['protocol'] == 'UDP' ? 'udp' : "tcp-{$mode}");
|
||||
$device_mode = $settings['device_mode'];
|
||||
$cipher = $settings['crypto'];
|
||||
|
||||
$interface = $settings['interface'];
|
||||
@ -340,7 +341,7 @@ function openvpn_reconfigure($mode, $settings) {
|
||||
}
|
||||
|
||||
$conf = "dev {$devname}\n";
|
||||
$conf .= "dev-type {$settings['dev_mode']}\n";
|
||||
$conf .= "dev-type {$settings['device_mode']}\n";
|
||||
$conf .= "dev-node /dev/{$tunname}\n";
|
||||
$conf .= "writepid {$pfile}\n";
|
||||
$conf .= "#user nobody\n";
|
||||
|
||||
@ -186,11 +186,11 @@ $priv_list['page-diag-system-activity']['descr'] = gettext("Allows access to the
|
||||
$priv_list['page-diag-system-activity']['match'] = array();
|
||||
$priv_list['page-diag-system-activity']['match'][] = "diag_system_activity*";
|
||||
|
||||
$priv_list['page-diag-system-activity'] = array();
|
||||
$priv_list['page-diag-system-activity']['name'] = gettext("WebCfg - Diagnostics: System Activity");
|
||||
$priv_list['page-diag-system-activity']['descr'] = gettext("Allows access to the 'Diagnostics: System Activity' page");
|
||||
$priv_list['page-diag-system-activity']['match'] = array();
|
||||
$priv_list['page-diag-system-activity']['match'][] = "diag_system_pftop*";
|
||||
$priv_list['page-diag-system-pftop'] = array();
|
||||
$priv_list['page-diag-system-pftop']['name'] = gettext("WebCfg - Diagnostics: pfTop");
|
||||
$priv_list['page-diag-system-pftop']['descr'] = gettext("Allows access to the 'Diagnostics: pfTop' page");
|
||||
$priv_list['page-diag-system-pftop']['match'] = array();
|
||||
$priv_list['page-diag-system-pftop']['match'][] = "diag_system_pftop*";
|
||||
|
||||
$priv_list['page-diagnostics-traceroute'] = array();
|
||||
$priv_list['page-diagnostics-traceroute']['name'] = gettext("WebCfg - Diagnostics: Traceroute page");
|
||||
@ -198,6 +198,12 @@ $priv_list['page-diagnostics-traceroute']['descr'] = gettext("Allow access to th
|
||||
$priv_list['page-diagnostics-traceroute']['match'] = array();
|
||||
$priv_list['page-diagnostics-traceroute']['match'][] = "diag_traceroute.php*";
|
||||
|
||||
$priv_list['page-diagnostics-tables'] = array();
|
||||
$priv_list['page-diagnostics-tables']['name'] = "WebCfg - Diagnostics: Tables page";
|
||||
$priv_list['page-diagnostics-tables']['descr'] = "Allow access to the 'Diagnostics: Tables' page.";
|
||||
$priv_list['page-diagnostics-tables']['match'] = array();
|
||||
$priv_list['page-diagnostics-tables']['match'][] = "diag_tables.php*";
|
||||
|
||||
$priv_list['page-diagnostics-command'] = array();
|
||||
$priv_list['page-diagnostics-command']['name'] = gettext("WebCfg - Diagnostics: Command page");
|
||||
$priv_list['page-diagnostics-command']['descr'] = gettext("Allow access to the 'Diagnostics: Command' page.");
|
||||
@ -1111,12 +1117,6 @@ $priv_list['page-system-groupmanager']['descr'] = gettext("Allow access to the '
|
||||
$priv_list['page-system-groupmanager']['match'] = array();
|
||||
$priv_list['page-system-groupmanager']['match'][] = "system_groupmanager.php*";
|
||||
|
||||
$priv_list['page-diag-showbogons'] = array();
|
||||
$priv_list['page-diag-showbogons']['name'] = gettext("WebCfg - Diagnostics: System Activity");
|
||||
$priv_list['page-diag-showbogons']['descr'] = gettext("Allows access to the 'Diagnostics: Show Bogons' page");
|
||||
$priv_list['page-diag-showbogons']['match'] = array();
|
||||
$priv_list['page-diag-showbogons']['match'][] = "diag_showbogons.php";
|
||||
|
||||
$priv_list['page-status-trafficgraph'] = array();
|
||||
$priv_list['page-status-trafficgraph']['name'] = gettext("WebCfg - Status: Traffic Graph page");
|
||||
$priv_list['page-status-trafficgraph']['descr'] = gettext("Allow access to the 'Status: Traffic Graph' page.");
|
||||
|
||||
@ -177,6 +177,7 @@ function enable_rrd_graphing() {
|
||||
$vpnusers = "-vpnusers.rrd";
|
||||
$captiveportalconcurrent = "-concurrent.rrd";
|
||||
$captiveportalloggedin = "-loggedin.rrd";
|
||||
$captiveportaltotalusers = "-totalusers.rrd";
|
||||
|
||||
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
|
||||
$netstat = "/usr/bin/netstat";
|
||||
@ -185,7 +186,7 @@ function enable_rrd_graphing() {
|
||||
$pfctl = "/sbin/pfctl";
|
||||
$sysctl = "/sbin/sysctl";
|
||||
$php = "/usr/local/bin/php";
|
||||
$top = "/usr/bin/top";
|
||||
$cpustats = "/usr/local/sbin/cpustats";
|
||||
$spamd_gather = "/usr/local/bin/spamd_gather_stats.php";
|
||||
$ifconfig = "/sbin/ifconfig";
|
||||
$captiveportal_gather = "/usr/local/bin/captiveportal_gather_stats.php";
|
||||
@ -355,8 +356,8 @@ function enable_rrd_graphing() {
|
||||
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= "# polling wireless for interface $ifname $realif \n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$wireless N:\\\n";
|
||||
$rrdupdatesh .= "`$ifconfig {$realif} list sta| $awk 'gsub(\"M\", \"\") {getline 2;print substr(\$5, 0, length(\$5)-2) \":\" $4 \":\" $3}'`\n";
|
||||
$rrdupdatesh .= "WIFI=`$ifconfig {$realif} list sta| $awk 'gsub(\"M\", \"\") {getline 2;print substr(\$5, 0, length(\$5)-2) \":\" $4 \":\" $3}'`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$wireless N:${WIFI}\n";
|
||||
}
|
||||
|
||||
/* OpenVPN, set up the rrd file */
|
||||
@ -393,8 +394,8 @@ function enable_rrd_graphing() {
|
||||
$rrdupdatesh .= " sleep 0.2\n";
|
||||
$rrdupdatesh .= " echo \"quit\"\n";
|
||||
$rrdupdatesh .= "}\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$vpnusers N:\\\n";
|
||||
$rrdupdatesh .= "`list_current_users | nc -U {$g['varetc_path']}/openvpn/server{$vpnid}.sock | awk -F\",\" '/^CLIENT_LIST/ {print \$2}' | wc -l | awk '{print $1}'` &\n";
|
||||
$rrdupdatesh .= "OVPN=`list_current_users | nc -U {$g['varetc_path']}/openvpn/server{$vpnid}.sock | awk -F\",\" '/^CLIENT_LIST/ {print \$2}' | wc -l | awk '{print $1}'` &\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$vpnusers N:\${OVPN}\n";
|
||||
}
|
||||
|
||||
/* QUEUES, set up the queues databases */
|
||||
@ -566,11 +567,10 @@ function enable_rrd_graphing() {
|
||||
}
|
||||
|
||||
/* the CPU stats gathering function. */
|
||||
$rrdupdatesh .= "`$top -d 2 -s 1 0 | $awk '{gsub(/%/, \"\")} BEGIN { \\\n";
|
||||
$rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } \\\n";
|
||||
$rrdupdatesh .= "{ if ( \$2 == \"processes:\" ) { processes = \$1; } \\\n";
|
||||
$rrdupdatesh .= "else if ( \$1 == \"CPU:\" ) { user = \$2; nice = \$4; sys = \$6; interrupt = \$8; } \\\n";
|
||||
$rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n";
|
||||
$rrdupdatesh .= "CPU=`$cpustats | cut -f1-4 -d':'`\n";
|
||||
/* Using ps uxaH will count all processes including system threads. Top was undercounting. */
|
||||
$rrdupdatesh .= "PROCS=`ps uxaH | wc -l | awk '{print \$1;}'`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$proc N:\${CPU}:\${PROCS}\n";
|
||||
|
||||
/* End CPU statistics */
|
||||
|
||||
@ -604,9 +604,10 @@ function enable_rrd_graphing() {
|
||||
}
|
||||
|
||||
/* the Memory stats gathering function. */
|
||||
$rrdupdatesh .= "`$sysctl -n vm.stats.vm.v_page_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_free_count vm.stats.vm.v_cache_count vm.stats.vm.v_wire_count | ";
|
||||
$rrdupdatesh .= " $awk '{getline active;getline inactive;getline free;getline cache;getline wire;printf \"$rrdtool update $rrddbpath$ifname$mem N:\"";
|
||||
$rrdupdatesh .= "((active/$0) * 100)\":\"((inactive/$0) * 100)\":\"((free/$0) * 100)\":\"((cache/$0) * 100)\":\"(wire/$0 * 100)}'`\n\n";
|
||||
$rrdupdatesh .= "MEM=`$sysctl -n vm.stats.vm.v_page_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_free_count vm.stats.vm.v_cache_count vm.stats.vm.v_wire_count | ";
|
||||
$rrdupdatesh .= " $awk '{getline active;getline inactive;getline free;getline cache;getline wire;printf ";
|
||||
$rrdupdatesh .= "((active/$0) * 100)\":\"((inactive/$0) * 100)\":\"((free/$0) * 100)\":\"((cache/$0) * 100)\":\"(wire/$0 * 100)}'`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$mem N:\${MEM}\n";
|
||||
|
||||
/* End Memory statistics */
|
||||
|
||||
@ -673,7 +674,7 @@ function enable_rrd_graphing() {
|
||||
/* Captive Portal statistics, set up the rrd file */
|
||||
if(isset($config['captiveportal']['enable'])) {
|
||||
$ifname= "captiveportal";
|
||||
if (!file_exists("$rrddbpath$ifname$captiveportal")) {
|
||||
if (!file_exists("$rrddbpath$ifname$captiveportalconcurrent")) {
|
||||
$rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportalconcurrent --step $rrdcaptiveportalinterval ";
|
||||
$rrdcreate .= "DS:concurrentusers:GAUGE:$captiveportalvalid:0:10000 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
|
||||
@ -704,11 +705,11 @@ function enable_rrd_graphing() {
|
||||
/* the Captive Portal stats gathering function. */
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= "# polling Captive Portal for number of concurrent users\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalconcurrent \\\n";
|
||||
$rrdupdatesh .= "`$php -q $captiveportal_gather concurrent`\n";
|
||||
$rrdupdatesh .= "CP=`$php -q $captiveportal_gather concurrent`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalconcurrent \${CP}\n";
|
||||
|
||||
$ifname= "captiveportal";
|
||||
if (!file_exists("$rrddbpath$ifname$captiveportal")) {
|
||||
if (!file_exists("$rrddbpath$ifname$captiveportalloggedin")) {
|
||||
$rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportalloggedin --step $rrdcaptiveportalinterval ";
|
||||
$rrdcreate .= "DS:loggedinusers:GAUGE:$captiveportalvalid:0:10000 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
|
||||
@ -738,9 +739,45 @@ function enable_rrd_graphing() {
|
||||
|
||||
/* the Captive Portal stats gathering function. */
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= "# polling Captive Portal for number of logged in users and concurrent users\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalloggedin \\\n";
|
||||
$rrdupdatesh .= "`$php -q $captiveportal_gather loggedin`\n";
|
||||
$rrdupdatesh .= "# polling Captive Portal for number of logged in users\n";
|
||||
$rrdupdatesh .= "CP=`$php -q $captiveportal_gather loggedin`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalloggedin \${CP}\n";
|
||||
|
||||
$ifname= "captiveportal";
|
||||
if (!file_exists("$rrddbpath$ifname$captiveportaltotalusers")) {
|
||||
$rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportaltotalusers --step $rrdcaptiveportalinterval ";
|
||||
$rrdcreate .= "DS:totalusers:GAUGE:$captiveportalvalid:0:10000 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:5:1100 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:60:1175 ";
|
||||
$rrdcreate .= "RRA:AVERAGE:0.5:720:3000 ";
|
||||
$rrdcreate .= "RRA:MIN:0.5:1:1000 ";
|
||||
$rrdcreate .= "RRA:MIN:0.5:5:1100 ";
|
||||
$rrdcreate .= "RRA:MIN:0.5:60:1175 ";
|
||||
$rrdcreate .= "RRA:MIN:0.5:720:3000 ";
|
||||
$rrdcreate .= "RRA:MAX:0.5:1:1000 ";
|
||||
$rrdcreate .= "RRA:MAX:0.5:5:1100 ";
|
||||
$rrdcreate .= "RRA:MAX:0.5:60:1175 ";
|
||||
$rrdcreate .= "RRA:MAX:0.5:720:3000 ";
|
||||
$rrdcreate .= "RRA:LAST:0.5:1:1000 ";
|
||||
$rrdcreate .= "RRA:LAST:0.5:5:1100 ";
|
||||
$rrdcreate .= "RRA:LAST:0.5:60:1175 ";
|
||||
$rrdcreate .= "RRA:LAST:0.5:720:3000 ";
|
||||
|
||||
create_new_rrd($rrdcreate);
|
||||
}
|
||||
|
||||
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
|
||||
if($g['booting']) {
|
||||
mwexec("$rrdtool update $rrddbpath$ifname$captiveportaltotalusers N:U");
|
||||
}
|
||||
|
||||
/* the Captive Portal stats gathering function. */
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= "# polling Captive Portal for number of concurrent users\n";
|
||||
$rrdupdatesh .= "CP=`$php -q $captiveportal_gather total`\n";
|
||||
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportaltotalusers \${CP}\n";
|
||||
|
||||
}
|
||||
|
||||
$rrdupdatesh .= "sleep 60\n";
|
||||
|
||||
@ -1304,10 +1304,13 @@ function configure_cron() {
|
||||
function upnp_action ($action) {
|
||||
switch($action) {
|
||||
case "start":
|
||||
if(file_exists('/var/etc/miniupnpd.conf'))
|
||||
mwexec_bg('/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf');
|
||||
if (file_exists('/var/etc/miniupnpd.conf')) {
|
||||
@unlink("{$g['varrun_path']}/miniupnpd.pid");
|
||||
mwexec_bg("/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf -P {$g['varrun_path']}/miniupnpd.pid");
|
||||
}
|
||||
break;
|
||||
case "stop":
|
||||
killbypid("{$g['varrun_path']}/miniupnpd.pid");
|
||||
while((int)exec("/bin/pgrep -a miniupnpd | wc -l") > 0)
|
||||
mwexec('killall miniupnpd 2>/dev/null', true);
|
||||
mwexec('/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null');
|
||||
|
||||
@ -961,7 +961,9 @@ class priq_queue {
|
||||
$input_errors[] = gettext("Queue limit must be an integer");
|
||||
if ($data['qlimit'] < 0)
|
||||
$input_errors[] = gettext("Queue limit must be positive");
|
||||
if (!preg_match("/^[a-zA-Z0-9_-]*$/", $data['name']))
|
||||
if (!empty($data['newname']) && !preg_match("/^[a-zA-Z0-9_-]*$/", $data['newname']))
|
||||
$input_errors[] = gettext("Queue names must be alphanumeric and _ or - only.");
|
||||
if (!empty($data['name']) && !preg_match("/^[a-zA-Z0-9_-]*$/", $data['name']))
|
||||
$input_errors[] = gettext("Queue names must be alphanumeric and _ or - only.");
|
||||
|
||||
}
|
||||
@ -2770,7 +2772,7 @@ class dummynet_class {
|
||||
$reqdfieldsn[] = gettext("Bandwidth");
|
||||
$reqdfields[] = "bandwidthtype";
|
||||
$reqdfieldsn[] = gettext("Bandwidthtype");
|
||||
$reqdfields[] = "name";
|
||||
$reqdfields[] = "newname";
|
||||
$reqdfieldsn[] = gettext("Name");
|
||||
|
||||
shaper_do_input_validation($data, $reqdfields, $reqdfieldsn, $input_errors);
|
||||
@ -2782,8 +2784,10 @@ class dummynet_class {
|
||||
($data['buckets'] < 1 && $data['buckets'] > 100))
|
||||
$input_errors[] = gettext("Buckets must be an integer between 16 and 65535.");
|
||||
if ($data['qlimit'] && (!is_numeric($data['qlimit'])))
|
||||
$input_errors[] = gettext("Queue limit must be an integer");
|
||||
if (!preg_match("/^[a-zA-Z0-9_-]+$/", $data['name']))
|
||||
$input_errors[] = gettext("Queue limit must be an integer");
|
||||
if (!empty($data['newname']) && !preg_match("/^[a-zA-Z0-9_-]+$/", $data['newname']))
|
||||
$input_errors[] = gettext("Queue names must be alphanumeric and _ or - only.");
|
||||
if (!empty($data['name']) && !preg_match("/^[a-zA-Z0-9_-]+$/", $data['name']))
|
||||
$input_errors[] = gettext("Queue names must be alphanumeric and _ or - only.");
|
||||
}
|
||||
}
|
||||
@ -3252,7 +3256,7 @@ class dnqueue_class extends dummynet_class {
|
||||
$form .= " <input type=\"checkbox\" id=\"enabled\" name=\"enabled\" value=\"on\"";
|
||||
if ($this->GetEnabled() == "on")
|
||||
$form .= " CHECKED";
|
||||
$form .= " ><span class=\"vexpl\"> " . gettext("Enable/Disable queue and its children") . "</span>";
|
||||
$form .= " ><span class=\"vexpl\"> " . gettext("Enable/Disable queue") . "</span>";
|
||||
$form .= "</td></tr>";
|
||||
$form .= "<tr><td valign=\"center\" class=\"vncellreq\"><br><span class=\"vexpl\">" . gettext("Name") . "</span></td>";
|
||||
$form .= "<td class=\"vncellreq\">";
|
||||
|
||||
@ -1147,22 +1147,13 @@ function system_timezone_configure() {
|
||||
function system_ntp_configure() {
|
||||
global $config, $g;
|
||||
|
||||
$syscfg =& $config['system'];
|
||||
|
||||
/* open configuration for wrting or bail */
|
||||
$fd = fopen("{$g['varetc_path']}/ntpd.conf","w");
|
||||
if(!$fd) {
|
||||
log_error(sprintf(gettext("Could not open %s/ntpd.conf for writing"), $g['varetc_path']));
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite($fd, "# \n");
|
||||
fwrite($fd, "# " . gettext("pfSense OpenNTPD configuration file") . " \n");
|
||||
fwrite($fd, "# \n\n");
|
||||
$ntpcfg = "# \n";
|
||||
$ntpcfg .= "# pfSense OpenNTPD configuration file \n";
|
||||
$ntpcfg .= "# \n\n";
|
||||
|
||||
/* foreach through servers and write out to ntpd.conf */
|
||||
foreach (explode(' ', $syscfg['timeservers']) as $ts)
|
||||
fwrite($fd, sprintf(gettext("servers %s\n"), $ts));
|
||||
foreach (explode(' ', $config['system']['timeservers']) as $ts)
|
||||
$ntpcfg .= "servers {$ts}\n";
|
||||
|
||||
/* Setup listener(s) if the user has configured one */
|
||||
if ($config['installedpackages']['openntpd']) {
|
||||
@ -1175,12 +1166,19 @@ function system_ntp_configure() {
|
||||
$ips = array_map('find_interface_ip', $ifaces);
|
||||
foreach ($ips as $ip) {
|
||||
if (is_ipaddr($ip))
|
||||
fwrite($fd, "listen on $ip\n");
|
||||
$ntpdcfg .= "listen on $ip\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$ntpdcfg .= "\n";
|
||||
|
||||
fwrite($fd, "\n");
|
||||
/* open configuration for wrting or bail */
|
||||
$fd = fopen("{$g['varetc_path']}/ntpd.conf","w");
|
||||
if(!$fd) {
|
||||
log_error("Could not open {$g['varetc_path']}/ntpd.conf for writing");
|
||||
return;
|
||||
}
|
||||
fwrite($fd, $ntpcfg);
|
||||
|
||||
/* slurp! */
|
||||
fclose($fd);
|
||||
@ -1208,13 +1206,11 @@ function system_ntp_configure() {
|
||||
function sync_system_time() {
|
||||
global $config, $g;
|
||||
|
||||
$syscfg = $config['system'];
|
||||
|
||||
if ($g['booting'])
|
||||
echo gettext("Syncing system time before startup...");
|
||||
|
||||
/* foreach through servers and write out to ntpd.conf */
|
||||
foreach (explode(' ', $syscfg['timeservers']) as $ts) {
|
||||
foreach (explode(' ', $config['system']['timeservers']) as $ts) {
|
||||
mwexec("/usr/sbin/ntpdate -s $ts");
|
||||
}
|
||||
|
||||
|
||||
@ -790,6 +790,7 @@ function upgrade_043_to_044() {
|
||||
$gateways = return_gateways_array(true);
|
||||
$i = 0;
|
||||
if (is_array($config['staticroutes']['route'])) {
|
||||
$gwmap = array();
|
||||
foreach ($config['staticroutes']['route'] as $idx => $sroute) {
|
||||
$found = false;
|
||||
foreach ($gateways as $gwname => $gw) {
|
||||
@ -799,9 +800,15 @@ function upgrade_043_to_044() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($gwmap[$sroute['gateway']]) {
|
||||
/* We already added a gateway name for this IP */
|
||||
$config['staticroutes']['route'][$idx]['gateway'] = "{$gwmap[$sroute['gateway']]}";
|
||||
$found = true;
|
||||
}
|
||||
if ($found == false) {
|
||||
$gateway = array();
|
||||
$gateway['name'] = "SROUTE{$i}";
|
||||
$gateway['name'] = "SROUTE{$i}";
|
||||
$gwmap[$sroute['gateway']] = $gateway['name'];
|
||||
$gateway['gateway'] = $sroute['gateway'];
|
||||
$gateway['interface'] = $sroute['interface'];
|
||||
$gateway['descr'] = sprintf(gettext("Upgraded static route for %s"), $sroute['network']);
|
||||
|
||||
@ -37,6 +37,54 @@
|
||||
if(!function_exists('captiveportal_syslog'))
|
||||
require_once("captiveportal.inc");
|
||||
|
||||
function xmlrpc_sync_voucher_disconnect($dbent, $syncip, $port, $password, $username, $term_cause = "1", $stop_time = null) {
|
||||
global $g, $config;
|
||||
require_once("xmlrpc.inc");
|
||||
if($port == "443")
|
||||
$url = "https://{$syncip}:{$port}";
|
||||
else
|
||||
$url = "http://{$syncip}:{$port}";
|
||||
|
||||
/* Construct code that is run on remote machine */
|
||||
$method = 'pfsense.exec_php';
|
||||
$execcmd = <<<EOF
|
||||
require_once('/etc/inc/captiveportal.inc');
|
||||
require_once('/etc/inc/voucher.inc');
|
||||
\$radiusservers = captiveportal_get_radius_servers();
|
||||
captiveportal_disconnect(\$dbent, \$radiusservers, \$term_cause, \$stop_time);
|
||||
|
||||
EOF;
|
||||
|
||||
/* assemble xmlrpc payload */
|
||||
$params = array(
|
||||
XML_RPC_encode($password),
|
||||
XML_RPC_encode($execcmd)
|
||||
);
|
||||
|
||||
log_error("Captive Portal Voucher XMLRPC sync data {$url}:{$port}.");
|
||||
$msg = new XML_RPC_Message($method, $params);
|
||||
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
|
||||
$cli->setCredentials($username, $password);
|
||||
$resp = $cli->send($msg, "250");
|
||||
if(!is_object($resp)) {
|
||||
$error = "A communications error occurred while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} (pfsense.exec_php).";
|
||||
log_error($error);
|
||||
file_notice("CaptivePortalVoucherSync", $error, "Communications error occurred", "");
|
||||
return false;
|
||||
} elseif($resp->faultCode()) {
|
||||
$error = "An error code was received while attempting CaptivePortalVoucherSync XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
|
||||
log_error($error);
|
||||
file_notice("CaptivePortalVoucherSync", $error, "Error code received", "");
|
||||
return false;
|
||||
} else {
|
||||
log_error("CaptivePortalVoucherSync XMLRPC reload data success with {$url}:{$port} (pfsense.exec_php).");
|
||||
}
|
||||
|
||||
$toreturn = XML_RPC_Decode($resp->value());
|
||||
|
||||
return $toreturn;
|
||||
}
|
||||
|
||||
function xmlrpc_sync_used_voucher($voucher_received, $syncip, $port, $password, $username) {
|
||||
global $g, $config;
|
||||
require_once("xmlrpc.inc");
|
||||
|
||||
@ -136,6 +136,7 @@ function vpn_ipsec_configure($ipchg = false)
|
||||
$filterdns_list = array();
|
||||
if (is_array($a_phase1) && count($a_phase1)) {
|
||||
|
||||
$ipsecpinghosts = "";
|
||||
/* step through each phase1 entry */
|
||||
foreach ($a_phase1 as $ph1ent) {
|
||||
if (isset($ph1ent['disabled']))
|
||||
@ -171,7 +172,6 @@ function vpn_ipsec_configure($ipchg = false)
|
||||
$rgmap[$ph1ent['remote-gateway']] = $rg;
|
||||
|
||||
/* step through each phase2 entry */
|
||||
$ipsecpinghosts = "";
|
||||
foreach ($a_phase2 as $ph2ent) {
|
||||
|
||||
$ikeid = $ph2ent['ikeid'];
|
||||
|
||||
@ -129,7 +129,7 @@ $memory = get_memory();
|
||||
$avail = $memory[0];
|
||||
echo " done.\n";
|
||||
|
||||
conf_mount_rw();
|
||||
conf_mount_rw(true);
|
||||
|
||||
/* save dmesg output to file */
|
||||
system_dmesg_save();
|
||||
@ -400,6 +400,6 @@ unset($g['booting']);
|
||||
|
||||
led_normalize();
|
||||
|
||||
conf_mount_ro();
|
||||
conf_mount_ro(true);
|
||||
|
||||
?>
|
||||
|
||||
@ -99,19 +99,19 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host
|
||||
|
||||
$numberofruns = 0;
|
||||
while ($numberofruns < 2) {
|
||||
$msg = new XML_RPC_Message($method, $params);
|
||||
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
|
||||
$username = $config['system']['user'][0]['name'];
|
||||
$cli->setCredentials($username, $password);
|
||||
if($numberofruns > 1)
|
||||
$cli->setDebug(1);
|
||||
/* send our XMLRPC message and timeout after 240 seconds */
|
||||
$resp = $cli->send($msg, "240");
|
||||
if(!is_object($resp)) {
|
||||
$error = "A communications error occured while attempting XMLRPC sync with username {$username} {$url}:{$port}.";
|
||||
} elseif($resp->faultCode()) {
|
||||
$error = "An error code was received while attempting XMLRPC sync with username {$username} {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
|
||||
} else {
|
||||
$msg = new XML_RPC_Message($method, $params);
|
||||
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
|
||||
$username = $config['system']['user'][0]['name'];
|
||||
$cli->setCredentials($username, $password);
|
||||
if($numberofruns > 1)
|
||||
$cli->setDebug(1);
|
||||
/* send our XMLRPC message and timeout after 240 seconds */
|
||||
$resp = $cli->send($msg, "240");
|
||||
if(!is_object($resp)) {
|
||||
$error = "A communications error occured while attempting XMLRPC sync with username {$username} {$url}:{$port}.";
|
||||
} elseif($resp->faultCode()) {
|
||||
$error = "An error code was received while attempting XMLRPC sync with username {$username} {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString();
|
||||
} else {
|
||||
$parsed_response = XML_RPC_decode($resp->value());
|
||||
if(!is_array($parsed_response)) {
|
||||
if (trim($parsed_response) == "Authentication failed") {
|
||||
@ -122,9 +122,11 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host
|
||||
}
|
||||
} else {
|
||||
if (!isset($parsed_response['config_version']) ||
|
||||
$parsed_response['config_version'] < $config['version'])
|
||||
$parsed_response['config_version'] < $config['version']) {
|
||||
update_filter_reload_status("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
|
||||
log_error("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
|
||||
return false;
|
||||
else
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -379,11 +381,8 @@ if (is_array($config['installedpackages']['carpsettings']['config'])) {
|
||||
if ($carp['synchronizecaptiveportal'] != "" and is_array($config['vouchers']))
|
||||
$sections[] = 'vouchers';
|
||||
if (count($sections) > 0) {
|
||||
if (!carp_check_version($synchronizetoip, $carp['password'], $port)) {
|
||||
update_filter_reload_status("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
|
||||
log_error("The other member is on older configuration version of {$g['product_name']}. Sync will not be done to prevent problems!");
|
||||
if (!carp_check_version($synchronizetoip, $carp['password'], $port))
|
||||
break;
|
||||
}
|
||||
|
||||
update_filter_reload_status("Signaling CARP reload signal...");
|
||||
carp_sync_xml($synchronizetoip, $carp['password'], $sections, $port);
|
||||
|
||||
@ -43,10 +43,7 @@
|
||||
while (file_exists("{$g['varrun_path']}/booting")) {
|
||||
sleep(1);
|
||||
}
|
||||
while(stristr(shell_exec("/bin/ps auxww"), "rc.newipsecdns")) {
|
||||
// log_error("There is an existing rc.newipsecdns running, sleeping 1 second");
|
||||
sleep(1);
|
||||
}
|
||||
$ipseclck = lock('ipsecdns', LOCK_EX);
|
||||
|
||||
log_error("IPSEC: One or more IPsec tunnel endpoints has changed its IP. Refreshing.");
|
||||
/* We will walk the list of hostnames found in the ipsec tunnel
|
||||
@ -59,4 +56,6 @@
|
||||
vpn_ipsec_configure();
|
||||
|
||||
filter_configure();
|
||||
|
||||
unlock($ipseclck);
|
||||
?>
|
||||
|
||||
@ -28,7 +28,7 @@ export PATH
|
||||
# temporary files on shutdown from /tmp/
|
||||
PLATFORM=`cat /etc/platform`
|
||||
if [ "$PLATFORM" = "pfSense" ]; then
|
||||
find -x /tmp/ -type f -exec rm -f {} \;
|
||||
find -x /tmp/* -type f -exec rm -f {} \;
|
||||
else
|
||||
/etc/rc.backup_rrd.sh
|
||||
/etc/rc.backup_dhcpleases.sh
|
||||
|
||||
6
etc/sshd
6
etc/sshd
@ -42,7 +42,7 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
conf_mount_rw();
|
||||
conf_mount_rw(true);
|
||||
|
||||
function file_size($file) {
|
||||
$size = filesize($file);
|
||||
@ -138,7 +138,7 @@
|
||||
|
||||
/* are we already running? if so exit */
|
||||
if(is_subsystem_dirty('sshdkeys')) {
|
||||
conf_mount_ro();
|
||||
conf_mount_ro(true);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -185,6 +185,6 @@
|
||||
exec("mkdir /conf/sshd");
|
||||
exec("/bin/cp -p /etc/ssh/ssh_host* /conf/sshd");
|
||||
}
|
||||
conf_mount_ro();
|
||||
conf_mount_ro(true);
|
||||
|
||||
?>
|
||||
|
||||
@ -68,7 +68,7 @@ if($_POST['disablecarp'] <> "") {
|
||||
}
|
||||
}
|
||||
}
|
||||
$savemsg = sprintf(gettext("%s IPs have been disabled."), $carp_counter);
|
||||
$savemsg = sprintf(gettext("%s IPs have been disabled. Please note that disabling does not survive a reboot."), $carp_counter);
|
||||
} else {
|
||||
$savemsg = gettext("CARP has been enabled.");
|
||||
mwexec("/sbin/sysctl net.inet.carp.allow=1");
|
||||
|
||||
@ -56,16 +56,30 @@ if(is_array($config['ipsec']['phase1']))
|
||||
$gateway = ipsec_get_phase1_dst($ph1ent);
|
||||
if(!is_ipaddr($gateway))
|
||||
continue;
|
||||
$search[] = "/(racoon: )([A-Z:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i";
|
||||
$search[] = "/(racoon: )(INFO[:].*?)({$gateway}\[[0-9].+\]|{$gateway})(.*)/i";
|
||||
$search[] = "/(racoon: )(\[{$gateway}\]|{$gateway})(.*)/i";
|
||||
$replace[] = "$1<strong>[{$ph1ent['descr']}]</strong>: $2$3$4";
|
||||
$replace[] = "$1<strong>[{$ph1ent['descr']}]</strong>: $2$3$4";
|
||||
}
|
||||
/* collect all our own ip addresses */
|
||||
exec("/sbin/ifconfig | /usr/bin/awk '/inet / {print $2}'", $ip_address_list);
|
||||
foreach($ip_address_list as $address) {
|
||||
$search[] = "/(racoon: )([A-Z:].*?)({$address}\[[0-9].+\])(.*isakmp.*)/i";
|
||||
$search[] = "/(racoon: )(INFO[:].*?)({$address}\[[0-9].+\])/i";
|
||||
$search[] = "/(racoon: )(\[{$address}\]|{$address})(.*)/i";
|
||||
$replace[] = "$1<strong>[Self]</strong>: $2$3$4";
|
||||
$replace[] = "$1<strong>[Self]</strong>: $2$3$4";
|
||||
}
|
||||
|
||||
$search[] = "/(time up waiting for phase1)/i";
|
||||
$search[] = "/(failed to pre-process ph1 packet)/i";
|
||||
$search[] = "/(failed to pre-process ph2 packet)/i";
|
||||
$search[] = "/(no proposal chosen)/i";
|
||||
$replace[] = "$1 <strong>[Remote Side not responding]</strong>";
|
||||
$replace[] = "$1 <strong>[Check Phase 1 settings, lifetime, algorithm]</strong>";
|
||||
$replace[] = "$1 <strong>[Check Phase 2 settings, networks]</strong>";
|
||||
$replace[] = "$1 <strong>[Check Phase 2 settings, algorithm]</strong>";
|
||||
|
||||
|
||||
$nentries = $config['syslog']['nentries'];
|
||||
if (!$nentries)
|
||||
$nentries = 50;
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
// Keywords not allowed in names
|
||||
$reserved_keywords = array("pass", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec");
|
||||
$reserved_keywords = array("all", "pass", "out", "queue", "max", "min", "pptp", "pppoe", "L2TP", "OpenVPN", "IPsec");
|
||||
|
||||
require("guiconfig.inc");
|
||||
require_once("functions.inc");
|
||||
|
||||
@ -72,7 +72,7 @@ if ($_POST) {
|
||||
if ($_POST['name'])
|
||||
$qname = htmlspecialchars(trim($_POST['name']));
|
||||
else if ($_POST['newname'])
|
||||
$qname = htmlspecialchars(trim($_POST['name']));
|
||||
$qname = htmlspecialchars(trim($_POST['newname']));
|
||||
if ($_POST['pipe'])
|
||||
$pipe = htmlspecialchars(trim($_POST['pipe']));
|
||||
else
|
||||
|
||||
@ -159,7 +159,7 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
|
||||
}
|
||||
}// End force pppoe reset at specific time
|
||||
}// End if type == pppoe
|
||||
else if ($a_ppps[$pppid]['type'] == "pptp"){
|
||||
else if ($a_ppps[$pppid]['type'] == "pptp" || $a_ppps[$pppid]['type'] == "l2tp"){
|
||||
$pconfig['pptp_username'] = $a_ppps[$pppid]['username'];
|
||||
$pconfig['pptp_password'] = base64_decode($a_ppps[$pppid]['password']);
|
||||
$pconfig['pptp_local'] = explode(",",$a_ppps[$pppid]['localip']);
|
||||
@ -175,6 +175,7 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) {
|
||||
$pconfig['dhcphostname'] = $wancfg['dhcphostname'];
|
||||
$pconfig['alias-address'] = $wancfg['alias-address'];
|
||||
$pconfig['alias-subnet'] = $wancfg['alias-subnet'];
|
||||
$pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']);
|
||||
$pconfig['descr'] = remove_bad_chars($wancfg['descr']);
|
||||
$pconfig['enable'] = isset($wancfg['enable']);
|
||||
|
||||
@ -196,6 +197,7 @@ switch($wancfg['ipaddr']) {
|
||||
break;
|
||||
case "pppoe":
|
||||
case "pptp":
|
||||
case "l2tp":
|
||||
case "ppp":
|
||||
$pconfig['type'] = $wancfg['ipaddr'];
|
||||
break;
|
||||
@ -415,6 +417,16 @@ if ($_POST['apply']) {
|
||||
}
|
||||
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
||||
break;
|
||||
case "l2tp":
|
||||
if ($_POST['pptp_dialondemand']) {
|
||||
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote pptp_dialondemand pptp_idletimeout");
|
||||
$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"),gettext("Dial on demand"),gettext("Idle timeout value"));
|
||||
} else {
|
||||
$reqdfields = explode(" ", "pptp_username pptp_password pptp_remote");
|
||||
$reqdfieldsn = array(gettext("L2TP username"),gettext("L2TP password"),gettext("L2TP remote IP address"));
|
||||
}
|
||||
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
||||
break;
|
||||
}
|
||||
|
||||
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
|
||||
@ -454,7 +466,7 @@ if ($_POST['apply']) {
|
||||
$input_errors[] = gettext("A valid PPTP local IP address must be specified.");
|
||||
if (($_POST['pptp_subnet'] && !is_numeric($_POST['pptp_subnet'])))
|
||||
$input_errors[] = gettext("A valid PPTP subnet bit count must be specified.");
|
||||
if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote'])))
|
||||
if (($_POST['pptp_remote'] && !is_ipaddr($_POST['pptp_remote']) && !is_hostname($_POST['gateway'][$iface])))
|
||||
$input_errors[] = gettext("A valid PPTP remote IP address must be specified.");
|
||||
if (($_POST['pptp_idletimeout'] != "") && !is_numericint($_POST['pptp_idletimeout']))
|
||||
$input_errors[] = gettext("The idle timeout value must be an integer.");
|
||||
@ -588,6 +600,7 @@ if ($_POST['apply']) {
|
||||
$wancfg['dhcphostname'] = $_POST['dhcphostname'];
|
||||
$wancfg['alias-address'] = $_POST['alias-address'];
|
||||
$wancfg['alias-subnet'] = $_POST['alias-subnet'];
|
||||
$wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false;
|
||||
if($gateway_item) {
|
||||
$a_gateways[] = $gateway_item;
|
||||
}
|
||||
@ -648,6 +661,7 @@ if ($_POST['apply']) {
|
||||
|
||||
break;
|
||||
case "pptp":
|
||||
case "l2tp":
|
||||
$a_ppps[$pppid]['ptpid'] = $_POST['ptpid'];
|
||||
$a_ppps[$pppid]['type'] = $_POST['type'];
|
||||
$a_ppps[$pppid]['if'] = $_POST['type'].$_POST['ptpid'];
|
||||
@ -888,7 +902,7 @@ $statusurl = "status_interfaces.php";
|
||||
|
||||
$closehead = false;
|
||||
include("head.inc");
|
||||
$types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP") /* , "carpdev-dhcp" => "CarpDev"*/);
|
||||
$types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP"), "l2tp" => gettext("L2TP") /* , "carpdev-dhcp" => "CarpDev"*/);
|
||||
|
||||
?>
|
||||
|
||||
@ -921,12 +935,15 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
|
||||
$('none','static','dhcp','pptp', 'ppp').invoke('hide');
|
||||
break;
|
||||
}
|
||||
case "l2tp":
|
||||
case "pptp": {
|
||||
$('none','static','dhcp','pppoe', 'ppp').invoke('hide');
|
||||
$('pptp').show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$(t).show();
|
||||
if (t != "l2tp" && t != "pptp")
|
||||
$(t).show();
|
||||
}
|
||||
|
||||
function show_allcfg(obj) {
|
||||
@ -1250,6 +1267,17 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
|
||||
<tr>
|
||||
<td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP client configuration"); ?></td>
|
||||
</tr>
|
||||
<!-- Uncomment to expose DHCP+ in GUI
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vncell"><?=gettext("Enable DHCP+"); ?></td>
|
||||
<td width="78%" class="vtable">
|
||||
<input name="dhcp_plus" type="checkbox" value="yes" <?php if ($pconfig['dhcp_plus'] == true) echo "checked"; ?> >
|
||||
<strong><?=gettext("Enable DHCP+L2TP or DHCP+PPTP."); ?></strong>
|
||||
<br/>
|
||||
<?=gettext("Status changes on this interface will trigger reconfiguration (if necessary) of the associated PPTP/L2TP link."); ?>
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vncell"><?=gettext("Hostname"); ?></td>
|
||||
<td width="78%" class="vtable">
|
||||
@ -1279,6 +1307,7 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
|
||||
"DHCP client."); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1489,7 +1518,7 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
|
||||
<td colspan="2" style="padding:0px;">
|
||||
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" class="listtopic"><?=gettext("PPTP configuration"); ?></td>
|
||||
<td colspan="2" valign="top" class="listtopic"><?=gettext("PPTP/L2TP configuration"); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vncellreq"><?=gettext("Username"); ?></td>
|
||||
|
||||
@ -614,7 +614,7 @@ value="<?=htmlspecialchars($pconfig['radiuskey2']);?>"></td>
|
||||
}
|
||||
?>
|
||||
</select><br/>
|
||||
<?=gettext("Choose the ip to use for calling station attribute."); ?>
|
||||
<?=gettext("Choose the IP to use for calling station attribute."); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
@ -132,6 +132,21 @@ include("head.inc");
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; if ($ifinfo['l2tplink']): ?>
|
||||
<tr>
|
||||
<td width="22%" class="vncellt"><?=gettext("L2TP"); ?></td>
|
||||
<td width="78%" class="listr">
|
||||
<?=htmlspecialchars($ifinfo['l2tplink']);?>
|
||||
<?php if ($ifinfo['l2tplink'] == "up"): ?>
|
||||
<a href="status_interfaces.php?action=Disconnect&if=<?php echo $ifdescr; ?>">
|
||||
<input type="button" name="<?php echo $ifdescr; ?>" value="<?=gettext("Disconnect");?>" class="formbtns">
|
||||
<?php else: ?>
|
||||
<a href="status_interfaces.php?action=Connect&if=<?php echo $ifdescr; ?>">
|
||||
<input type="button" name="<?php echo $ifdescr; ?>" value="<?=gettext("Connect");?>" class="formbtns">
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; if ($ifinfo['ppplink']): ?>
|
||||
<tr>
|
||||
<td width="22%" class="vncellt"><?=gettext("PPP"); ?></td>
|
||||
|
||||
@ -545,7 +545,7 @@ elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdat
|
||||
$graphcmd .= "GPRINT:\"$curif-in_pps_block:LAST:%7.2lf %S pps\" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-pps_in_t_block:AVERAGE:%7.2lf %s pkts\" ";
|
||||
$graphcmd .= "COMMENT:\"\\n\" ";
|
||||
$graphcmd .= "COMMENT:\"out-pass\t\" ";
|
||||
$graphcmd .= "COMMENT:\"out-block\t\" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-out_pps_block:MAX:%7.2lf %s pps\" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-out_pps_block:AVERAGE:%7.2lf %S pps\" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-out_pps_block:LAST:%7.2lf %S pps\" ";
|
||||
@ -960,6 +960,28 @@ elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$cur
|
||||
$graphcmd .= "COMMENT:\"\\n\" ";
|
||||
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
|
||||
}
|
||||
elseif((strstr($curdatabase, "-totalusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
|
||||
/* define graphcmd for online Captive Portal users stats */
|
||||
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
|
||||
$graphcmd .= "--start $start --end $end ";
|
||||
$graphcmd .= "--vertical-label \"Total Captive Portal Users\" ";
|
||||
$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
|
||||
$graphcmd .= "--base=1000 ";
|
||||
$graphcmd .= "--lower-limit=0 ";
|
||||
$graphcmd .= "--slope-mode ";
|
||||
$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
|
||||
$graphcmd .= "--height 200 --width 620 ";
|
||||
$graphcmd .= "DEF:\"$curif-totalusers=$rrddbpath$curdatabase:totalusers:AVERAGE\" ";
|
||||
$graphcmd .= "AREA:\"$curif-totalusers#{$colorcaptiveportalusers[0]}:$curif-totalusers\" ";
|
||||
$graphcmd .= "COMMENT:\"\\n\" ";
|
||||
$graphcmd .= "COMMENT:\"\t\t\t current\t\t average\t maximum\\n\" ";
|
||||
$graphcmd .= "COMMENT:\"Users Online\t\" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-totalusers:LAST:%8.0lf \" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-totalusers:AVERAGE:%8.0lf \" ";
|
||||
$graphcmd .= "GPRINT:\"$curif-totalusers:MAX:%8.0lf \" ";
|
||||
$graphcmd .= "COMMENT:\"\\n\" ";
|
||||
$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
|
||||
}
|
||||
else {
|
||||
$data = false;
|
||||
log_error(sprintf(gettext("Sorry we do not have data to graph for %s"),$curdatabase));
|
||||
|
||||
@ -91,6 +91,7 @@ if($_GET['act']=="new"){
|
||||
$pconfig['tlsauth_enable'] = "yes";
|
||||
$pconfig['autotls_enable'] = "yes";
|
||||
$pconfig['dh_length'] = 1024;
|
||||
$pconfig['device_mode'] = "tun";
|
||||
$pconfig['interface'] = "wan";
|
||||
$pconfig['local_port'] = openvpn_port_next('UDP');
|
||||
$pconfig['pool_enable'] = "yes";
|
||||
@ -104,6 +105,7 @@ if($_GET['act']=="edit"){
|
||||
$pconfig['mode'] = $a_server[$id]['mode'];
|
||||
$pconfig['protocol'] = $a_server[$id]['protocol'];
|
||||
$pconfig['authmode'] = $a_server[$id]['authmode'];
|
||||
$pconfig['device_mode'] = $a_server[$id]['device_mode'];
|
||||
$pconfig['interface'] = $a_server[$id]['interface'];
|
||||
if (!empty($a_server[$id]['ipaddr'])) {
|
||||
$pconfig['interface'] = $pconfig['interface'] . '|' . $a_server[$id]['ipaddr'];
|
||||
@ -304,6 +306,7 @@ if ($_POST) {
|
||||
if (!empty($pconfig['authmode']))
|
||||
$server['authmode'] = implode(",", $pconfig['authmode']);
|
||||
$server['protocol'] = $pconfig['protocol'];
|
||||
$server['device_mode'] = $pconfig['device_mode'];
|
||||
list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']);
|
||||
$server['local_port'] = $pconfig['local_port'];
|
||||
$server['description'] = $pconfig['description'];
|
||||
@ -662,6 +665,26 @@ if ($savemsg)
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vncellreq"><?=gettext("Device Mode"); ?></td>
|
||||
<td width="78%" class="vtable">
|
||||
<select name="device_mode" class="formselect">
|
||||
<?php
|
||||
foreach ($openvpn_dev_mode as $device):
|
||||
$selected = "";
|
||||
if (! empty($pconfig['device_mode'])) {
|
||||
if ($pconfig['device_mode'] == $device)
|
||||
$selected = "selected";
|
||||
} else {
|
||||
if ($device == "tun")
|
||||
$selected = "selected";
|
||||
}
|
||||
?>
|
||||
<option value="<?=$device;?>" <?=$selected;?>><?=$device;?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="22%" valign="top" class="vncellreq"><?=gettext("Interface"); ?></td>
|
||||
<td width="78%" class="vtable">
|
||||
|
||||
@ -342,7 +342,7 @@ function enable_change(enable_over) {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br><?=gettext("Hint: 10 is TEN pptp clients"); ?>
|
||||
<br><?=gettext("Hint: 10 is ten PPTP clients"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user