diff options
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/sbin/ppp-linkdown | 46 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_edit.php | 42 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_out.php | 185 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_out_edit.php | 40 | ||||
-rwxr-xr-x | usr/local/www/firewall_rules_edit.php | 40 | ||||
-rwxr-xr-x | usr/local/www/index.php | 5 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/dyn_dns_status.widget.php | 77 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/system_information.widget.php | 2 | ||||
-rw-r--r-- | usr/local/www/wizards/openvpn_wizard.inc | 2 | ||||
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard.inc | 11 | ||||
-rwxr-xr-x | usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc | 8 | ||||
-rwxr-xr-x | usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc | 9 | ||||
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc | 11 |
13 files changed, 332 insertions, 146 deletions
diff --git a/usr/local/sbin/ppp-linkdown b/usr/local/sbin/ppp-linkdown index 31d89c6..62d07ed 100755 --- a/usr/local/sbin/ppp-linkdown +++ b/usr/local/sbin/ppp-linkdown @@ -1,37 +1,31 @@ #!/bin/sh -if [ -f /tmp/$1up ] && [ -f /conf/$1.log ]; then - seconds=$((`date -j +%s` - `/usr/bin/stat -f %m /tmp/$1up`)) - /usr/local/sbin/ppp-log-uptime.sh $seconds $1 & -fi -if [ "$3" != "" ]; then - if echo "$3" | grep -q '/'; then - LOCAL_IP="${3}" - else - LOCAL_IP="${3}/32" - fi - echo "Removing states from ${LOCAL_IP}" | logger -t ppp-linkdown - /sbin/pfctl -k 0.0.0.0/0 -k ${LOCAL_IP} - /sbin/pfctl -k ${LOCAL_IP} - pfctl -K ${LOCAL_IP} - pfctl -i $1 -Fs +IF="${1}" +LOCAL_IP="${3}" + +if [ -f /tmp/${IF}up ] && [ -f /conf/${IF}.log ]; then + seconds=$((`date -j +%s` - `/usr/bin/stat -f %m /tmp/${IF}up`)) + /usr/local/sbin/ppp-log-uptime.sh $seconds ${IF} & fi -/sbin/pfctl -i $1 -Fs -if [ -f "/tmp/${1}_defaultgw" ]; then - route delete default ${OLD_ROUTER} +/etc/rc.kill_states ${IF} ${LOCAL_IP} + +if [ -s "/tmp/${IF}_defaultgw" ]; then + GW=`head -n 1 /tmp/${IF}_defaultgw` + [ -n "${GW}" ] \ + && /sbin/route delete default ${GW} fi # delete the node just in case mpd cannot do that -/usr/sbin/ngctl shutdown $1: -if [ -f "/var/etc/nameserver_$1" ]; then +/usr/sbin/ngctl shutdown ${IF}: +if [ -f "/var/etc/nameserver_${IF}" ]; then # Remove old entries - for nameserver in `cat /var/etc/nameserver_$1`; do - /sbin/route delete $nameserver >/dev/null 2>&1 + for nameserver in `cat /var/etc/nameserver_${IF}`; do + /sbin/route delete ${nameserver} >/dev/null 2>&1 done - /bin/rm -f /var/etc/nameserver_$1 + /bin/rm -f /var/etc/nameserver_${IF} fi # Do not remove gateway used during filter reload. -/bin/rm -f /tmp/$1_router -/bin/rm -f /tmp/$1up -/bin/rm -f /tmp/$1_ip +/bin/rm -f /tmp/${IF}_router +/bin/rm -f /tmp/${IF}up +/bin/rm -f /tmp/${IF}_ip /usr/local/sbin/pfSctl -c 'service reload dns' diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php index f4b4587..6f6d5cf 100755 --- a/usr/local/www/firewall_nat_edit.php +++ b/usr/local/www/firewall_nat_edit.php @@ -71,9 +71,14 @@ if (isset($_GET['dup'])) { } if (isset($id) && $a_nat[$id]) { + if ( isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']) ) + $pconfig['created'] = $a_nat[$id]['created']; + + if ( isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated']) ) + $pconfig['updated'] = $a_nat[$id]['updated']; + $pconfig['disabled'] = isset($a_nat[$id]['disabled']); $pconfig['nordr'] = isset($a_nat[$id]['nordr']); - address_to_pconfig($a_nat[$id]['source'], $pconfig['src'], $pconfig['srcmask'], $pconfig['srcnot'], $pconfig['srcbeginport'], $pconfig['srcendport']); @@ -409,12 +414,18 @@ if ($_POST) { // If this is a new rule, create an ID and add the rule if( $_POST['filter-rule-association']=='add-associated' ) { $filterent['associated-rule-id'] = $natent['associated-rule-id'] = get_unique_id(); + $filterent['created'] = make_config_revision_entry(null, gettext("NAT Port Forward")); $config['filter']['rule'][] = $filterent; } mark_subsystem_dirty('filter'); } + if ( isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']) ) + $natent['created'] = $a_nat[$id]['created']; + + $natent['updated'] = make_config_revision_entry(); + // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_write_config"); @@ -422,6 +433,7 @@ if ($_POST) { if (isset($id) && $a_nat[$id]) $a_nat[$id] = $natent; else { + $natent['created'] = make_config_revision_entry(); if (is_numeric($after)) array_splice($a_nat, $after+1, 0, array($natent)); else @@ -839,6 +851,34 @@ include("fbegin.inc"); ?> // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/htmlphplate"); ?> +<?php +$has_created_time = (isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created'])); +$has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated'])); +?> + <?php if ($has_created_time || $has_updated_time): ?> + <tr> + <td> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><?=gettext("Rule Information");?></td> + </tr> + <?php if ($has_created_time): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Created");?></td> + <td width="78%" class="vtable"> + <?= date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) ?> <?= gettext("by") ?> <strong><?= $a_nat[$id]['created']['username'] ?></strong> + </td> + </tr> + <?php endif; ?> + <?php if ($has_updated_time): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Updated");?></td> + <td width="78%" class="vtable"> + <?= date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) ?> <?= gettext("by") ?> <strong><?= $a_nat[$id]['updated']['username'] ?></strong> + </td> + </tr> + <?php endif; ?> + <?php endif; ?> <tr> <td width="22%" valign="top"> </td> <td width="78%"> </td> diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index 5c445ed..f8c2417 100755 --- a/usr/local/www/firewall_nat_out.php +++ b/usr/local/www/firewall_nat_out.php @@ -94,120 +94,127 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") { $ifdescrs = get_configured_interface_with_descr(); foreach($ifdescrs as $if => $ifdesc) { - if (interface_has_gateway($if)) + if (!interface_has_gateway($if)) continue; - $osipaddr = get_interface_ip($if); - $ossubnet = get_interface_subnet($if); - if (!is_ipaddr($osipaddr) || empty($ossubnet)) - continue; - $osn = gen_subnet($osipaddr, $ossubnet); foreach ($ifdescrs as $if2 => $ifdesc2) { - if (!interface_has_gateway($if2)) + if (interface_has_gateway($if2)) + continue; + + $osipaddr = get_interface_ip($if2); + $ossubnet = get_interface_subnet($if2); + if (!is_ipaddr($osipaddr) || empty($ossubnet)) continue; + $osn = gen_subnet($osipaddr, $ossubnet); $natent = array(); $natent['source']['network'] = "{$osn}/{$ossubnet}"; $natent['dstport'] = "500"; - $natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'),$ifdesc,$ifdesc2); + $natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'),$ifdesc2,$ifdesc); $natent['target'] = ""; - $natent['interface'] = $if2; + $natent['interface'] = $if; $natent['destination']['any'] = true; $natent['staticnatport'] = true; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); $a_out[] = $natent; - + $natent = array(); - $natent['source']['network'] = "{$osn}/{$ossubnet}"; - $natent['sourceport'] = ""; - $natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'),$ifdesc,$ifdesc2); - $natent['target'] = ""; - $natent['interface'] = $if2; - $natent['destination']['any'] = true; - $natent['natport'] = ""; - $a_out[] = $natent; - - $natent = array(); - $natent['source']['network'] = "127.0.0.0/8"; - $natent['dstport'] = ""; - $natent['descr'] = sprintf(gettext('Auto created rule for localhost to %1$s'),$ifdesc2); - $natent['target'] = ""; - $natent['interface'] = $if2; - $natent['destination']['any'] = true; - $natent['staticnatport'] = false; - $natent['natport'] = "1024:65535"; - $a_out[] = $natent; - - /* PPTP subnet */ - if (($config['pptpd']['mode'] == "server") && is_private_ip($config['pptpd']['remoteip'])) { - $pptp_size = empty($config['pptpd']['n_pptp_units']) ? 16 : $config['pptpd']['n_pptp_units']; - $pptptopip = $pptp_size - 1; - $pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], long2ip32(ip2long($config['pptpd']['remoteip'])+$pptptopip)); - foreach ($pptp_subnets as $pptpsn) { - $natent = array(); - $natent['source']['network'] = $pptpsn; - $natent['sourceport'] = ""; - $natent['descr'] = gettext("Auto created rule for PPTP server"); - $natent['target'] = ""; - $natent['interface'] = $if2; - $natent['destination']['any'] = true; - $natent['natport'] = ""; - $a_out[] = $natent; - } - } - /* PPPoE subnet */ - if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) { - foreach ($config['pppoes']['pppoe'] as $pppoes) { - if (($pppoes['mode'] == "server") && is_ipaddr($pppoes['localip'])) { - if($pppoes['pppoe_subnet'] <> "") - $ossubnet = $pppoes['pppoe_subnet']; - else - $ossubnet = "32"; - $osn = gen_subnet($pppoes['localip'], $ossubnet); - $natent = array(); - $natent['source']['network'] = "{$osn}/{$ossubnet}"; - $natent['sourceport'] = ""; - $natent['descr'] = gettext("Auto created rule for PPPoE server"); - $natent['target'] = ""; - $natent['interface'] = $if2; - $natent['destination']['any'] = true; - $natent['natport'] = ""; - $a_out[] = $natent; - } - } + $natent['source']['network'] = "{$osn}/{$ossubnet}"; + $natent['sourceport'] = ""; + $natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'),$ifdesc2,$ifdesc); + $natent['target'] = ""; + $natent['interface'] = $if; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); + $a_out[] = $natent; + } + /* Localhost */ + $natent = array(); + $natent['source']['network'] = "127.0.0.0/8"; + $natent['dstport'] = ""; + $natent['descr'] = sprintf(gettext('Auto created rule for localhost to %1$s'),$ifdesc); + $natent['target'] = ""; + $natent['interface'] = $if; + $natent['destination']['any'] = true; + $natent['staticnatport'] = false; + $natent['natport'] = "1024:65535"; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); + $a_out[] = $natent; + /* PPTP subnet */ + if (($config['pptpd']['mode'] == "server") && is_private_ip($config['pptpd']['remoteip'])) { + $pptp_size = empty($config['pptpd']['n_pptp_units']) ? 16 : $config['pptpd']['n_pptp_units']; + $pptptopip = $pptp_size - 1; + $pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], long2ip32(ip2long($config['pptpd']['remoteip'])+$pptptopip)); + foreach ($pptp_subnets as $pptpsn) { + $natent = array(); + $natent['source']['network'] = $pptpsn; + $natent['sourceport'] = ""; + $natent['descr'] = gettext("Auto created rule for PPTP server"); + $natent['target'] = ""; + $natent['interface'] = $if; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); + $a_out[] = $natent; } - /* L2TP subnet */ - if($config['l2tp']['mode'] == "server") { - if (is_ipaddr($config['l2tp']['localip'])) { - if($config['l2tp']['l2tp_subnet'] <> "") - $ossubnet = $config['l2tp']['l2tp_subnet']; + } + /* PPPoE subnet */ + if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) { + foreach ($config['pppoes']['pppoe'] as $pppoes) { + if (($pppoes['mode'] == "server") && is_ipaddr($pppoes['localip'])) { + if($pppoes['pppoe_subnet'] <> "") + $ossubnet = $pppoes['pppoe_subnet']; else $ossubnet = "32"; - $osn = gen_subnet($config['l2tp']['localip'], $ossubnet); + $osn = gen_subnet($pppoes['localip'], $ossubnet); $natent = array(); $natent['source']['network'] = "{$osn}/{$ossubnet}"; $natent['sourceport'] = ""; - $natent['descr'] = gettext("Auto created rule for L2TP server"); + $natent['descr'] = gettext("Auto created rule for PPPoE server"); $natent['target'] = ""; - $natent['interface'] = $if2; + $natent['interface'] = $if; $natent['destination']['any'] = true; $natent['natport'] = ""; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); $a_out[] = $natent; } } - /* add openvpn interfaces */ - if($config['openvpn']['openvpn-server']) { - foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) { - $natent = array(); - $natent['source']['network'] = $ovpnsrv['tunnel_network']; - $natent['sourceport'] = ""; - $natent['descr'] = gettext("Auto created rule for OpenVPN server"); - $natent['target'] = ""; - $natent['interface'] = $if2; - $natent['destination']['any'] = true; - $natent['natport'] = ""; - $a_out[] = $natent; - } + } + /* L2TP subnet */ + if($config['l2tp']['mode'] == "server") { + if (is_ipaddr($config['l2tp']['localip'])) { + if($config['l2tp']['l2tp_subnet'] <> "") + $ossubnet = $config['l2tp']['l2tp_subnet']; + else + $ossubnet = "32"; + $osn = gen_subnet($config['l2tp']['localip'], $ossubnet); + $natent = array(); + $natent['source']['network'] = "{$osn}/{$ossubnet}"; + $natent['sourceport'] = ""; + $natent['descr'] = gettext("Auto created rule for L2TP server"); + $natent['target'] = ""; + $natent['interface'] = $if; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); + $a_out[] = $natent; + } + } + /* add openvpn interfaces */ + if($config['openvpn']['openvpn-server']) { + foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) { + $natent = array(); + $natent['source']['network'] = $ovpnsrv['tunnel_network']; + $natent['sourceport'] = ""; + $natent['descr'] = gettext("Auto created rule for OpenVPN server"); + $natent['target'] = ""; + $natent['interface'] = $if; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch")); + $a_out[] = $natent; } - } + } } $savemsg = gettext("Default rules for each interface have been created."); diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index 5552071..479f6f4 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -74,6 +74,12 @@ if (isset($_GET['dup'])) { } if (isset($id) && $a_out[$id]) { + if ( isset($a_out[$id]['created']) && is_array($a_out[$id]['created']) ) + $pconfig['created'] = $a_out[$id]['created']; + + if ( isset($a_out[$id]['updated']) && is_array($a_out[$id]['updated']) ) + $pconfig['updated'] = $a_out[$id]['updated']; + $pconfig['protocol'] = $a_out[$id]['protocol']; list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']); if (!is_numeric($pconfig['source_subnet'])) @@ -294,12 +300,18 @@ if ($_POST) { $natent['destination']['not'] = true; } + if ( isset($a_out[$id]['created']) && is_array($a_out[$id]['created']) ) + $natent['created'] = $a_out[$id]['created']; + + $natent['updated'] = make_config_revision_entry(); + // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/pre_write_config"); if (isset($id) && $a_out[$id]) { $a_out[$id] = $natent; } else { + $natent['created'] = make_config_revision_entry(); if (is_numeric($after)) { array_splice($a_out, $after+1, 0, array($natent)); } else { @@ -655,6 +667,34 @@ any)");?></td> "for your reference (not parsed).");?></span></td> </tr> <?php +$has_created_time = (isset($a_out[$id]['created']) && is_array($a_out[$id]['created'])); +$has_updated_time = (isset($a_out[$id]['updated']) && is_array($a_out[$id]['updated'])); +?> + <?php if ($has_created_time || $has_updated_time): ?> + <tr> + <td> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><?=gettext("Rule Information");?></td> + </tr> + <?php if ($has_created_time): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Created");?></td> + <td width="78%" class="vtable"> + <?= date(gettext("n/j/y H:i:s"), $a_out[$id]['created']['time']) ?> <?= gettext("by") ?> <strong><?= $a_out[$id]['created']['username'] ?></strong> + </td> + </tr> + <?php endif; ?> + <?php if ($has_updated_time): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Updated");?></td> + <td width="78%" class="vtable"> + <?= date(gettext("n/j/y H:i:s"), $a_out[$id]['updated']['time']) ?> <?= gettext("by") ?> <strong><?= $a_out[$id]['updated']['username'] ?></strong> + </td> + </tr> + <?php endif; ?> + <?php endif; ?> +<?php // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_aon/htmlphplate"); ?> diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index b205c46..b3e3c5e 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -78,6 +78,12 @@ if (isset($id) && $a_filter[$id]) { if (isset($a_filter[$id]['id'])) $pconfig['ruleid'] = $a_filter[$id]['id']; + if ( isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created']) ) + $pconfig['created'] = $a_filter[$id]['created']; + + if ( isset($a_filter[$id]['updated']) && is_array($a_filter[$id]['updated']) ) + $pconfig['updated'] = $a_filter[$id]['updated']; + if (!isset($a_filter[$id]['type'])) $pconfig['type'] = "pass"; else @@ -636,12 +642,18 @@ if ($_POST) { $filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id']; } + if ( isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created']) ) + $filterent['created'] = $a_filter[$id]['created']; + + $filterent['updated'] = make_config_revision_entry(); + // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_write_config"); if (isset($id) && $a_filter[$id]) $a_filter[$id] = $filterent; else { + $filterent['created'] = make_config_revision_entry(); if (is_numeric($after)) array_splice($a_filter, $after+1, 0, array($filterent)); else @@ -1559,6 +1571,34 @@ $i--): ?> // Allow extending of the firewall edit page and include custom input validation pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/htmlphplate"); ?> +<?php +$has_created_time = (isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created'])); +$has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id]['updated'])); +?> + <?php if ($has_created_time || $has_updated_time): ?> + <tr> + <td> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><?=gettext("Rule Information");?></td> + </tr> + <?php if ($has_created_time): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Created");?></td> + <td width="78%" class="vtable"> + <?= date(gettext("n/j/y H:i:s"), $a_filter[$id]['created']['time']) ?> <?= gettext("by") ?> <strong><?= $a_filter[$id]['created']['username'] ?></strong> + </td> + </tr> + <?php endif; ?> + <?php if ($has_updated_time): ?> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Updated");?></td> + <td width="78%" class="vtable"> + <?= date(gettext("n/j/y H:i:s"), $a_filter[$id]['updated']['time']) ?> <?= gettext("by") ?> <strong><?= $a_filter[$id]['updated']['username'] ?></strong> + </td> + </tr> + <?php endif; ?> + <?php endif; ?> <tr> <td width="22%" valign="top"> </td> <td width="78%"> diff --git a/usr/local/www/index.php b/usr/local/www/index.php index f70e376..7673cb2 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -42,9 +42,6 @@ ##|*MATCH=index.php* ##|-PRIV -// Turn off csrf for the dashboard -$nocsrf = true; - // Turn on buffering to speed up rendering ini_set('output_buffering','true'); @@ -756,4 +753,4 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard"); ?> </body> -</html>
\ No newline at end of file +</html> diff --git a/usr/local/www/widgets/widgets/dyn_dns_status.widget.php b/usr/local/www/widgets/widgets/dyn_dns_status.widget.php index e177b8d..2ae268b 100644 --- a/usr/local/www/widgets/widgets/dyn_dns_status.widget.php +++ b/usr/local/www/widgets/widgets/dyn_dns_status.widget.php @@ -1,8 +1,8 @@ <?php /* Original status page code from: services_dyndns.php - Copyright (C) 2008 Ermal Lu\xe7i - Edits to convert it to a widget: dyn_dns_status.php + Copyright (C) 2008 Ermal Luci + Edits to convert it to a widget: dyn_dns_status.widget.php Copyright (C) 2013 Stanley P. Miller \ stan-qaz All rights reserved. @@ -44,6 +44,33 @@ if (!is_array($config['dyndnses']['dyndns'])) $a_dyndns = &$config['dyndnses']['dyndns']; +if($_REQUEST['getdyndnsstatus']) { + $first_entry = true; + foreach ($a_dyndns as $dyndns) { + if ($first_entry) + $first_entry = false; + else + // Put a vertical bar delimiter between the echoed HTML for each entry processed. + echo "|"; + + $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; + if (file_exists($filename)) { + $ipaddr = dyndnsCheckIP($dyndns['interface']); + $cached_ip_s = split(":", file_get_contents($filename)); + $cached_ip = $cached_ip_s[0]; + if ($ipaddr <> $cached_ip) + echo "<font color='red'>"; + else + echo "<font color='green'>"; + echo htmlspecialchars($cached_ip); + echo "</font>"; + } else { + echo "N/A " . date("H:i:s"); + } + } + exit; +} + ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> @@ -101,23 +128,37 @@ $a_dyndns = &$config['dyndnses']['dyndns']; ?> </td> <td class="listlr"> - <?php - $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; - if (file_exists($filename)) { - $ipaddr = dyndnsCheckIP($dyndns['interface']); - $cached_ip_s = split(":", file_get_contents($filename)); - $cached_ip = $cached_ip_s[0]; - if ($ipaddr <> $cached_ip) - echo "<font color='red'>"; - else - echo "<font color='green'>"; - echo htmlspecialchars($cached_ip); - echo "</font>"; - } else { - echo "N/A"; - } - ?> + <div id='dyndnsstatus<?php echo $i; ?>'><?php echo gettext("Checking ..."); ?></div> </td> </tr> <?php $i++; endforeach; ?> </table> +<script type="text/javascript"> +//<![CDATA[ + function dyndns_getstatus() { + scroll(0,0); + var url = "/widgets/widgets/dyn_dns_status.widget.php"; + var pars = 'getdyndnsstatus=yes'; + jQuery.ajax( + url, + { + type: 'get', + data: pars, + complete: dyndnscallback + }); + // Refresh the status every 5 minutes + setTimeout('dyndns_getstatus()', 5*60*1000); + } + function dyndnscallback(transport) { + // The server returns a string of statuses separated by vertical bars + var responseStrings = transport.responseText.split("|"); + for (var count=0; count<responseStrings.length; count++) + { + var divlabel = '#dyndnsstatus' + count; + jQuery(divlabel).prop('innerHTML',responseStrings[count]); + } + } + // Do the first status check 2 seconds after the dashboard opens + setTimeout('dyndns_getstatus()', 2000); +//]]> +</script> diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index 403b24c..8d17df7 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE. */ -$nocsrf = true; - require_once("functions.inc"); require_once("guiconfig.inc"); require_once('notices.inc'); diff --git a/usr/local/www/wizards/openvpn_wizard.inc b/usr/local/www/wizards/openvpn_wizard.inc index 86dec52..0637639 100644 --- a/usr/local/www/wizards/openvpn_wizard.inc +++ b/usr/local/www/wizards/openvpn_wizard.inc @@ -611,6 +611,7 @@ function step12_submitphpaction() { $rule['protocol'] = strtolower($server['protocol']); $rule['type'] = "pass"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("OpenVPN Wizard")); $config['filter']['rule'][] = $rule; } if (isset($pconfig['step11']['ovpnallow'])) { @@ -625,6 +626,7 @@ function step12_submitphpaction() { //$rule['protocol'] = $server['protocol']; $rule['type'] = "pass"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("OpenVPN Wizard")); $config['filter']['rule'][] = $rule; } diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc index d13a5a7..71bcea0 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard.inc @@ -1349,6 +1349,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } @@ -1369,6 +1370,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; $rule = array(); @@ -1382,6 +1384,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { /* create VOIP rules */ @@ -1397,6 +1400,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } else { @@ -1415,6 +1419,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $voip[2]."-".$voip[3]; if($voip[1] != '') $rule['protocol'] = $voip[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1438,6 +1443,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; if($p2pclient[1] != '') $rule['protocol'] = $p2pclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1464,6 +1470,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; if($Gameclient[1] != '') $rule['protocol'] = $Gameclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1516,8 +1523,8 @@ function apply_all_choosen_items() { } if($otherclient[1] != '') $rule['protocol'] = $otherclient[1]; - - $config['filter']['rule'][] = $rule; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); + $config['filter']['rule'][] = $rule; } } } diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index 2cc43e2..a5a73e1 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -1413,6 +1413,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1432,6 +1433,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; $rule = array(); @@ -1445,6 +1447,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { @@ -1461,6 +1464,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } else { @@ -1479,6 +1483,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $voip[2]."-".$voip[3]; if($voip[1] != '') $rule['protocol'] = $voip[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1502,6 +1507,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; if($p2pclient[1] != '') $rule['protocol'] = $p2pclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1580,7 +1586,7 @@ function apply_all_choosen_items() { } if($otherclient[1] != '') $rule['protocol'] = $otherclient[1]; - + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 707463d..8a1c8c6 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -1469,6 +1469,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } @@ -1489,6 +1490,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; $rule = array(); @@ -1502,6 +1504,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { @@ -1518,6 +1521,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } else { @@ -1536,6 +1540,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $voip[2]."-".$voip[3]; if($voip[1] != '') $rule['protocol'] = $voip[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1559,6 +1564,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; if($p2pclient[1] != '') $rule['protocol'] = $p2pclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1585,6 +1591,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; if($Gameclient[1] != '') $rule['protocol'] = $Gameclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1637,7 +1644,7 @@ function apply_all_choosen_items() { } if($otherclient[1] != '') $rule['protocol'] = $otherclient[1]; - + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc index 95a4d94..8f53d60 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc @@ -1210,6 +1210,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } @@ -1230,6 +1231,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; $rule = array(); @@ -1243,6 +1245,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } elseif( $config['ezshaper']['step3']['provider'] == "Generic" ) { @@ -1259,6 +1262,7 @@ function apply_all_choosen_items() { $rule['floating'] = "yes"; $rule['wizard'] = "yes"; $rule['enabled'] = "on"; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } else { @@ -1277,6 +1281,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $voip[2]."-".$voip[3]; if($voip[1] != '') $rule['protocol'] = $voip[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1300,6 +1305,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3]; if($p2pclient[1] != '') $rule['protocol'] = $p2pclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1326,6 +1332,7 @@ function apply_all_choosen_items() { $rule['destination']['port'] = $Gameclient[2]."-".$Gameclient[3]; if($Gameclient[1] != '') $rule['protocol'] = $Gameclient[1]; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); $config['filter']['rule'][] = $rule; } } @@ -1378,8 +1385,8 @@ function apply_all_choosen_items() { } if($otherclient[1] != '') $rule['protocol'] = $otherclient[1]; - - $config['filter']['rule'][] = $rule; + $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard")); + $config['filter']['rule'][] = $rule; } } } |