diff options
-rw-r--r-- | etc/inc/config.console.inc | 4 | ||||
-rw-r--r-- | etc/inc/gwlb.inc | 2 | ||||
-rw-r--r-- | etc/inc/notices.inc | 15 | ||||
-rw-r--r-- | etc/inc/system.inc | 3 | ||||
-rw-r--r-- | etc/inc/vpn.inc | 7 | ||||
-rwxr-xr-x | etc/rc.bootup | 3 | ||||
-rwxr-xr-x | etc/rc.newwanip | 2 | ||||
-rw-r--r-- | usr/local/www/diag_packet_capture.php | 4 | ||||
-rw-r--r-- | usr/local/www/system_advanced_firewall.php | 2 | ||||
-rw-r--r-- | usr/local/www/vpn_l2tp.php | 41 |
10 files changed, 68 insertions, 15 deletions
diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 77ef66b..7c5041b 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -84,8 +84,8 @@ EOD; $iflist = array(); } else { foreach ($iflist as $iface => $ifa) { - echo sprintf("% -6s%s%s\t%s\n", $iface, $ifa['mac'], - $ifa['up'] ? " (up)" : " (down)", $ifa['dmesg']); + echo sprintf("% -6s%s %s %s\n", $iface, $ifa['mac'], + $ifa['up'] ? " (up)" : "(down)", $ifa['dmesg']); } } diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index f7cd6ab..ce5a328 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -438,6 +438,7 @@ function return_gateway_groups_array() { if ($gwdown == true) { log_error($msg); notify_via_growl($msg); + notify_via_smtp($msg); } else /* Online add member */ $tiers[$tier][] = $gwname; @@ -450,6 +451,7 @@ function return_gateway_groups_array() { $msg = "Gateways status could not be determined, considering all as up/active."; log_error($msg); notify_via_growl($msg); + notify_via_smtp($msg); } $tiers = $backupplan; } diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 0cbf5fd..9ccd373 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -345,6 +345,14 @@ function notify_via_smtp($message) { function notify_via_growl($message) { require_once("growl.class"); global $config,$g; + + /* Do NOT send the same message twice */ + if(file_exists("/var/db/growlnotices_lastmsg.txt")) { + $lastmsg = trim(file_get_contents("/var/db/growlnotices_lastmsg.txt")); + if($lastmsg == $message) + return; + } + $hostname = $config['system']['hostname'] . "." . $config['system']['domain']; $growl_ip = $config['notifications']['growl']['ipaddress']; $growl_password = $config['notifications']['growl']['password']; @@ -355,6 +363,11 @@ function notify_via_growl($message) { $growl = new Growl($growl_ip, $growl_password, $growl_name); $growl->notify("{$growl_notification}", gettext(sprintf("%s (%s) - Notification", $g['product_name'], $hostname)), "{$message}"); } + + /* Store last message sent to avoid spamming */ + $fd = fopen("/var/db/growlnotices_lastmsg.txt", "w"); + fwrite($fd, $message); + fclose($fd); } /****f* notices/register_via_growl @@ -380,4 +393,4 @@ function register_via_growl() { } } -?> +?>
\ No newline at end of file diff --git a/etc/inc/system.inc b/etc/inc/system.inc index e522ec1..7e55730 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1287,9 +1287,6 @@ function system_ntp_configure() { if(!is_dir("/var/empty")) exec("/bin/mkdir -p /var/empty && chmod ug+rw /var/empty/."); - if ($g['booting']) - return; - /* start opentpd, set time now and use /var/etc/ntpd.conf */ exec("/usr/local/sbin/ntpd -s -f {$g['varetc_path']}/ntpd.conf"); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 37f791a..c10cb01 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -1520,9 +1520,12 @@ l2tp_standard: EOD; - if (!empty($l2tpcfg['dns1'])) { + if (is_ipaddr($l2tpcfg['wins'])) { + $mpdconf .= " set ipcp nbns {$l2tpcfg['wins']}\n"; + } + if (is_ipaddr($l2tpcfg['dns1'])) { $mpdconf .= " set ipcp dns " . $l2tpcfg['dns1']; - if (!empty($l2tpcfg['dns2'])) + if (is_ipaddr($l2tpcfg['dns2'])) $mpdconf .= " " . $l2tpcfg['dns2']; $mpdconf .= "\n"; } elseif (isset ($config['dnsmasq']['enable'])) { diff --git a/etc/rc.bootup b/etc/rc.bootup index 6cff6ac..e71c430 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -289,9 +289,6 @@ echo "Starting OpenNTP time client..."; system_ntp_configure(); echo "done.\n"; -/* Launch on bootup and keep trying to sync. Exit once time/date has been sync'd. */ -mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh"); - /* start DHCP service */ services_dhcpd_configure(); diff --git a/etc/rc.newwanip b/etc/rc.newwanip index 654d0dd..0395099 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -49,7 +49,7 @@ function restart_packages() { global $oldip, $curwanipi, $g; /* restart packages */ - mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh"); + system_ntp_configure(); log_error("{$g['product_name']} package system has detected an ip change $oldip -> $curwanip ... Restarting packages."); mwexec_bg("/etc/rc.start_packages"); } diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php index b35cc1b..684011c 100644 --- a/usr/local/www/diag_packet_capture.php +++ b/usr/local/www/diag_packet_capture.php @@ -72,7 +72,7 @@ if ($_POST) { } elseif ($_POST['stopbtn']!= "") { $action = gettext("Stop"); - $processes_running = trim(shell_exec('/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep '.$fn.' | /usr/bin/grep -v pflog')); + $processes_running = trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/egrep -v '(pflog|grep)'")); //explode processes into an array, (delimiter is new line) $processes_running_array = explode("\n", $processes_running); @@ -194,7 +194,7 @@ include("fbegin.inc"); <?php /* check to see if packet capture tcpdump is already running */ - $processcheck = (trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/grep -v pflog"))); + $processcheck = (trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/egrep -v '(pflog|grep)'"))); if ($processcheck != "") $processisrunning = true; diff --git a/usr/local/www/system_advanced_firewall.php b/usr/local/www/system_advanced_firewall.php index e532b78..0cdaad7 100644 --- a/usr/local/www/system_advanced_firewall.php +++ b/usr/local/www/system_advanced_firewall.php @@ -144,7 +144,7 @@ if ($_POST) { if($_POST['bypassstaticroutes'] == "yes") $config['filter']['bypassstaticroutes'] = $_POST['bypassstaticroutes']; - else + elseif(isset($config['filter']['bypassstaticroutes'])) unset($config['filter']['bypassstaticroutes']); if($_POST['disablescrub'] == "yes") diff --git a/usr/local/www/vpn_l2tp.php b/usr/local/www/vpn_l2tp.php index 3cb6e4e..37eac0f 100644 --- a/usr/local/www/vpn_l2tp.php +++ b/usr/local/www/vpn_l2tp.php @@ -50,6 +50,9 @@ $pconfig['localip'] = $l2tpcfg['localip']; $pconfig['l2tp_subnet'] = $l2tpcfg['l2tp_subnet']; $pconfig['mode'] = $l2tpcfg['mode']; $pconfig['interface'] = $l2tpcfg['interface']; +$pconfig['l2tp_dns1'] = $l2tpcfg['dns1']; +$pconfig['l2tp_dns2'] = $l2tpcfg['dns2']; +$pconfig['wins'] = $l2tpcfg['wins']; $pconfig['radiusenable'] = isset($l2tpcfg['radius']['enable']); $pconfig['radacct_enable'] = isset($l2tpcfg['radius']['accounting']); $pconfig['radiusserver'] = $l2tpcfg['radius']['server']; @@ -126,8 +129,26 @@ if ($_POST) { $l2tpcfg['radius']['secret'] = $_POST['radiussecret']; $l2tpcfg['secret'] = $_POST['secret']; + if($_POST['wins']) + $l2tpcfg['wins'] = $_POST['wins']; + else + unset($l2tpcfg['wins']); + $l2tpcfg['paporchap'] = $_POST['paporchap']; + + if ($_POST['l2tp_dns1'] == "") { + if (isset($l2tpcfg['dns1'])) + unset($l2tpcfg['dns1']); + } else + $l2tpcfg['dns1'] = $_POST['l2tp_dns1']; + + if ($_POST['l2tp_dns2'] == "") { + if (isset($l2tpcfg['dns2'])) + unset($l2tpcfg['dns2']); + } else + $l2tpcfg['dns2'] = $_POST['l2tp_dns2']; + if($_POST['radiusenable'] == "yes") $l2tpcfg['radius']['enable'] = true; else @@ -183,6 +204,8 @@ function enable_change(enable_over) { document.iform.interface.disabled = 0; document.iform.n_l2tp_units.disabled = 0; document.iform.secret.disabled = 0; + document.iform.l2tp_dns1.disabled = 0; + document.iform.l2tp_dns2.disabled = 0; /* fix colors */ document.iform.remoteip.style.backgroundColor = '#FFFFFF'; document.iform.localip.style.backgroundColor = '#FFFFFF'; @@ -218,6 +241,8 @@ function enable_change(enable_over) { document.iform.interface.disabled = 1; document.iform.n_l2tp_units.disabled = 1; document.iform.l2tp_subnet.disabled = 1; + document.iform.l2tp_dns1.disabled = 1; + document.iform.l2tp_dns2.disabled = 1; document.iform.paporchap.disabled = 1; document.iform.remoteip.disabled = 1; document.iform.localip.disabled = 1; @@ -360,6 +385,22 @@ function enable_change(enable_over) { <?=gettext("Specifies which protocol to use for authentication.");?><br /> </td> </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("L2TP DNS Servers"); ?></td> + <td width="78%" class="vtable"> + <?=$mandfldhtml;?><input name="l2tp_dns1" type="text" class="formfld unknown" id="l2tp_dns1" size="20" value="<?=htmlspecialchars($pconfig['l2tp_dns1']);?>"> + <br> + <input name="l2tp_dns2" type="text" class="formfld unknown" id="l2tp_dns2" size="20" value="<?=htmlspecialchars($pconfig['l2tp_dns2']);?>"> + <br> + <?=gettext("primary and secondary DNS servers assigned to L2TP clients"); ?><br> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("WINS Server"); ?></td> + <td width="78%" valign="top" class="vtable"> + <input name="wins" class="formfld unknown" id="wins" size="20" value="<?=htmlspecialchars($pconfig['wins']);?>"> + </td> + </tr> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS"); ?></td> <td width="78%" class="vtable"> |