Merge pull request #2706 from NOYB/System_/_User_Manager_/_Groups_/_Edit_/_Add_Privileges

This commit is contained in:
Stephen Beaver 2016-03-05 08:08:55 -05:00
commit 65ebf415f0
29 changed files with 8327 additions and 9023 deletions

View File

@ -61,9 +61,9 @@ function return_dpinger_defaults() {
"latencyhigh" => "500",
"losslow" => "10",
"losshigh" => "20",
"interval" => "250",
"loss_interval" => "1250",
"time_period" => "30000",
"interval" => "500",
"loss_interval" => "2000",
"time_period" => "60000",
"alert_interval" => "1000",
"data_payload" => "0");
}

View File

@ -271,6 +271,14 @@ function interface_vlan_configure(&$vlan) {
/* invalidate interface cache */
get_interface_arr(true);
/* configure interface if assigned */
$assignedif = convert_real_interface_to_friendly_interface_name($vlanif);
if ($assignedif) {
if (isset($config['interfaces'][$assignedif]['enable'])) {
interface_configure($assignedif, true);
}
}
/* XXX: ermal -- for now leave it here at the moment it does not hurt. */
interfaces_bring_up($if);
@ -3529,10 +3537,18 @@ function interface_track6_configure($interface = "lan", $wancfg, $linkupevent =
interface_track6_6rd_configure($interface, $wancfg);
break;
case "dhcp6":
$parentrealif = get_real_interface($wancfg['track6-interface']);
$pidv6 = find_dhcp6c_process($parentrealif);
if ($pidv6) {
posix_kill($pidv6, SIGHUP);
if ($linkupevent == true) {
/*
* NOTE: Usually come here from rc.linkup calling so just call directly instead of generating event
* Instead of disrupting all other v4 configuration just restart DHCPv6 client for now
*
* XXX: Probably DHCPv6 client should handle this automagically itself?
*/
$parentrealif = get_real_interface($wancfg['track6-interface']);
$pidv6 = find_dhcp6c_process($parentrealif);
if ($pidv6) {
posix_kill($pidv6, SIGHUP);
}
}
break;
}

View File

@ -354,11 +354,6 @@ function get_package_id($package_name) {
return -1;
}
/* Keep backward compatibility since snort/suricata use this function */
function get_pkg_id($package_name) {
return get_package_id($package_name);
}
/* Return internal_name when it's defined, otherwise, returns name */
function get_package_internal_name($package_data) {
if (isset($package_data['internal_name']) && ($package_data['internal_name'] != "")) {
@ -370,7 +365,7 @@ function get_package_internal_name($package_data) {
}
// Get information about packages.
function get_pkg_info($pkgs = 'all', $info = 'all') {
function get_pkg_info($pkgs = 'all', $info = 'all', $only_local = false) {
global $g, $input_errors;
$out = '';
@ -386,7 +381,12 @@ function get_pkg_info($pkgs = 'all', $info = 'all') {
$pkgs = $g['pkg_prefix'];
}
$rc = pkg_exec("search --raw-format json-compact " . $pkgs, $out, $err);
$extra_param = "";
if ($only_local) {
$extra_param = "-U ";
}
$rc = pkg_exec("search {$extra_param}--raw-format json-compact " . $pkgs, $out, $err);
if ($rc != 0) {
update_status("\n" . gettext(
@ -452,6 +452,37 @@ function get_pkg_info($pkgs = 'all', $info = 'all') {
return $result;
}
/*
* If binary pkg is installed but post-install tasks were not
* executed yet, do it now.
* This scenario can happen when a pkg is pre-installed during
* build phase, and at this point, cannot find a running system
* to register itself in config.xml and also execute custom
* install functions
*/
function register_all_installed_packages() {
global $g, $config, $pkg_interface;
$pkg_info = get_pkg_info('all', 'all', true);
foreach ($pkg_info as $pkg) {
if (!isset($pkg['installed'])) {
continue;
}
pkg_remove_prefix($pkg['name']);
if (is_package_installed($pkg['name'])) {
continue;
}
update_status(sprintf(gettext(
"Running last steps of %s installation.") . "\n",
$pkg['name']));
install_package_xml($pkg['name']);
}
}
/*
* resync_all_package_configs() Force packages to setup their configuration and rc.d files.
* This function may also print output to the terminal indicating progress.

View File

@ -997,19 +997,6 @@ $priv_list['page-status-trafficshaper-queues']['descr'] = gettext("Allow access
$priv_list['page-status-trafficshaper-queues']['match'] = array();
$priv_list['page-status-trafficshaper-queues']['match'][] = "status_queues.php*";
$priv_list['page-status-rrdgraphs'] = array();
$priv_list['page-status-rrdgraphs']['name'] = gettext("WebCfg - Status: RRD Graphs");
$priv_list['page-status-rrdgraphs']['descr'] = gettext("Allow access to the 'Status: RRD Graphs' page.");
$priv_list['page-status-rrdgraphs']['match'] = array();
$priv_list['page-status-rrdgraphs']['match'][] = "status_rrd_graph.php*";
$priv_list['page-status-rrdgraphs']['match'][] = "status_rrd_graph_img.php*";
$priv_list['page-status-rrdgraph-settings'] = array();
$priv_list['page-status-rrdgraph-settings']['name'] = gettext("WebCfg - Status: RRD Graphs: Settings");
$priv_list['page-status-rrdgraph-settings']['descr'] = gettext("Allow access to the 'Status: RRD Graphs: Settings' page.");
$priv_list['page-status-rrdgraph-settings']['match'] = array();
$priv_list['page-status-rrdgraph-settings']['match'][] = "status_rrd_graph_settings.php*";
$priv_list['page-status-services'] = array();
$priv_list['page-status-services']['name'] = gettext("WebCfg - Status: Services");
$priv_list['page-status-services']['descr'] = gettext("Allow access to the 'Status: Services' page.");

View File

@ -1313,7 +1313,7 @@ $nginx_config .= <<<EOD
client_max_body_size 200m;
gzip on;
gzip_types text/html text/plain text/css text/javascript;
gzip_types text/plain text/css text/javascript application/x-javascript text/xml application/xml application/xml+rss application/json;
EOD;
@ -1718,7 +1718,6 @@ function system_ntp_configure($start_ntpd=true) {
unset($ts);
$ntpcfg .= "\n\n";
$ntpcfg .= "disable monitor\n"; //prevent NTP reflection attack, see https://forum.pfsense.org/index.php/topic,67189.msg389132.html#msg389132
if (!empty($config['ntpd']['clockstats']) || !empty($config['ntpd']['loopstats']) || !empty($config['ntpd']['peerstats'])) {
$ntpcfg .= "enable stats\n";
$ntpcfg .= 'statistics';
@ -1743,7 +1742,8 @@ function system_ntp_configure($start_ntpd=true) {
}
$ntpcfg .= "\n";
$ntpcfg .= "driftfile {$driftfile}\n";
/* Access restrictions */
/* Default Access restrictions */
$ntpcfg .= 'restrict default';
if (empty($config['ntpd']['kod'])) { /*note: this one works backwards */
$ntpcfg .= ' kod limited';
@ -1782,7 +1782,40 @@ function system_ntp_configure($start_ntpd=true) {
if (empty($config['ntpd']['notrap'])) { /*note: this one works backwards */
$ntpcfg .= ' notrap';
}
/* Custom Access Restrictions */
if (is_array($config['ntpd']['restrictions']) && is_array($config['ntpd']['restrictions']['row'])) {
$networkacl = $config['ntpd']['restrictions']['row'];
foreach ($networkacl as $acl) {
$ntpcfg .= "\nrestrict ";
if (is_ipaddrv6($acl['acl_network'])) {
$ntpcfg .= "-6 {$acl['acl_network']} mask " . gen_subnet_mask_v6($acl['mask']) . " ";
} elseif (is_ipaddrv4($acl['acl_network'])) {
$ntpcfg .= "{$acl['acl_network']} mask " . gen_subnet_mask($acl['mask']) . " ";
} else {
continue;
}
if (!empty($acl['kod'])) {
$ntpcfg .= ' kod limited';
}
if (!empty($acl['nomodify'])) {
$ntpcfg .= ' nomodify';
}
if (!empty($acl['noquery'])) {
$ntpcfg .= ' noquery';
}
if (!empty($acl['nopeer'])) {
$ntpcfg .= ' nopeer';
}
if (!empty($acl['noserve'])) {
$ntpcfg .= ' noserve';
}
if (!empty($acl['notrap'])) {
$ntpcfg .= ' notrap';
}
}
}
$ntpcfg .= "\n";
/* End Custom Access Restrictions */
/* A leapseconds file is really only useful if this clock is stratum 1 */
$ntpcfg .= "\n";

View File

@ -425,6 +425,16 @@ function gen_subnet_mask($bits) {
return long2ip(gen_subnet_mask_long($bits));
}
/* Convert a prefix length to an IPv6 address-like mask notation. Very rare but at least ntp needs it. See #4463 */
function gen_subnet_mask_v6($bits) {
/* Binary representation of the prefix length */
$bin = str_repeat('1', $bits);
/* Pad right with zeroes to reach the full address length */
$bin = str_pad($bin, 128, '0', STR_PAD_RIGHT);
/* Convert back to an IPv6 address style notation */
return Net_IPv6::_bin2Ip($bin);
}
/* Convert long int to IPv4 address
Returns '' if not valid IPv4 (including if any bits >32 are non-zero) */
function long2ip32($ip) {

View File

@ -474,6 +474,7 @@ charon {
init_limit_half_open = 1000
install_routes = no
load_modular = yes
ignore_acquire_ts = yes
{$i_dont_care_about_security_and_use_aggressive_mode_psk}
{$accept_unencrypted}
cisco_unity = {$unity_enabled}

View File

@ -854,6 +854,9 @@
/usr/local/www/services_usermanager.php
/usr/local/www/shortcuts/pkg_upnp.php
/usr/local/www/sortable/sortable.min.js
/usr/local/www/status_rrd_graph.php
/usr/local/www/status_rrd_graph_img.php
/usr/local/www/status_rrd_graph_settings.php
/usr/local/www/status_slbd_pool.php
/usr/local/www/status_slbd_vs.php
/usr/local/www/system_advanced.php

View File

@ -31,6 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
require_once("pkg-utils.inc");
function rescue_detect_keypress() {
// How long do you want the script to wait before moving on (in seconds)
$timeout=9;
@ -411,7 +413,6 @@ if (file_exists("/sbin/shutdown.old")) {
/* Resync / Reinstall packages if need be */
if (file_exists('/conf/needs_package_sync') &&
($g['platform'] == $g['product_name'] || $g['platform'] == "nanobsd")) {
require_once("pkg-utils.inc");
mark_subsystem_dirty('packagelock');
if (package_reinstall_all()) {
@unlink('/conf/needs_package_sync');
@ -419,6 +420,9 @@ if (file_exists('/conf/needs_package_sync') &&
clear_subsystem_dirty('packagelock');
}
/* Detect installed binary pkgs that are not registered in the system */
register_all_installed_packages();
/* Give syslogd a kick after everything else has been initialized, otherwise it can occasionally
fail to route syslog messages properly on both IPv4 and IPv6 */
system_syslogd_start();

View File

@ -49,6 +49,11 @@ if ($argc == 1) {
exit;
}
/* If PHP is not running, silently abort and run registration during boot */
if (!isvalidpid('/var/run/php-fpm.pid')) {
exit;
}
$pkg = '';
$when = '';

File diff suppressed because it is too large Load Diff

View File

@ -421,6 +421,7 @@ textarea {
.bs-callout-info h4 {
color: #01579B;
}
/* D3 Styles */
@ -432,7 +433,7 @@ g.nv-axis text, g.nv-legend text {
fill: #FFFFFF;
}
.nvd3 .nv-axis line, .nvd3 .nv-axis path{
.nvd3 .nv-axis line, .nvd3 .nv-axis path {
fill: #616161 !important;
stroke: #616161 !important;
}

View File

@ -253,7 +253,7 @@ print $form;
$info = $res[$i]['dst'];
if ($res[$i]['dst-orig'])
$info .= " (" . $res[$i]['dst-orig'] . ")";
$info .= " <- ";
$info .= " &lt;- ";
$info .= $res[$i]['src'];
if ($res[$i]['src-orig'])
$info .= " (" . $res[$i]['src-orig'] . ")";

View File

@ -338,7 +338,6 @@ if ($g['platform'] == $g['product_name']) {
}
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
$status_menu[] = array(gettext("Services"), "/status_services.php");
$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");

View File

@ -452,6 +452,15 @@ if ($_POST['apply']) {
if (isset($config['interfaces'][$ifapply]['enable'])) {
interface_bring_down($ifapply, false, $ifcfgo);
interface_configure($ifapply, true);
if ($config['interfaces'][$ifapply]['ipaddrv6'] == "track6") {
/* call interface_track6_configure with linkup true so
IPv6 IPs are added back. dhcp6c needs a HUP. Can't
just call interface_configure with linkup true as
that skips bridge membership addition.
*/
$wancfg = $config['interfaces'][$ifapply];
interface_track6_configure($ifapply, $wancfg, true);
}
} else {
interface_bring_down($ifapply, true, $ifcfgo);
if (isset($config['dhcpd'][$ifapply]['enable']) ||

View File

@ -191,7 +191,7 @@ if (is_array($config['dhcpdv6'][$if])) {
if ($config['interfaces'][$if]['ipaddrv6'] == 'track6') {
$trackifname = $config['interfaces'][$if]['track6-interface'];
$trackcfg = $config['interfaces'][$trackifname];
$ifcfgsn = 64 - $trackcfg['dhcp6-ia-pd-len'];
$ifcfgsn = "64";
$ifcfgip = '::';
$str_help_mask = dhcpv6_pd_str_help($ifcfgsn);

View File

@ -157,42 +157,6 @@ if ($_POST) {
unset($config['ntpd']['peerstats']);
}
if (empty($_POST['kod'])) {
$config['ntpd']['kod'] = 'on';
} elseif (isset($config['ntpd']['kod'])) {
unset($config['ntpd']['kod']);
}
if (empty($_POST['nomodify'])) {
$config['ntpd']['nomodify'] = 'on';
} elseif (isset($config['ntpd']['nomodify'])) {
unset($config['ntpd']['nomodify']);
}
if (!empty($_POST['noquery'])) {
$config['ntpd']['noquery'] = $_POST['noquery'];
} elseif (isset($config['ntpd']['noquery'])) {
unset($config['ntpd']['noquery']);
}
if (!empty($_POST['noserve'])) {
$config['ntpd']['noserve'] = $_POST['noserve'];
} elseif (isset($config['ntpd']['noserve'])) {
unset($config['ntpd']['noserve']);
}
if (empty($_POST['nopeer'])) {
$config['ntpd']['nopeer'] = 'on';
} elseif (isset($config['ntpd']['nopeer'])) {
unset($config['ntpd']['nopeer']);
}
if (empty($_POST['notrap'])) {
$config['ntpd']['notrap'] = 'on';
} elseif (isset($config['ntpd']['notrap'])) {
unset($config['ntpd']['notrap']);
}
if ((empty($_POST['statsgraph'])) == (isset($config['ntpd']['statsgraph']))) {
$enable_rrd_graphing = true;
}
@ -264,6 +228,7 @@ if ($savemsg) {
$tab_array = array();
$tab_array[] = array(gettext("Settings"), true, "services_ntpd.php");
$tab_array[] = array(gettext("ACLs"), false, "services_ntpd_acls.php");
$tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php");
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);
@ -397,61 +362,6 @@ $section->addInput(new Form_Checkbox(
$pconfig['peerstats']
));
// Access restrictions section
$btnadvrestr = new Form_Button(
'btnadvrestr',
'Advanced'
);
$btnadvrestr->removeClass('btn-primary')->addClass('btn-default btn-sm');
$section->addInput(new Form_StaticText(
'Access Restrictions',
$btnadvrestr
))->setHelp('These options control access to NTP server.');
$section->addInput(new Form_Checkbox(
'kod',
null,
'Enable Kiss-o\'-death packets (default: checked).',
!$pconfig['kod']
));
$section->addInput(new Form_Checkbox(
'nomodify',
null,
'Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: checked).',
!$pconfig['nomodify']
));
$section->addInput(new Form_Checkbox(
'noquery',
null,
'Disable ntpq and ntpdc queries (default: unchecked).',
$pconfig['noquery']
));
$section->addInput(new Form_Checkbox(
'noserve',
null,
'Disable all except ntpq and ntpdc queries (default: unchecked).',
$pconfig['noserve']
));
$section->addInput(new Form_Checkbox(
'nopeer',
null,
'Deny packets that attempt a peer association (default: checked).',
!$pconfig['nopeer']
));
$section->addInput(new Form_Checkbox(
'notrap',
null,
'Deny mode 6 control message trap service (default: checked).',
!$pconfig['notrap']
))->addClass('advrestrictions');
// Leap seconds section
$btnleap = new Form_Button(
'btnleap',
@ -479,6 +389,7 @@ $section->addInput(new Form_Input(
))->addClass('btn-default');
$form->add($section);
print($form);
?>
@ -507,16 +418,6 @@ events.push(function() {
// Make the clear button a plain button, not a submit button
$('#btnadvrestr').prop('type','button');
// On click, show the controls in the restrictions section
$("#btnadvrestr").click(function() {
hideCheckbox('kod', false);
hideCheckbox('nomodify', false);
hideCheckbox('noquery', false);
hideCheckbox('noserve', false);
hideCheckbox('nopeer', false);
hideCheckbox('notrap', false);
});
// Make the btnleap button a plain button, not a submit button
$('#btnleap').prop('type','button');
@ -530,12 +431,6 @@ events.push(function() {
hideCheckbox('clockstats', true);
hideCheckbox('loopstats', true);
hideCheckbox('peerstats', true);
hideCheckbox('kod', true);
hideCheckbox('nomodify', true);
hideCheckbox('noquery', true);
hideCheckbox('noserve', true);
hideCheckbox('nopeer', true);
hideCheckbox('notrap', true);
hideInput('leaptext', true);
hideInput('leapfile', true);

View File

@ -0,0 +1,347 @@
<?php
/*
services_ntpd_acls.php
*/
/* ====================================================================
* Copyright (c) 2004-2016 Electric Sheep Fencing, LLC. All rights reserved.
* Copyright (c) 2013 Dagorlad
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgment:
* "This product includes software developed by the pfSense Project
* for use in the pfSense software distribution. (http://www.pfsense.org/).
*
* 4. The names "pfSense" and "pfSense Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* coreteam@pfsense.org.
*
* 5. Products derived from this software may not be called "pfSense"
* nor may "pfSense" appear in their names without prior written
* permission of the Electric Sheep Fencing, LLC.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
*
* "This product includes software developed by the pfSense Project
* for use in the pfSense software distribution (http://www.pfsense.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
##|+PRIV
##|*IDENT=page-services-ntpd-acls
##|*NAME=Services: NTP ACL Settings
##|*DESCR=Allow access to the 'Services: NTP ACL Settings' page.
##|*MATCH=services_ntpd_acls.php*
##|-PRIV
define('NUMACLS', 50); // The maximum number of configurable ACLs
require("guiconfig.inc");
require_once('rrd.inc');
require_once("shaper.inc");
if (!is_array($config['ntpd'])) {
$config['ntpd'] = array();
}
if (is_array($config['ntpd']['restrictions']) && is_array($config['ntpd']['restrictions']['row'])) {
$networkacl = $config['ntpd']['restrictions']['row'];
} else {
$networkacl = array('0' => array('acl_network' => '', 'mask' => ''));
}
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
for ($x = 0; $x < NUMACLS; $x++) {
if (isset($pconfig["acl_network{$x}"])) {
$networkacl[$x] = array();
$networkacl[$x]['acl_network'] = $pconfig["acl_network{$x}"];
$networkacl[$x]['mask'] = $pconfig["mask{$x}"];
/* ACL Flags */
if (!empty($pconfig["kod{$x}"])) {
$networkacl[$x]['kod'] = $pconfig["kod{$x}"];
} elseif (isset($networkacl[$x]['kod'])) {
unset($networkacl[$x]['kod']);
}
if (!empty($pconfig["nomodify{$x}"])) {
$networkacl[$x]['nomodify'] = $pconfig["nomodify{$x}"];
} elseif (isset($networkacl[$x]['nomodify'])) {
unset($networkacl[$x]['nomodify']);
}
if (!empty($pconfig["noquery{$x}"])) {
$networkacl[$x]['noquery'] = $pconfig["noquery{$x}"];
} elseif (isset($networkacl[$x]['noquery'])) {
unset($networkacl[$x]['noquery']);
}
if (!empty($pconfig["noserve{$x}"])) {
$networkacl[$x]['noserve'] = $pconfig["noserve{$x}"];
} elseif (isset($networkacl[$x]['noserve'])) {
unset($networkacl[$x]['noserve']);
}
if (!empty($pconfig["nopeer{$x}"])) {
$networkacl[$x]['nopeer'] = $pconfig["nopeer{$x}"];
} elseif (isset($networkacl[$x]['nopeer'])) {
unset($networkacl[$x]['nopeer']);
}
if (!empty($pconfig["notrap{$x}"])) {
$networkacl[$x]['notrap'] = $pconfig["notrap{$x}"];
} elseif (isset($networkacl[$x]['notrap'])) {
unset($networkacl[$x]['notrap']);
}
/* End ACL Flags */
if (!is_ipaddr($networkacl[$x]['acl_network'])) {
$input_errors[] = gettext("You must enter a valid IP address for each row under Networks.");
}
if (is_ipaddr($networkacl[$x]['acl_network'])) {
if (!is_subnet($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask'])) {
$input_errors[] = gettext("You must enter a valid IPv4 netmask for each IPv4 row under Networks.");
}
} else if (function_exists("is_ipaddrv6")) {
if (!is_ipaddrv6($networkacl[$x]['acl_network'])) {
$input_errors[] = gettext("You must enter a valid IPv6 address for {$networkacl[$x]['acl_network']}.");
} else if (!is_subnetv6($networkacl[$x]['acl_network']."/".$networkacl[$x]['mask'])) {
$input_errors[] = gettext("You must enter a valid IPv6 netmask for each IPv6 row under Networks.");
}
} else {
$input_errors[] = gettext("You must enter a valid IP address for each row under Networks.");
}
} else if (isset($networkacl[$x])) {
unset($networkacl[$x]);
}
}
if (!$input_errors) {
/* Default Access Restrictions */
if (empty($_POST['kod'])) {
$config['ntpd']['kod'] = 'on';
} elseif (isset($config['ntpd']['kod'])) {
unset($config['ntpd']['kod']);
}
if (empty($_POST['nomodify'])) {
$config['ntpd']['nomodify'] = 'on';
} elseif (isset($config['ntpd']['nomodify'])) {
unset($config['ntpd']['nomodify']);
}
if (!empty($_POST['noquery'])) {
$config['ntpd']['noquery'] = $_POST['noquery'];
} elseif (isset($config['ntpd']['noquery'])) {
unset($config['ntpd']['noquery']);
}
if (!empty($_POST['noserve'])) {
$config['ntpd']['noserve'] = $_POST['noserve'];
} elseif (isset($config['ntpd']['noserve'])) {
unset($config['ntpd']['noserve']);
}
if (empty($_POST['nopeer'])) {
$config['ntpd']['nopeer'] = 'on';
} elseif (isset($config['ntpd']['nopeer'])) {
unset($config['ntpd']['nopeer']);
}
if (empty($_POST['notrap'])) {
$config['ntpd']['notrap'] = 'on';
} elseif (isset($config['ntpd']['notrap'])) {
unset($config['ntpd']['notrap']);
}
/* End Default Access Restrictions */
$config['ntpd']['restrictions']['row'] = array();
foreach ($networkacl as $acl) {
$config['ntpd']['restrictions']['row'][] = $acl;
}
write_config("Updated NTP ACL Settings");
$retval = 0;
$retval = system_ntp_configure();
$savemsg = get_std_save_message($retval);
}
}
$pconfig = &$config['ntpd'];
$pgtitle = array(gettext("Services"), gettext("NTP"), gettext("ACLs"));
$shortcut_section = "ntp";
include("head.inc");
if ($input_errors) {
print_input_errors($input_errors);
}
if ($savemsg) {
print_info_box($savemsg, 'success');
}
$tab_array = array();
$tab_array[] = array(gettext("Settings"), false, "services_ntpd.php");
$tab_array[] = array(gettext("ACLs"), true, "services_ntpd_acls.php");
$tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php");
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);
$form = new Form;
$section = new Form_Section('Default Access Restrictions');
$section->addInput(new Form_Checkbox(
'kod',
'Kiss-o\'-death',
'Enable KOD packets.',
!$pconfig['kod']
));
$section->addInput(new Form_Checkbox(
'nomodify',
"Modifications",
'Deny run-time Configuration (nomodify) by ntpq and ntpdc.',
!$pconfig['nomodify']
));
$section->addInput(new Form_Checkbox(
'noquery',
'Queries',
'Disable ntpq and ntpdc queries (noquery).',
$pconfig['noquery']
));
$section->addInput(new Form_Checkbox(
'noserve',
'Service',
'Disable all except ntpq and ntpdc queries (noserve).',
$pconfig['noserve']
));
$section->addInput(new Form_Checkbox(
'nopeer',
'Peer Association',
'Deny packets that attempt a peer association (nopeer).',
!$pconfig['nopeer']
));
$section->addInput(new Form_Checkbox(
'notrap',
'Trap Service',
'Deny mode 6 control message trap service (notrap).',
!$pconfig['notrap']
));
/* End Default Restrictions*/
$form->add($section);
$section = new Form_Section('Custom Access Restrictions');
$numrows = count($networkacl) - 1;
$counter = 0;
foreach ($networkacl as $item) {
$group = new Form_Group($counter == 0 ? 'Networks':'');
$group->add(new Form_IpAddress(
'acl_network' . $counter,
null,
$item['acl_network']
))->addMask('mask' . $counter, $item['mask'])->setWidth(3)->setHelp(($counter == $numrows) ? 'Network/mask':null);
$group->add(new Form_Checkbox(
'kod' . $counter,
null,
null,
$item['kod']
))->setHelp('KOD');
$group->add(new Form_Checkbox(
'nomodify' . $counter,
null,
null,
$item['nomodify']
))->setHelp('nomodify');
$group->add(new Form_Checkbox(
'noquery' . $counter,
null,
null,
$item['noquery']
))->setHelp('noquery');
$group->add(new Form_Checkbox(
'noserve' . $counter,
null,
null,
$item['noserve']
))->setHelp('noserve');
$group->add(new Form_Checkbox(
'nopeer' . $counter,
null,
null,
$item['nopeer']
))->setHelp('nopeer');
$group->add(new Form_Checkbox(
'notrap' . $counter,
null,
null,
$item['notrap']
))->setHelp('notrap');
$group->add(new Form_Button(
'deleterow' . $counter,
'Delete'
))->removeClass('btn-primary')->addClass('btn-warning');
$group->addClass('repeatable');
$section->add($group);
$counter++;
}
$section->addInput(new Form_Button(
'addrow',
'Add'
))->removeClass('btn-primary')->addClass('btn-success');
$form->add($section);
print($form);
?>
<script type="text/javascript">
//<![CDATA[
// If this variable is declared, any help text will not be deleted when rows are added
// IOW the help text will appear on every row
retainhelp = true;
</script>
<?php include("foot.inc");

View File

@ -228,6 +228,7 @@ include("head.inc");
$tab_array = array();
$tab_array[] = array(gettext("Settings"), false, "services_ntpd.php");
$tab_array[] = array(gettext("ACLs"), false, "services_ntpd_acls.php");
$tab_array[] = array(gettext("Serial GPS"), true, "services_ntpd_gps.php");
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);

View File

@ -147,6 +147,7 @@ if ($savemsg) {
$tab_array = array();
$tab_array[] = array(gettext("Settings"), false, "services_ntpd.php");
$tab_array[] = array(gettext("ACLs"), false, "services_ntpd_acls.php");
$tab_array[] = array(gettext("Serial GPS"), false, "services_ntpd_gps.php");
$tab_array[] = array(gettext("PPS"), true, "services_ntpd_pps.php");
display_top_tabs($tab_array);

View File

@ -147,7 +147,7 @@ $ipsecconnected = array();
if (is_array($status)) {
foreach ($status as $ikeid => $ikesa) {
$con_id = substr($ikeid, 3);
$con_id = substr($ikeid, 3);
if ($ikesa['version'] == 1) {
$ph1idx = substr($con_id, 0, strrpos(substr($con_id, 0, -1), '00'));

View File

@ -1,801 +0,0 @@
<?php
/*
status_rrd_graph.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
* Copyright (c) 2007 Seth Mos <seth.mos@dds.nl>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgment:
* "This product includes software developed by the pfSense Project
* for use in the pfSense software distribution. (http://www.pfsense.org/).
*
* 4. The names "pfSense" and "pfSense Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* coreteam@pfsense.org.
*
* 5. Products derived from this software may not be called "pfSense"
* nor may "pfSense" appear in their names without prior written
* permission of the Electric Sheep Fencing, LLC.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
*
* "This product includes software developed by the pfSense Project
* for use in the pfSense software distribution (http://www.pfsense.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
##|+PRIV
##|*IDENT=page-status-rrdgraphs
##|*NAME=Status: RRD Graphs
##|*DESCR=Allow access to the 'Status: RRD Graphs' page.
##|*MATCH=status_rrd_graph.php*
##|*MATCH=status_rrd_graph_img.php*
##|-PRIV
require("guiconfig.inc");
require_once("filter.inc");
require("shaper.inc");
require_once("rrd.inc");
global $rrd_graph_list, $rrd_period_list, $rrd_graph_length_list, $rrd_style_list;
unset($input_errors);
/* if the rrd graphs are not enabled redirect to settings page */
if (!isset($config['rrd']['enable'])) {
header("Location: status_rrd_graph_settings.php");
}
$home = getcwd();
$rrddbpath = "/var/db/rrd/";
chdir($rrddbpath);
$databases = glob("*.rrd");
chdir($home);
if ($_GET['cat']) {
$curcat = htmlspecialchars($_GET['cat']);
} else {
if (!empty($config['rrd']['category'])) {
$curcat = $config['rrd']['category'];
} else {
$curcat = "system";
}
}
if ($_POST['cat']) {
$curcat = htmlspecialchars($_POST['cat']);
}
if ($_GET['zone']) {
$curzone = $_GET['zone'];
} else {
$curzone = '';
}
if ($_POST['period']) {
$curperiod = $_POST['period'];
} else {
if (!empty($config['rrd']['period'])) {
$curperiod = $config['rrd']['period'];
} else {
$curperiod = "absolute";
}
}
if ($_POST['style']) {
$curstyle = $_POST['style'];
} else {
if (!empty($config['rrd']['style'])) {
$curstyle = $config['rrd']['style'];
} else {
$curstyle = "absolute";
}
}
if ($_POST['option']) {
$curoption = $_POST['option'];
} else {
switch ($curcat) {
case "system":
$curoption = "processor";
break;
case "queues":
$curoption = "queues";
break;
case "queuedrops":
$curoption = "queuedrops";
break;
case "quality":
foreach ($databases as $database) {
if (preg_match("/[-]quality\.rrd/i", $database)) {
/* pick off the 1st database we find that matches the quality graph */
$name = explode("-", $database);
$curoption = "$name[0]";
continue 2;
}
}
case "wireless":
foreach ($databases as $database) {
if (preg_match("/[-]wireless\.rrd/i", $database)) {
/* pick off the 1st database we find that matches the wireless graph */
$name = explode("-", $database);
$curoption = "$name[0]";
continue 2;
}
}
case "cellular":
foreach ($databases as $database) {
if (preg_match("/[-]cellular\.rrd/i", $database)) {
/* pick off the 1st database we find that matches the celullar graph */
$name = explode("-", $database);
$curoption = "$name[0]";
continue 2;
}
}
case "vpnusers":
foreach ($databases as $database) {
if (preg_match("/[-]vpnusers\.rrd/i", $database)) {
/* pick off the 1st database we find that matches the VPN graphs */
$name = explode("-", $database);
$curoption = "$name[0]";
continue 2;
}
}
case "dhcpd":
foreach ($databases as $database) {
if (preg_match("/[-]dhcpd\.rrd/i", $database)) {
/* pick off the 1st database we find that matches the dhcpd graph */
$name = explode("-", $database);
$curoption = "$name[0]";
continue 2;
}
}
case "captiveportal":
$curoption = "allgraphs";
break;
case "ntpd":
if (isset($config['ntpd']['statsgraph'])) {
$curoption = "allgraphs";
} else {
$curoption = "processor";
$curcat = "system";
}
break;
default:
$curoption = "wan";
break;
}
}
$now = time();
if ($curcat == "custom") {
if (is_numeric($_GET['start'])) {
if ($start < ($now - (3600 * 24 * 365 * 5))) {
$start = $now - (8 * 3600);
}
$start = $_POST['start'];
} else if ($_POST['start']) {
$start = strtotime($_POST['start']);
if ($start === FALSE || $start === -1) {
$input_errors[] = gettext("Invalid start date/time:") . " '{$_POST['start']}'";
$start = $now - (8 * 3600);
}
} else {
$start = $now - (8 * 3600);
}
}
if (is_numeric($_GET['end'])) {
$end = $_GET['end'];
} else if ($_GET['end']) {
$end = strtotime($_GET['end']);
if ($end === FALSE || $end === -1) {
$input_errors[] = gettext("Invalid end date/time:") . " '{$_POST['end']}'";
$end = $now;
}
} else {
$end = $now;
}
/* this should never happen */
if ($end < $start) {
log_error(sprintf(gettext("start %d is smaller than end %d"), $start, $end));
$end = $now;
}
$seconds = $end - $start;
/* sort names reverse so WAN comes first */
rsort($databases);
/* these boilerplate databases are required for the other menu choices */
$dbheader = array("allgraphs-traffic.rrd",
"allgraphs-quality.rrd",
"allgraphs-wireless.rrd",
"allgraphs-cellular.rrd",
"allgraphs-vpnusers.rrd",
"allgraphs-packets.rrd",
"system-allgraphs.rrd",
"system-throughput.rrd",
"outbound-quality.rrd",
"outbound-packets.rrd",
"outbound-traffic.rrd");
/* additional menu choices for the custom tab */
$dbheader_custom = array("system-throughput.rrd");
foreach ($databases as $database) {
if (stristr($database, "-wireless")) {
$wireless = true;
}
if (stristr($database, "-queues")) {
$queues = true;
}
if (stristr($database, "-cellular") && !empty($config['ppps'])) {
$cellular = true;
}
if (stristr($database, "-vpnusers")) {
$vpnusers = true;
}
if (stristr($database, "captiveportal-") && is_array($config['captiveportal'])) {
$captiveportal = true;
}
if (stristr($database, "ntpd") && isset($config['ntpd']['statsgraph'])) {
$ntpd = true;
}
if (stristr($database, "-dhcpd") && is_array($config['dhcpd'])) {
$dhcpd = true;
}
}
/* append the existing array to the header */
$ui_databases = array_merge($dbheader, $databases);
$custom_databases = array_merge($dbheader_custom, $databases);
switch ($curcat) {
case "vpnusers":
$curcattext = gettext("VPN Users");
break;
case "captiveportal":
$curcattext = gettext("Captive Portal");
break;
case "ntpd":
$curcattext = gettext("NTP");
break;
case "dhcpd":
$curcattext = gettext("DHCP Server");
break;
case "queuedrops":
$curcattext = gettext("QueueDrops");
break;
default:
$curcattext = ucfirst($curcat);
break;
}
$pgtitle = array(gettext("Status"), gettext("RRD Graphs"), gettext($curcattext));
/* Load all CP zones */
if ($captiveportal && is_array($config['captiveportal'])) {
$cp_zones_tab_array = array();
foreach ($config['captiveportal'] as $cpkey => $cp) {
if (!isset($cp['enable'])) {
continue;
}
if ($curzone == '') {
$tabactive = true;
$curzone = $cpkey;
} elseif ($curzone == $cpkey) {
$tabactive = true;
} else {
$tabactive = false;
}
$cp_zones_tab_array[] = array($cp['zone'], $tabactive, "status_rrd_graph.php?cat=captiveportal&zone=$cpkey");
}
}
function get_dates($curperiod, $graph) {
global $rrd_graph_length_list;
$now = time();
$end = $now;
if ($curperiod == "absolute") {
$start = $end - $rrd_graph_length_list[$graph];
} else {
$curyear = date('Y', $now);
$curmonth = date('m', $now);
$curweek = date('W', $now);
$curweekday = date('N', $now) - 1; // We want to start on monday
$curday = date('d', $now);
$curhour = date('G', $now);
switch ($curperiod) {
case "previous":
$offset = -1;
break;
default:
$offset = 0;
}
switch ($graph) {
case "eighthour":
if ($curhour < 24) {
$starthour = 16;
}
if ($curhour < 16) {
$starthour = 8;
}
if ($curhour < 8) {
$starthour = 0;
}
switch ($offset) {
case 0:
$houroffset = $starthour;
break;
default:
$houroffset = $starthour + ($offset * 8);
break;
}
$start = mktime($houroffset, 0, 0, $curmonth, $curday, $curyear);
if ($offset != 0) {
$end = mktime(($houroffset + 8), 0, 0, $curmonth, $curday, $curyear);
}
break;
case "day":
$start = mktime(0, 0, 0, $curmonth, ($curday + $offset), $curyear);
if ($offset != 0) {
$end = mktime(0, 0, 0, $curmonth, (($curday + $offset) + 1), $curyear);
}
break;
case "week":
switch ($offset) {
case 0:
$weekoffset = 0;
break;
default:
$weekoffset = ($offset * 7) - 7;
break;
}
$start = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset), $curyear);
if ($offset != 0) {
$end = mktime(0, 0, 0, $curmonth, (($curday - $curweekday) + $weekoffset + 7), $curyear);
}
break;
case "month":
$start = mktime(0, 0, 0, ($curmonth + $offset), 0, $curyear);
if ($offset != 0) {
$end = mktime(0, 0, 0, (($curmonth + $offset) + 1), 0, $curyear);
}
break;
case "quarter":
$start = mktime(0, 0, 0, (($curmonth - 2) + $offset), 0, $curyear);
if ($offset != 0) {
$end = mktime(0, 0, 0, (($curmonth + $offset) + 1), 0, $curyear);
}
break;
case "year":
$start = mktime(0, 0, 0, 1, 0, ($curyear + $offset));
if ($offset != 0) {
$end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
}
break;
case "fouryear":
$start = mktime(0, 0, 0, 1, 0, (($curyear - 3) + $offset));
if ($offset != 0) {
$end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
}
break;
}
}
// echo "start $start ". date('l jS \of F Y h:i:s A', $start) .", end $end ". date('l jS \of F Y h:i:s A', $end) ."<br />";
$dates = array();
$dates['start'] = $start;
$dates['end'] = $end;
return $dates;
}
function make_tabs() {
global $curcat, $queues, $wireless, $cellular, $vpnusers, $captiveportal, $dhcpd, $ntpd;
$tab_array = array();
$tab_array[] = array(gettext("System"), ($curcat == "system"), "status_rrd_graph.php?cat=system");
$tab_array[] = array(gettext("Traffic"), ($curcat == "traffic"), "status_rrd_graph.php?cat=traffic");
$tab_array[] = array(gettext("Packets"), ($curcat == "packets"), "status_rrd_graph.php?cat=packets");
$tab_array[] = array(gettext("Quality"), ($curcat == "quality"), "status_rrd_graph.php?cat=quality");
if ($queues) {
$tab_array[] = array(gettext("Queues"), ($curcat == "queues"), "status_rrd_graph.php?cat=queues");
$tab_array[] = array(gettext("QueueDrops"), ($curcat == "queuedrops"), "status_rrd_graph.php?cat=queuedrops");
}
if ($wireless) {
$tab_array[] = array(gettext("Wireless"), ($curcat == "wireless"), "status_rrd_graph.php?cat=wireless");
}
if ($cellular) {
$tab_array[] = array(gettext("Cellular"), ($curcat == "cellular"), "status_rrd_graph.php?cat=cellular");
}
if ($vpnusers) {
$tab_array[] = array(gettext("VPN Users"), ($curcat == "vpnusers"), "status_rrd_graph.php?cat=vpnusers");
}
if ($captiveportal) {
$tab_array[] = array(gettext("Captive Portal"), ($curcat == "captiveportal"), "status_rrd_graph.php?cat=captiveportal");
}
if ($ntpd) {
$tab_array[] = array("NTP", ($curcat == "ntpd"), "status_rrd_graph.php?cat=ntpd");
}
if ($dhcpd) {
$tab_array[] = array(gettext("DHCP Server"), ($curcat == "dhcpd"), "status_rrd_graph.php?cat=dhcpd");
}
$tab_array[] = array(gettext("Custom"), ($curcat == "custom"), "status_rrd_graph.php?cat=custom");
$tab_array[] = array(gettext("Settings"), ($curcat == "settings"), "status_rrd_graph_settings.php");
return($tab_array);
}
// Create the selectable list of graphs
function build_options() {
global $curcat, $custom_databases, $ui_databases;
$optionslist = array();
if ($curcat == "custom") {
foreach ($custom_databases as $db => $database) {
$optionc = explode("-", $database);
$friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc[0]));
if (empty($friendly)) {
$friendly = $optionc[0];
}
$search = array("-", ".rrd", $optionc[0]);
$replace = array(" :: ", "", $friendly);
$prettyprint = ucwords(str_replace($search, $replace, $database));
$optionslist[$database] = htmlspecialchars($prettyprint);
}
}
foreach ($ui_databases as $db => $database) {
if (!preg_match("/($curcat)/i", $database)) {
continue;
}
if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $database)) {
continue;
}
$optionc = explode("-", $database);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
switch ($curcat) {
case "captiveportal":
$optionc = str_replace($search, $replace, $optionc[2]);
$prettyprint = ucwords(str_replace($search, $replace, $optionc));
$optionslist[$optionc] = htmlspecialchars($prettyprint);
break;
case "system":
$optionc = str_replace($search, $replace, $optionc[1]);
$prettyprint = ucwords(str_replace($search, $replace, $optionc));
$optionslist[$optionc] = htmlspecialchars($prettyprint);
break;
default:
/* Deduce an interface if possible and use the description */
$optionc = "$optionc[0]";
$friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc));
if (empty($friendly)) {
$friendly = $optionc;
}
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
$prettyprint = ucwords(str_replace($search, $replace, $friendly));
$optionslist[$optionc] = htmlspecialchars($prettyprint);
}
}
return($optionslist);
}
include("head.inc");
display_top_tabs(make_tabs());
if ($input_errors && count($input_errors)) {
print_input_errors($input_errors);
}
$form = new Form(false);
$section = new Form_Section('Graph Settings');
$group = new Form_Group('Options');
$group->add(new Form_Select(
'option',
'Graphs',
$curoption,
build_options()
))->setHelp('Graph');
$group->add(new Form_Select(
'style',
'Style',
$curstyle,
$rrd_style_list
))->setHelp('Style');
$group->add(new Form_Select(
'period',
'Period',
$curperiod,
$rrd_period_list
))->setHelp('Period');
if ($curcat == 'custom') {
$group->setHelp('Any changes to these options may not take affect until the next auto-refresh.');
}
$section->add($group);
if ($curcat == 'custom') {
$section->addInput(new Form_Input(
'cat',
null,
'hidden',
'custom'
));
$tz = date_default_timezone_get();
$tz_msg = gettext("Enter date and/or time. Current timezone:") . " $tz";
$start_fmt = strftime("%m/%d/%Y %H:%M:%S", $start);
$end_fmt = strftime("%m/%d/%Y %H:%M:%S", $end);
$group = new Form_Group('');
$group->add(new Form_Input(
'start',
'Start',
'datetime',
$start_fmt
))->setHelp('Start');
$group->add(new Form_Input(
'end',
'End',
'datetime',
$end_fmt
))->setHelp('End');
if ($curcat != 'custom') {
$group->setHelp('Any changes to these options may not take affect until the next auto-refresh');
}
$section->add($group);
$form->add($section);
print($form);
$curdatabase = $curoption;
$graph = "custom-$curdatabase";
if (in_array($curdatabase, $custom_databases)) {
$id = "{$graph}-{$curoption}-{$curdatabase}";
$id = preg_replace('/\./', '_', $id);
?>
<div class="panel panel-default">
<img class="img-responsive center-block" id="<?=$id?>" alt="<?=$prettydb?> <?=gettext("Graph");?>" src="status_rrd_graph_img.php?start=<?=$start?>&amp;end=<?=$end?>&amp;database=<?=$curdatabase?>&amp;style=<?=$curstyle?>&amp;graph=<?=$graph?>" />
</div>
<?php
}
} else {
$form->add($section);
print($form);
foreach ($rrd_graph_list as $graph) {
/* check which databases are valid for our category */
foreach ($ui_databases as $curdatabase) {
if (!preg_match("/($curcat)/i", $curdatabase)) {
continue;
}
if (($curcat == "captiveportal") && !empty($curzone) && !preg_match("/captiveportal-{$curzone}/i", $curdatabase)) {
continue;
}
$optionc = explode("-", $curdatabase);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
switch ($curoption) {
case "outbound":
/* make sure we do not show the placeholder databases in the outbound view */
if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
/* only show interfaces with a gateway */
$optionc = "$optionc[0]";
if (!interface_has_gateway($optionc)) {
if (!isset($gateways_arr)) {
if (preg_match("/quality/i", $curdatabase)) {
$gateways_arr = return_gateways_array();
} else {
$gateways_arr = array();
}
}
$found_gateway = false;
foreach ($gateways_arr as $gw) {
if ($gw['name'] == $optionc) {
$found_gateway = true;
break;
}
}
if (!$found_gateway) {
continue 2;
}
}
if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
continue 2;
}
break;
case "allgraphs":
/* make sure we do not show the placeholder databases in the all view */
if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
break;
default:
/* just use the name here */
if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
continue 2;
}
}
if (in_array($curdatabase, $ui_databases)) {
$id = "{$graph}-{$curoption}-{$curdatabase}";
$id = preg_replace('/\./', '_', $id);
$dates = get_dates($curperiod, $graph);
$start = $dates['start'];
$end = $dates['end'];
?>
<div class="panel panel-default">
<img class="img-responsive center-block" id="<?=$id?>" alt="<?=$prettydb?> Graph" src="status_rrd_graph_img.php?start=<?=$start?>&amp;end=<?=$end?>&amp;database=<?=$curdatabase?>&amp;style=<?=$curstyle?>&amp;graph=<?=$graph?>" />
</div>
<?php
}
}
}
}
?>
<script type="text/javascript">
//<![CDATA[
function update_graph_images() {
//alert('updating');
var randomid = Math.floor(Math.random()*11);
<?php
foreach ($rrd_graph_list as $graph) {
/* check which databases are valid for our category */
foreach ($ui_databases as $curdatabase) {
if (!stristr($curdatabase, $curcat)) {
continue;
}
$optionc = explode("-", $curdatabase);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
switch ($curoption) {
case "outbound":
/* make sure we do not show the placeholder databases in the outbound view */
if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
/* only show interfaces with a gateway */
$optionc = "$optionc[0]";
if (!interface_has_gateway($optionc)) {
if (!isset($gateways_arr)) {
if (preg_match("/quality/i", $curdatabase)) {
$gateways_arr = return_gateways_array();
} else {
$gateways_arr = array();
}
}
$found_gateway = false;
foreach ($gateways_arr as $gw) {
if ($gw['name'] == $optionc) {
$found_gateway = true;
break;
}
}
if (!$found_gateway) {
continue 2;
}
}
if (!preg_match("/(^$optionc-|-$optionc\\.)/i", $curdatabase)) {
continue 2;
}
break;
case "allgraphs":
/* make sure we do not show the placeholder databases in the all view */
if ((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
continue 2;
}
break;
default:
/* just use the name here */
if (!preg_match("/(^$curoption-|-$curoption\\.)/i", $curdatabase)) {
continue 2;
}
}
$dates = get_dates($curperiod, $graph);
$start = $dates['start'];
if ($curperiod == "current") {
$end = $dates['end'];
}
/* generate update events utilizing jQuery('') feature */
$id = "{$graph}-{$curoption}-{$curdatabase}";
$id = preg_replace('/\./', '_', $id);
echo "\n";
echo "\t\tjQuery('#{$id}').attr('src','status_rrd_graph_img.php?start={$start}&graph={$graph}&database={$curdatabase}&style={$curstyle}&tmp=' + randomid);\n";
}
}
?>
window.setTimeout('update_graph_images()', 355000);
}
window.setTimeout('update_graph_images()', 355000);
//]]>
</script>
<script>
//<![CDATA[
events.push(function() {
$('#option, #style, #period').on('change', function() {
$(this).parents('form').submit();
});
});
//]]>
</script>
<?php include("foot.inc");

File diff suppressed because it is too large Load Diff

View File

@ -1,234 +0,0 @@
<?php
/*
status_rrd_graph_settings.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
* Copyright (c) 2007 Seth Mos <seth.mos@dds.nl>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgment:
* "This product includes software developed by the pfSense Project
* for use in the pfSense software distribution. (http://www.pfsense.org/).
*
* 4. The names "pfSense" and "pfSense Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* coreteam@pfsense.org.
*
* 5. Products derived from this software may not be called "pfSense"
* nor may "pfSense" appear in their names without prior written
* permission of the Electric Sheep Fencing, LLC.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
*
* "This product includes software developed by the pfSense Project
* for use in the pfSense software distribution (http://www.pfsense.org/).
*
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
##|+PRIV
##|*IDENT=page-status-rrdgraph-settings
##|*NAME=Status: RRD Graphs: Settings
##|*DESCR=Allow access to the 'Status: RRD Graphs: Settings' page.
##|*MATCH=status_rrd_graph_settings.php*
##|-PRIV
require("guiconfig.inc");
require_once("filter.inc");
require("shaper.inc");
require_once("rrd.inc");
$pconfig['enable'] = isset($config['rrd']['enable']);
$pconfig['category'] = $config['rrd']['category'];
$pconfig['style'] = $config['rrd']['style'];
$pconfig['period'] = $config['rrd']['period'];
$curcat = "settings";
$categories = array('system' => gettext("System"),
'traffic' => gettext("Traffic"),
'packets' => gettext("Packets"),
'quality' => gettext("Quality"),
'queues' => gettext("Queues"),
'captiveportal' => gettext("Captive Portal"));
if (isset($config['ntpd']['statsgraph'])) {
$categories['ntpd'] = gettext("NTP");
}
$styles = array('inverse' => gettext("Inverse"),
'absolute' => gettext("Absolute"));
$periods = array("absolute" => gettext("Absolute Timespans"),
"current" => gettext("Current Period"),
"previous" => gettext("Previous Period"));
if ($_POST['ResetRRD']) {
mwexec('/bin/rm /var/db/rrd/*');
enable_rrd_graphing();
$savemsg = gettext("RRD data has been cleared. New RRD files have been generated.");
} elseif ($_POST) {
unset($input_errors);
$pconfig = $_POST;
if (!$input_errors) {
$config['rrd']['enable'] = $_POST['enable'] ? true : false;
$config['rrd']['category'] = $_POST['category'];
$config['rrd']['style'] = $_POST['style'];
$config['rrd']['period'] = $_POST['period'];
write_config();
$retval = 0;
$retval = enable_rrd_graphing();
$savemsg = get_std_save_message($retval);
}
}
$here = getcwd();
$rrddbpath = "/var/db/rrd/";
chdir($rrddbpath);
$databases = glob('*.rrd');
chdir($here); // Need to go back home otherwise the 'include/requires fail!
foreach ($databases as $database) {
if (stristr($database, "wireless")) {
$wireless = true;
}
if (stristr($database, "queues")) {
$queues = true;
}
if (stristr($database, "-cellular") && !empty($config['ppps'])) {
$cellular = true;
}
if (stristr($database, "-vpnusers")) {
$vpnusers = true;
}
if (stristr($database, "captiveportal-") && is_array($config['captiveportal'])) {
$captiveportal = true;
}
if (stristr($database, "ntpd") && isset($config['ntpd']['statsgraph'])) {
$ntpd = true;
}
if (stristr($database, "-dhcpd") && is_array($config['dhcpd'])) {
$dhcpd = true;
}
}
$pgtitle = array(gettext("Status"), gettext("RRD Graphs"), gettext("Settings"));
include("head.inc");
$tab_array[] = array(gettext("System"), ($curcat == "system"), "status_rrd_graph.php?cat=system");
$tab_array[] = array(gettext("Traffic"), ($curcat == "traffic"), "status_rrd_graph.php?cat=traffic");
$tab_array[] = array(gettext("Packets"), ($curcat == "packets"), "status_rrd_graph.php?cat=packets");
$tab_array[] = array(gettext("Quality"), ($curcat == "quality"), "status_rrd_graph.php?cat=quality");
if ($queues) {
$tab_array[] = array(gettext("Queues"), ($curcat == "queues"), "status_rrd_graph.php?cat=queues");
$tab_array[] = array(gettext("QueueDrops"), ($curcat == "queuedrops"), "status_rrd_graph.php?cat=queuedrops");
}
if ($wireless) {
$tab_array[] = array(gettext("Wireless"), ($curcat == "wireless"), "status_rrd_graph.php?cat=wireless");
}
if ($cellular) {
$tab_array[] = array(gettext("Cellular"), ($curcat == "cellular"), "status_rrd_graph.php?cat=cellular");
}
if ($vpnusers) {
$tab_array[] = array(gettext("VPN Users"), ($curcat == "vpnusers"), "status_rrd_graph.php?cat=vpnusers");
}
if ($captiveportal) {
$tab_array[] = array(gettext("Captive Portal"), ($curcat == "captiveportal"), "status_rrd_graph.php?cat=captiveportal");
}
if ($ntpd) {
$tab_array[] = array(gettext("NTP"), ($curcat == "ntpd"), "status_rrd_graph.php?cat=ntpd");
}
if ($dhcpd) {
$tab_array[] = array(gettext("DHCP Server"), ($curcat == "dhcpd"), "status_rrd_graph.php?cat=dhcpd");
}
$tab_array[] = array(gettext("Custom"), ($curcat == "custom"), "status_rrd_graph.php?cat=custom");
$tab_array[] = array(gettext("Settings"), ($curcat == "settings"), "status_rrd_graph_settings.php");
display_top_tabs($tab_array);
if ($input_errors) {
print_input_errors($input_errors);
}
if ($savemsg) {
print_info_box($savemsg, 'success');
}
$form = new Form;
$section = new Form_Section('Graph Settings');
$section->addInput(new Form_Checkbox(
'enable',
'RRD Graphs',
'Enable the RRD Graphing backend',
$pconfig['enable']
));
$section->addInput(new Form_Select(
'category',
'Default category',
$pconfig['category'],
$categories
));
$section->addInput(new Form_Select(
'style',
'Default style',
$pconfig['style'],
$styles
));
$section->addInput(new Form_Select(
'period',
'Default period',
$pconfig['period'],
$periods
))->setHelp('Graphs will not be allowed to be recreated within a 1 minute interval, please ' .
'take this into account after changing the style.');
$form->addGlobal(new Form_Button(
'ResetRRD',
'Reset RRD Data'
))->removeClass('btn-primary')->addClass('btn-danger');
$form->add($section);
print $form;
include("foot.inc");

View File

@ -206,8 +206,7 @@ $group->add(new Form_Checkbox(
'IPv6 over IPv4 Tunneling',
'Enable IPv4 NAT encapsulation of IPv6 packets',
$pconfig['ipv6nat_enable']
))->setHelp('NOTE: This does not disable any IPv6 features on the firewall, it only '.
'blocks traffic.');
));
$group->add(new Form_Input(
'ipv6nat_ipaddr',
@ -226,8 +225,8 @@ $section->addInput(new Form_Checkbox(
'Prefer IPv4 over IPv6',
'Prefer to use IPv4 even if IPv6 is available',
$pconfig['prefer_ipv4']
))->setHelp('By default, if a hostname resolves IPv6 and IPv4 addresses IPv6 will '.
'be used, if you check this option, IPv4 will be used instead of IPv6.');
))->setHelp('By default, if IPv6 is configured and a hostname resolves IPv6 and IPv4 addresses, '.
'IPv6 be used. If you check this option, IPv4 will be preferred over IPv6.');
$form->add($section);
$section = new Form_Section('Network Interfaces');

View File

@ -310,22 +310,30 @@ if ($_POST) {
}
/* input validation of dpinger advanced parameters */
$latencylow = $dpinger_default['latencylow'];
if ($_POST['latencylow']) {
if (!is_numeric($_POST['latencylow'])) {
$input_errors[] = gettext("The low latency threshold needs to be a numeric value.");
} else if ($_POST['latencylow'] < 1) {
$input_errors[] = gettext("The low latency threshold needs to be positive.");
} else {
$latencylow = $_POST['latencylow'];
}
}
$latencyhigh = $dpinger_default['latencyhigh'];
if ($_POST['latencyhigh']) {
if (!is_numeric($_POST['latencyhigh'])) {
$input_errors[] = gettext("The high latency threshold needs to be a numeric value.");
} else if ($_POST['latencyhigh'] < 1) {
$input_errors[] = gettext("The high latency threshold needs to be positive.");
} else {
$latencyhigh = $_POST['latencyhigh'];
}
}
$losslow = $dpinger_default['losslow'];
if ($_POST['losslow']) {
if (!is_numeric($_POST['losslow'])) {
$input_errors[] = gettext("The low Packet Loss threshold needs to be a numeric value.");
@ -333,9 +341,12 @@ if ($_POST) {
$input_errors[] = gettext("The low Packet Loss threshold needs to be positive.");
} else if ($_POST['losslow'] >= 100) {
$input_errors[] = gettext("The low Packet Loss threshold needs to be less than 100.");
} else {
$losslow = $_POST['losslow'];
}
}
$losshigh = $dpinger_default['losshigh'];
if ($_POST['losshigh']) {
if (!is_numeric($_POST['losshigh'])) {
$input_errors[] = gettext("The high Packet Loss threshold needs to be a numeric value.");
@ -343,157 +354,80 @@ if ($_POST) {
$input_errors[] = gettext("The high Packet Loss threshold needs to be positive.");
} else if ($_POST['losshigh'] > 100) {
$input_errors[] = gettext("The high Packet Loss threshold needs to be 100 or less.");
} else {
$losshigh = $_POST['losshigh'];
}
}
if (($_POST['latencylow']) && ($_POST['latencyhigh'])) {
if ((is_numeric($_POST['latencylow'])) &&
(is_numeric($_POST['latencyhigh'])) &&
($_POST['latencylow'] >= $_POST['latencyhigh'])) {
$input_errors[] = gettext(
"The high latency threshold needs to be higher than the low latency threshold");
}
} else if ($_POST['latencylow']) {
if (is_numeric($_POST['latencylow']) &&
($_POST['latencylow'] >= $dpinger_default['latencyhigh'])) {
$input_errors[] = gettext(sprintf(
"The low latency threshold needs to be less than the default high latency threshold (%d)",
$dpinger_default['latencyhigh']));
}
} else if ($_POST['latencyhigh']) {
if (is_numeric($_POST['latencyhigh']) &&
($_POST['latencyhigh'] <= $dpinger_default['latencylow'])) {
$input_errors[] = gettext(sprintf(
"The high latency threshold needs to be higher than the default low latency threshold (%d)",
$dpinger_default['latencylow']));
}
}
if (($_POST['losslow']) && ($_POST['losshigh'])) {
if ((is_numeric($_POST['losslow'])) &&
(is_numeric($_POST['losshigh'])) &&
($_POST['losslow'] >= $_POST['losshigh'])) {
$input_errors[] = gettext(
"The high Packet Loss threshold needs to be higher than the low Packet Loss threshold");
}
} else if ($_POST['losslow']) {
if (is_numeric($_POST['losslow']) &&
($_POST['losslow'] >= $dpinger_default['losshigh'])) {
$input_errors[] = gettext(sprintf(
"The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)",
$dpinger_default['losshigh']));
}
} else if ($_POST['losshigh']) {
if (is_numeric($_POST['losshigh']) &&
($_POST['losshigh'] <= $dpinger_default['losslow'])) {
$input_errors[] = gettext(sprintf(
"The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)",
$dpinger_default['losslow']));
}
}
if ($_POST['interval']) {
if (!is_numeric($_POST['interval'])) {
$input_errors[] = gettext("The probe interval needs to be a numeric value.");
} else if ($_POST['interval'] < 1) {
$input_errors[] = gettext("The probe interval needs to be positive.");
}
}
if ($_POST['loss_interval']) {
if (!is_numeric($_POST['loss_interval'])) {
$input_errors[] = gettext("The loss interval needs to be a numeric value.");
} else if ($_POST['loss_interval'] < 1) {
$input_errors[] = gettext("The loss interval setting needs to be positive.");
}
}
// If the loss interval is less than latencyhigh, then high latency could never be recorded
// because those high latency packets would be considered as lost. So do not allow that.
if (($_POST['latencyhigh']) && ($_POST['loss_interval'])) {
if ((is_numeric($_POST['latencyhigh'])) &&
(is_numeric($_POST['loss_interval'])) &&
($_POST['latencyhigh'] > $_POST['loss_interval'])) {
$input_errors[] = gettext("The loss interval needs to be greater than or equal to the high latency threshold.");
}
} else if ($_POST['latencyhigh']) {
if (is_numeric($_POST['latencyhigh']) &&
($_POST['latencyhigh'] > $dpinger_default['loss_interval'])) {
$input_errors[] = sprintf(
gettext("The high latency threshold needs to be less than or equal to the default loss interval (%d)"),
$dpinger_default['loss_interval']);
}
} else if ($_POST['loss_interval']) {
if (is_numeric($_POST['loss_interval']) &&
($_POST['loss_interval'] < $dpinger_default['latencyhigh'])) {
$input_errors[] = sprintf(
gettext("The loss interval needs to be greater than or equal to the default high latency threshold (%d)"),
$dpinger_default['latencyhigh']);
}
}
$time_period = $dpinger_default['time_period'];
if ($_POST['time_period']) {
if (!is_numeric($_POST['time_period'])) {
$input_errors[] = gettext("The time period over which results are averaged needs to be a numeric value.");
} else if ($_POST['time_period'] < 1) {
$input_errors[] = gettext("The time period over which results are averaged needs to be positive.");
} else {
$time_period = $_POST['time_period'];
}
}
// It would be a weird averaging algorithm if we allowed averaging over a time that covered less than 2 pings.
// So make sure that the averaging time period is at least 2 times the probe interval.
if (($_POST['interval']) && ($_POST['time_period'])) {
if ((is_numeric($_POST['interval'])) &&
(is_numeric($_POST['time_period'])) &&
(($_POST['interval'] * 2) > $_POST['time_period'])) {
$input_errors[] = gettext("The time period over which results are averaged needs to be at least twice the probe interval.");
}
} else if ($_POST['interval']) {
if (is_numeric($_POST['interval']) &&
(($_POST['interval'] * 2) > $dpinger_default['time_period'])) {
$input_errors[] = sprintf(
gettext("The probe interval needs to be half or less than the default time period over which results are averaged (%d)"),
$dpinger_default['time_period']);
}
} else if ($_POST['time_period']) {
if (is_numeric($_POST['time_period']) &&
($_POST['time_period'] < ($dpinger_default['interval'] * 2))) {
$input_errors[] = sprintf(
gettext("The time period over which results are averaged needs to be at least twice the default probe interval (%d)"),
$dpinger_default['interval']);
$interval = $dpinger_default['interval'];
if ($_POST['interval']) {
if (!is_numeric($_POST['interval'])) {
$input_errors[] = gettext("The probe interval needs to be a numeric value.");
} else if ($_POST['interval'] < 1) {
$input_errors[] = gettext("The probe interval needs to be positive.");
} else {
$interval = $_POST['interval'];
}
}
$loss_interval = $dpinger_default['loss_interval'];
if ($_POST['loss_interval']) {
if (!is_numeric($_POST['loss_interval'])) {
$input_errors[] = gettext("The loss interval needs to be a numeric value.");
} else if ($_POST['loss_interval'] < 1) {
$input_errors[] = gettext("The loss interval setting needs to be positive.");
} else {
$loss_interval = $_POST['loss_interval'];
}
}
$alert_interval = $dpinger_default['alert_interval'];
if ($_POST['alert_interval']) {
if (!is_numeric($_POST['alert_interval'])) {
$input_errors[] = gettext("The alert interval needs to be a numeric value.");
} else if ($_POST['alert_interval'] < 1) {
$input_errors[] = gettext("The alert interval needs to be positive.");
$input_errors[] = gettext("The alert interval setting needs to be positive.");
} else {
$alert_interval = $_POST['alert_interval'];
}
}
if ($latencylow >= $latencyhigh) {
$input_errors[] = gettext(
"The high latency threshold needs to be greater than the low latency threshold");
}
if ($losslow >= $losshigh) {
$input_errors[] = gettext(
"The high packet loss threshold needs to be higher than the low packet loss threshold");
}
// If the loss interval is less than latencyhigh, then high latency could never be recorded
// because those high latency packets would be considered as lost. So do not allow that.
if ($latencyhigh > $loss_interval) {
$input_errors[] = gettext("The loss interval needs to be greater than or equal to the high latency threshold.");
}
// Ensure that the time period is greater than 2 times the probe interval plus the loss interval.
if (($interval * 2 + $loss_interval) >= $time_period) {
$input_errors[] = gettext("The time period needs to be greater than twice the probe interval plus the loss interval.");
}
// There is no point recalculating the average latency and loss more often than the probe interval.
// So the alert interval needs to be >= probe interval.
if (($_POST['interval']) && ($_POST['alert_interval'])) {
if ((is_numeric($_POST['interval'])) &&
(is_numeric($_POST['alert_interval'])) &&
($_POST['interval'] > $_POST['alert_interval'])) {
$input_errors[] = gettext("The alert interval needs to be greater than or equal to the probe interval.");
}
} else if ($_POST['interval']) {
if (is_numeric($_POST['interval']) &&
($_POST['interval'] > $dpinger_default['alert_interval'])) {
$input_errors[] = sprintf(
gettext("The probe interval needs to be less than or equal to the default alert interval (%d)"),
$dpinger_default['alert_interval']);
}
} else if ($_POST['alert_interval']) {
if (is_numeric($_POST['alert_interval']) &&
($_POST['alert_interval'] < $dpinger_default['interval'])) {
$input_errors[] = sprintf(
gettext("The alert interval needs to be greater than or equal to the default probe interval (%d)"),
$dpinger_default['interval']);
}
if ($interval > $alert_interval) {
$input_errors[] = gettext("The alert interval needs to be greater than or equal to the probe interval.");
}
if (!$input_errors) {
@ -865,10 +799,7 @@ $section->addInput(new Form_Input(
'placeholder' => $dpinger_default['interval'],
'max' => 86400
]
))->setHelp('How often an ICMP probe will be sent in milliseconds. Default is %d. '.
'NOTE: The quality graph is averaged over seconds, not intervals, so as '.
'the probe interval is increased the accuracy of the quality graph is '.
'decreased.', [$dpinger_default['interval']]);
))->setHelp('How often an ICMP probe will be sent in milliseconds. Default is %d.', [$dpinger_default['interval']]);
$section->addInput(new Form_Input(
'loss_interval',
@ -910,20 +841,36 @@ $section->add($group);
$section->addInput(new Form_StaticText(
gettext('Additional information'),
'<span class="help-block">'.
gettext('The time period over which results are averaged must be at least twice ' .
'the probe interval, otherwise the averaging would only "average" over a single probe.') .
gettext('The time period, probe interval and loss interval are closely related. The ' .
'ratio between these values control the accuracy of the numbers reported and ' .
'the timeliness of alerts.') .
'<br/><br/>' .
gettext('The alert interval must be greater than or equal to the probe interval. ' .
'There is no point checking for alerts more often than probes are done.') .
gettext('A longer time period will will provide smoother results for round trip time ' .
'and loss, but will increase the time before a latency or loss alert is triggered.') .
'<br/><br/>' .
gettext('The loss interval must be greater than or equal to the high latency threshold. ' .
'Otherwise high latency packets would always be considered as lost.') .
gettext('A shorter probe interval will decrease the time required before a latency ' .
'or loss alert is triggered, but will use more network resource. Longer ' .
'probe intervals will degrade the accuracy of the quality graphs.') .
'<br/><br/>' .
gettext('Choose a combination of parameters to suit your needs. ' .
'For example, a short probe interval will give more probes and (hopefully) ' .
'a statistically more stable average. A higher loss interval will allow the ' .
'system to wait longer for probes on high-latency links, and thus allow a ' .
'better estimate of high-latency versus loss.').
gettext('The ratio of the probe interval to the time period (minus the loss interval) ' .
'also controls the resolution of loss reporting. To determine the resolution, ' .
'the following formula can be used:') .
'<br/><br/>' .
gettext('&nbsp &nbsp 100 * probe interval / (time period - loss interval)') .
'<br/><br/>' .
gettext('Rounding up to the nearest whole number will yield the resolution of loss ' .
'reporting in percent. The default values provide a resolution of 1%.') .
'<br/><br/>' .
gettext('The default settings are recommended for most use cases. However if you ' .
'change the settings, please observe the following restrictions:') .
'<br/><br/>' .
gettext('- The time period must be greater than twice the probe interval plus the loss ' .
'interval. This guarantees there is at least one completed probe at all times. ') .
'<br/><br/>' .
gettext('- The alert interval must be greater than or equal to the probe interval. There ' .
'is no point checking for alerts more often than probes are done.') .
'<br/><br/>' .
gettext('- The loss interval must be greater than or equal to the high latency threshold.') .
'</span>'
));

View File

@ -88,7 +88,6 @@ if (!is_array($a_group['priv'])) {
// Make a local copy and sort it
$spriv_list = $priv_list;
uasort($spriv_list, "cpusercmp");
if ($_POST) {

View File

@ -2116,9 +2116,12 @@ poudriere_update_jails() {
for jail_arch in ${_archs}; do
jail_name=$(poudriere_jail_name ${jail_arch})
local _create_or_update="-u"
local _create_or_update_text="Updating"
if ! poudriere jail -i -j "${jail_name}" >/dev/null 2>&1; then
echo ">>> Poudriere jail ${jail_name} not found, skipping..." | tee -a ${LOGFILE}
continue
echo ">>> Poudriere jail ${jail_name} not found, creating..." | tee -a ${LOGFILE}
_create_or_update="-c -v ${FREEBSD_PARENT_BRANCH} -a ${jail_arch} -m svn"
_create_or_update_text="Creating"
fi
if [ "${jail_arch}" = "arm.armv6" ]; then
@ -2127,10 +2130,10 @@ poudriere_update_jails() {
native_xtools=""
fi
echo -n ">>> Updating jail ${jail_name}, it may take some time... " | tee -a ${LOGFILE}
if ! script -aq ${LOGFILE} poudriere jail -u -j "${jail_name}" -P ${_jail_patch} ${native_xtools} >/dev/null 2>&1; then
echo -n ">>> ${_create_or_update_text} jail ${jail_name}, it may take some time... " | tee -a ${LOGFILE}
if ! script -aq ${LOGFILE} poudriere jail ${_create_or_update} -j "${jail_name}" -P ${_jail_patch} ${native_xtools} >/dev/null 2>&1; then
echo "" | tee -a ${LOGFILE}
echo ">>> ERROR: Error updating jail ${jail_name}, aborting..." | tee -a ${LOGFILE}
echo ">>> ERROR: Error ${_create_or_update_text} jail ${jail_name}, aborting..." | tee -a ${LOGFILE}
print_error_pfS
fi
echo "Done!" | tee -a ${LOGFILE}

View File

@ -1,10 +1,7 @@
sysutils/pfSense-Status_Monitoring
sysutils/flashrom
databases/php56-mysql
databases/php56-mysqli
databases/php56-pdo_mysql
databases/rrdtool
databases/pecl-rrd
benchmarks/iperf
benchmarks/iperf3
net/py-speedtest-cli