From 1f676b67451375df5e9e22ea5939b73d7d59b6fe Mon Sep 17 00:00:00 2001 From: Ermal Date: Thu, 3 Feb 2011 19:12:43 +0000 Subject: Ticket #259. Actually kill dhlient when the interface type changes before going through apply changes otherwise the information would be lost and dhclient will remain running. --- usr/local/www/interfaces.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'usr') diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 98d449b..d1fa6f7 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -517,7 +517,12 @@ if ($_POST['apply']) { if (in_array($wancfg['ipaddr'], array("ppp", "pppoe", "pptp", "l2tp"))) { $wancfg['if'] = $a_ppps[$pppid]['ports']; unset($a_ppps[$pppid]); + } else if ($wancfg['type'] == "dhcp") { + $pid = find_dhclient_process($realif); + if($pid) + posix_kill($pid, SIGTERM); } + } $ppp = array(); if ($wancfg['ipaddr'] != "ppp") -- cgit v1.1 From 45d72d8215ecf3dc2ba7eff8a8f146a233216d94 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 3 Feb 2011 17:39:07 -0500 Subject: Adding a page that will allow uploading of crash (panic) data. Once the server piece is in place we will detect crash data in php and redirect to this page to prompt if the operator would like to upload the data. Remove the crash data after upload or if the operator does not want to upload the crash data. --- usr/local/www/crash_reporter.php | 126 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100755 usr/local/www/crash_reporter.php (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php new file mode 100755 index 0000000..84f2ef7 --- /dev/null +++ b/usr/local/www/crash_reporter.php @@ -0,0 +1,126 @@ + + $post = array(); + $counter = 0; + foreach($files as $file) { + $tmp = array(); + $tmp["file{$counter}"] = "@{$file}"; + $post[] = $tmp; + $counter++; + } + curl_setopt($ch, CURLOPT_POSTFIELDS, $post); + $response = curl_exec($ch); +} + +function output_crash_reporter_html($crash_reports) { + echo "" . gettext("Unfortunately we have detected a kernel crash (panic).") . "

"; + echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; + echo "

Contents of crash reports:
"; + echo " "; + echo "

"; + echo ""; + echo ""; + echo "

"; + echo ""; +} + +$pgtitle = array(gettext("Diagnostics"),gettext("Halt system")); +include('head.inc'); + +?> + + + + + +
+

+ +"; + echo gettext("Uploading..."); + echo "

"; + if(is_array($files_to_upload)) { + upload_crash_report($files_to_upload); + exec("rm /var/crash/*"); + echo gettext("Crash files have been submitted for inspection."); + echo "

" . gettext("Continue") . ""; + } else { + echo "Could not find any crash files."; + } + } else if($_POST['Submit'] == "No") { + exec("rm /var/crash/*"); + Header("Location: /"); + exit; + } else { + $crash_files = glob("/var/crash/*"); + if(is_array($crash_files)) + foreach($crash_files as $cf) + $crash_reports .= file_get_contents($cf); + else + echo "Could not locate any crash data."; + output_crash_reporter_html($crash_reports); + } +?> + + + + + -- cgit v1.1 From 528d5abfa86b4b55ce90fa81be2c3c2183bbaec6 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 3 Feb 2011 17:45:07 -0500 Subject: Set priv info --- usr/local/www/crash_reporter.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 84f2ef7..84008f3 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -32,10 +32,10 @@ */ ##|+PRIV -##|*IDENT=page-diagnostics-haltsystem -##|*NAME=Diagnostics: Halt system page -##|*DESCR=Allow access to the 'Diagnostics: Halt system' page. -##|*MATCH=halt.php* +##|*IDENT=page-diagnostics-crash-reporter +##|*NAME=Crash reporter +##|*DESCR=Uploads crash reports to pfSense and or deletes crash reports. +##|*MATCH=crash_reporter.php* ##|-PRIV require("guiconfig.inc"); @@ -61,20 +61,21 @@ function upload_crash_report($files) { } curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $response = curl_exec($ch); + return $response; } function output_crash_reporter_html($crash_reports) { - echo "" . gettext("Unfortunately we have detected a kernel crash (panic).") . "

"; - echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; - echo "

Contents of crash reports:
"; - echo " "; - echo "

"; - echo ""; - echo ""; - echo "

"; - echo "
"; + echo "" . gettext("Unfortunately we have detected a kernel crash (panic).") . "

"; + echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; + echo "

Contents of crash reports:
"; + echo " "; + echo "

"; + echo ""; + echo ""; + echo "

"; + echo ""; } $pgtitle = array(gettext("Diagnostics"),gettext("Halt system")); -- cgit v1.1 From 886caa75e9156f4724dd38a0d533bc6f24428bb5 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 3 Feb 2011 17:46:28 -0500 Subject: Remove formatting in between textarea --- usr/local/www/crash_reporter.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 84008f3..a8f4ad0 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -68,9 +68,7 @@ function output_crash_reporter_html($crash_reports) { echo "" . gettext("Unfortunately we have detected a kernel crash (panic).") . "

"; echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; echo "

Contents of crash reports:
"; - echo " "; + echo ""; echo "

"; echo ""; echo ""; -- cgit v1.1 From 421f72a79331a16081e8472a563b4b124d00ea09 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 3 Feb 2011 17:47:46 -0500 Subject: Fix url --- usr/local/www/crash_reporter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index a8f4ad0..aef48fb 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -76,7 +76,7 @@ function output_crash_reporter_html($crash_reports) { echo ""; } -$pgtitle = array(gettext("Diagnostics"),gettext("Halt system")); +$pgtitle = array(gettext("Diagnostics"),gettext("Crash reporter")); include('head.inc'); ?> @@ -85,7 +85,7 @@ include('head.inc'); -

+

Date: Fri, 4 Feb 2011 04:32:00 -0700 Subject: Remove redundant input validation for source port that also prevents use of port ranges. --- usr/local/www/firewall_nat_out_edit.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index f03bded..c0308bb 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -139,9 +139,6 @@ if ($_POST) { if ($_POST['source_subnet'] && !is_numericint($_POST['source_subnet'])) { $input_errors[] = gettext("A valid source bit count must be specified."); } - if ($protocol_uses_ports && $_POST['sourceport'] && !is_numericint($_POST['sourceport'])) { - $input_errors[] = gettext("A valid source port must be specified."); - } if ($_POST['destination_type'] != "any") { if ($_POST['destination'] && !is_ipaddr($_POST['destination'])) { $input_errors[] = gettext("A valid destination must be specified."); -- cgit v1.1 From 891012ce078fc49deaaff8fae0954b2caadb2d50 Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 4 Feb 2011 04:49:47 -0700 Subject: Change destination back to the field type for fields that allow an alias - they appear to work there (or at least doesn't say it is an error?). --- usr/local/www/firewall_nat_1to1_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/firewall_nat_1to1_edit.php b/usr/local/www/firewall_nat_1to1_edit.php index 1a3ce77..b8956af 100755 --- a/usr/local/www/firewall_nat_1to1_edit.php +++ b/usr/local/www/firewall_nat_1to1_edit.php @@ -413,7 +413,7 @@ function typesel_change() {    - + / + +
+ +
+ + + + +
+ + +
+ +
- + -- cgit v1.1 From 6a97db1ccd854d41801dcc5d51162f32f9a9d45c Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 4 Feb 2011 06:20:58 -0700 Subject: Allow aliases to be entered for source and destination addresses of outbound NAT rules. --- usr/local/www/firewall_nat_out_edit.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index c0308bb..91c2ff9 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -132,7 +132,7 @@ if ($_POST) { $input_errors[] = gettext("You must supply either a valid port for the nat port entry."); if ($_POST['source_type'] != "any") { - if ($_POST['source'] && !is_ipaddr($_POST['source']) && $_POST['source'] <> "any") { + if ($_POST['source'] && !is_ipaddroralias($_POST['source']) && $_POST['source'] <> "any") { $input_errors[] = gettext("A valid source must be specified."); } } @@ -140,7 +140,7 @@ if ($_POST) { $input_errors[] = gettext("A valid source bit count must be specified."); } if ($_POST['destination_type'] != "any") { - if ($_POST['destination'] && !is_ipaddr($_POST['destination'])) { + if ($_POST['destination'] && !is_ipaddroralias($_POST['destination'])) { $input_errors[] = gettext("A valid destination must be specified."); } } @@ -182,6 +182,8 @@ if ($_POST) { /* if user has selected any as source, set it here */ if($_POST['source_type'] == "any") { $osn = "any"; + } else if(is_alias($_POST['source'])) { + $osn = $_POST['source']; } else { $osn = gen_subnet($_POST['source'], $_POST['source_subnet']) . "/" . $_POST['source_subnet']; } @@ -189,6 +191,8 @@ if ($_POST) { /* check for existing entries */ if ($_POST['destination_type'] == "any") { $ext = "any"; + } else if(is_alias($_POST['destination'])) { + $ext = $_POST['destination']; } else { $ext = gen_subnet($_POST['destination'], $_POST['destination_subnet']) . "/" . $_POST['destination_subnet']; } -- cgit v1.1 From 20f598936464a6472b3f2666904536c69126e28d Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Fri, 4 Feb 2011 06:28:48 -0700 Subject: Display the source subnet bits as 32 rather than 0 if it is empty. --- usr/local/www/firewall_nat_out_edit.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'usr') diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index 91c2ff9..b730476 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -72,6 +72,8 @@ if (isset($_GET['dup'])) { if (isset($id) && $a_out[$id]) { $pconfig['protocol'] = $a_out[$id]['protocol']; list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']); + if (!is_numeric($pconfig['source_subnet'])) + $pconfig['source_subnet'] = 32; $pconfig['sourceport'] = $a_out[$id]['sourceport']; address_to_pconfig($a_out[$id]['destination'], $pconfig['destination'], $pconfig['destination_subnet'], $pconfig['destination_not'], -- cgit v1.1 From 9fcf15773caa87261314bfe6e8a33a3f0d1d18bd Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sat, 5 Feb 2011 03:10:26 -0500 Subject: the only thing ping_hosts.sh is used for is pinging IPsec hosts. comment out all this complexity that makes it do way more than it needs to (and was throwing an error on rrd, it shouldn't be touching rrd) --- usr/local/bin/ping_hosts.sh | 100 ++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'usr') diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 8455015..1d893c2 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -69,56 +69,56 @@ for TOPING in $PINGHOSTS ; do echo Processing $DSTIP # Look for a service being down ping -c $COUNT -S $SRCIP $DSTIP - if [ $? -eq 0 ]; then - # Host is up - # Read in previous status - PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` - if [ "$PREVIOUSSTATUS" = "DOWN" ]; then - # Service restored - if [ "$SERVICERESTOREDSCRIPT" != "" ]; then - echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" - echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor - sh -c $SERVICERESTOREDSCRIPT - fi - fi - echo "UP" > /var/db/pingstatus/$DSTIP - else - # Host is down - PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` - if [ "$PREVIOUSSTATUS" = "UP" ]; then - # Service is down - if [ "$FAILURESCRIPT" != "" ]; then - echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" - echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor - sh -c $FAILURESCRIPT - fi - fi - echo "DOWN" > /var/db/pingstatus/$DSTIP - fi - echo "Checking ping time $DSTIP" - # Look at ping values themselves - PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` - echo "Ping returned $?" - echo $PINGTIME > /var/db/pingmsstatus/$DSTIP - if [ "$THRESHOLD" != "" ]; then - if [ "$PINGTIME" -gt "$THRESHOLD" ]; then - echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" - echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor - sh -c $FAILURESCRIPT - fi - fi - # Wan ping time threshold - WANTIME=`rrdtool fetch /var/db/rrd/wan-quality.rrd AVERAGE -r 120 -s -1min -e -1min | grep ":" | cut -f3 -d" " | cut -d"e" -f1` - echo "Checking wan ping time $WANTIME" - echo $WANTIME > /var/db/wanaverage - if [ "$WANTHRESHOLD" != "" ]; then - if [ "$WANTIME" -gt "$WANTHRESHOLD" ]; then - echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" - echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor - sh -c $FAILURESCRIPT - fi - fi - sleep 1 +# if [ $? -eq 0 ]; then +# # Host is up +# # Read in previous status +# PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` +# if [ "$PREVIOUSSTATUS" = "DOWN" ]; then +# # Service restored +# if [ "$SERVICERESTOREDSCRIPT" != "" ]; then +# echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" +# echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor +# sh -c $SERVICERESTOREDSCRIPT +# fi +# fi +# echo "UP" > /var/db/pingstatus/$DSTIP +# else +# # Host is down +# PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` +# if [ "$PREVIOUSSTATUS" = "UP" ]; then +# # Service is down +# if [ "$FAILURESCRIPT" != "" ]; then +# echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" +# echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor +# sh -c $FAILURESCRIPT +# fi +# fi +# echo "DOWN" > /var/db/pingstatus/$DSTIP +# fi +# echo "Checking ping time $DSTIP" +# # Look at ping values themselves +# PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` +# echo "Ping returned $?" +# echo $PINGTIME > /var/db/pingmsstatus/$DSTIP +# if [ "$THRESHOLD" != "" ]; then +# if [ "$PINGTIME" -gt "$THRESHOLD" ]; then +# echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" +# echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor +# sh -c $FAILURESCRIPT +# fi +# fi +# # Wan ping time threshold +# WANTIME=`rrdtool fetch /var/db/rrd/wan-quality.rrd AVERAGE -r 120 -s -1min -e -1min | grep ":" | cut -f3 -d" " | cut -d"e" -f1` +# echo "Checking wan ping time $WANTIME" +# echo $WANTIME > /var/db/wanaverage +# if [ "$WANTHRESHOLD" != "" ]; then +# if [ "$WANTIME" -gt "$WANTHRESHOLD" ]; then +# echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" +# echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor +# sh -c $FAILURESCRIPT +# fi +# fi +# sleep 1 done exit 0 -- cgit v1.1 From bfa49caee338932b2adf94765307d588f0dce09a Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 6 Feb 2011 00:05:37 -0500 Subject: Revert "the only thing ping_hosts.sh is used for is pinging IPsec hosts. comment out all this complexity that makes it do way more than it needs to (and was throwing an error on rrd, it shouldn't be touching rrd)" this is used by at least the DNS server pkg This reverts commit 9fcf15773caa87261314bfe6e8a33a3f0d1d18bd. --- usr/local/bin/ping_hosts.sh | 100 ++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'usr') diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 1d893c2..8455015 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -69,56 +69,56 @@ for TOPING in $PINGHOSTS ; do echo Processing $DSTIP # Look for a service being down ping -c $COUNT -S $SRCIP $DSTIP -# if [ $? -eq 0 ]; then -# # Host is up -# # Read in previous status -# PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` -# if [ "$PREVIOUSSTATUS" = "DOWN" ]; then -# # Service restored -# if [ "$SERVICERESTOREDSCRIPT" != "" ]; then -# echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" -# echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor -# sh -c $SERVICERESTOREDSCRIPT -# fi -# fi -# echo "UP" > /var/db/pingstatus/$DSTIP -# else -# # Host is down -# PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` -# if [ "$PREVIOUSSTATUS" = "UP" ]; then -# # Service is down -# if [ "$FAILURESCRIPT" != "" ]; then -# echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" -# echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor -# sh -c $FAILURESCRIPT -# fi -# fi -# echo "DOWN" > /var/db/pingstatus/$DSTIP -# fi -# echo "Checking ping time $DSTIP" -# # Look at ping values themselves -# PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` -# echo "Ping returned $?" -# echo $PINGTIME > /var/db/pingmsstatus/$DSTIP -# if [ "$THRESHOLD" != "" ]; then -# if [ "$PINGTIME" -gt "$THRESHOLD" ]; then -# echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" -# echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor -# sh -c $FAILURESCRIPT -# fi -# fi -# # Wan ping time threshold -# WANTIME=`rrdtool fetch /var/db/rrd/wan-quality.rrd AVERAGE -r 120 -s -1min -e -1min | grep ":" | cut -f3 -d" " | cut -d"e" -f1` -# echo "Checking wan ping time $WANTIME" -# echo $WANTIME > /var/db/wanaverage -# if [ "$WANTHRESHOLD" != "" ]; then -# if [ "$WANTIME" -gt "$WANTHRESHOLD" ]; then -# echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" -# echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor -# sh -c $FAILURESCRIPT -# fi -# fi -# sleep 1 + if [ $? -eq 0 ]; then + # Host is up + # Read in previous status + PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` + if [ "$PREVIOUSSTATUS" = "DOWN" ]; then + # Service restored + if [ "$SERVICERESTOREDSCRIPT" != "" ]; then + echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" + echo "$DSTIP is UP, previous state was DOWN .. Running $SERVICERESTOREDSCRIPT" | logger -p daemon.info -i -t PingMonitor + sh -c $SERVICERESTOREDSCRIPT + fi + fi + echo "UP" > /var/db/pingstatus/$DSTIP + else + # Host is down + PREVIOUSSTATUS=`cat /var/db/pingstatus/$DSTIP` + if [ "$PREVIOUSSTATUS" = "UP" ]; then + # Service is down + if [ "$FAILURESCRIPT" != "" ]; then + echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" + echo "$DSTIP is DOWN, previous state was UP .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor + sh -c $FAILURESCRIPT + fi + fi + echo "DOWN" > /var/db/pingstatus/$DSTIP + fi + echo "Checking ping time $DSTIP" + # Look at ping values themselves + PINGTIME=`ping -c 1 -S $SRCIP $DSTIP | awk '{ print $7 }' | grep time | cut -d "=" -f2` + echo "Ping returned $?" + echo $PINGTIME > /var/db/pingmsstatus/$DSTIP + if [ "$THRESHOLD" != "" ]; then + if [ "$PINGTIME" -gt "$THRESHOLD" ]; then + echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" + echo "$DSTIP has exceeded ping threshold $PINGTIME / $THRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor + sh -c $FAILURESCRIPT + fi + fi + # Wan ping time threshold + WANTIME=`rrdtool fetch /var/db/rrd/wan-quality.rrd AVERAGE -r 120 -s -1min -e -1min | grep ":" | cut -f3 -d" " | cut -d"e" -f1` + echo "Checking wan ping time $WANTIME" + echo $WANTIME > /var/db/wanaverage + if [ "$WANTHRESHOLD" != "" ]; then + if [ "$WANTIME" -gt "$WANTHRESHOLD" ]; then + echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" + echo "$DSTIP has exceeded wan ping threshold $WANTIME / $WANTHRESHOLD .. Running $FAILURESCRIPT" | logger -p daemon.info -i -t PingMonitor + sh -c $FAILURESCRIPT + fi + fi + sleep 1 done exit 0 -- cgit v1.1 From 020b954f200c585dd8c498c617d7fd3f91f02eb3 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 6 Feb 2011 00:13:55 -0500 Subject: at least don't touch rrd here, that rrd won't exist anyway --- usr/local/bin/ping_hosts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/bin/ping_hosts.sh b/usr/local/bin/ping_hosts.sh index 8455015..97629c4 100755 --- a/usr/local/bin/ping_hosts.sh +++ b/usr/local/bin/ping_hosts.sh @@ -108,7 +108,7 @@ for TOPING in $PINGHOSTS ; do fi fi # Wan ping time threshold - WANTIME=`rrdtool fetch /var/db/rrd/wan-quality.rrd AVERAGE -r 120 -s -1min -e -1min | grep ":" | cut -f3 -d" " | cut -d"e" -f1` + #WANTIME=`rrdtool fetch /var/db/rrd/wan-quality.rrd AVERAGE -r 120 -s -1min -e -1min | grep ":" | cut -f3 -d" " | cut -d"e" -f1` echo "Checking wan ping time $WANTIME" echo $WANTIME > /var/db/wanaverage if [ "$WANTHRESHOLD" != "" ]; then -- cgit v1.1 From 49c8f9640f1ae394050f2163c7be6421121a2f26 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 3 Feb 2011 18:20:08 -0500 Subject: gettext() --- usr/local/www/crash_reporter.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index aef48fb..76ce455 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -67,7 +67,8 @@ function upload_crash_report($files) { function output_crash_reporter_html($crash_reports) { echo "" . gettext("Unfortunately we have detected a kernel crash (panic).") . "

"; echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; - echo "

Contents of crash reports:
"; + echo "

"; + echo gettext("Contents of crash reports") . ":
"; echo ""; echo "

"; echo ""; @@ -89,7 +90,7 @@ include('head.inc');

Date: Sun, 6 Feb 2011 13:11:45 -0500 Subject: Redirect to crash reporter if a crash exists for processing. The crash reporter will either upload the data per the operators consent and or delete the data afterwards and redirect back. --- usr/local/www/index.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'usr') diff --git a/usr/local/www/index.php b/usr/local/www/index.php index c1fdc26..1ea8e5b 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -42,6 +42,14 @@ ##|*MATCH=index.php* ##|-PRIV +$crash = glob("/var/crash/*"); +if(is_array($crash)) { + if(count($crash) > 0) { + Header("Location: /crash_reporter.php"); + exit; + } +} + // Turn off csrf for the dashboard $nocsrf = true; -- cgit v1.1 From 52cdb50b3df5facf9de1318f7318fea2cd09fbb0 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 6 Feb 2011 13:41:42 -0500 Subject: Set textarea size --- usr/local/www/crash_reporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 76ce455..9ac0eaa 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -69,7 +69,7 @@ function output_crash_reporter_html($crash_reports) { echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; echo "

"; echo gettext("Contents of crash reports") . ":
"; - echo ""; + echo ""; echo "

"; echo ""; echo ""; -- cgit v1.1 From 3a6cda80526d676a709c6ca1190d0f57f35a741c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 6 Feb 2011 13:51:21 -0500 Subject: Correctly detect amount of files in /var/crash --- usr/local/www/crash_reporter.php | 8 ++++---- usr/local/www/index.php | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 9ac0eaa..2dd9a50 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -69,11 +69,11 @@ function output_crash_reporter_html($crash_reports) { echo "" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "

"; echo "

"; echo gettext("Contents of crash reports") . ":
"; - echo ""; + echo ""; + echo "

"; + echo ""; + echo ""; echo "

"; - echo ""; - echo ""; - echo "

"; echo "
"; } diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 1ea8e5b..30c369d 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -43,8 +43,18 @@ ##|-PRIV $crash = glob("/var/crash/*"); +$x = 0; if(is_array($crash)) { - if(count($crash) > 0) { + foreach($crash as $c) { + if($c == ".") + continue; + if($c == "..") + continue; + if($c == "") + continue; + $x++; + } + if($x > 0) { Header("Location: /crash_reporter.php"); exit; } -- cgit v1.1 From 4f09471ce72ea1cad772a5ed98b68df884b7b876 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 6 Feb 2011 14:24:35 -0500 Subject: Crash reporter is now working. --- usr/local/www/crash_reporter.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'usr') diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 2dd9a50..06f3bdf 100755 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -43,22 +43,19 @@ require("functions.inc"); require("captiveportal.inc"); function upload_crash_report($files) { + $post = array(); + $counter = 0; + foreach($files as $file) { + $post["file{$counter}"] = "@{$file}"; + $counter++; + } $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); - curl_setopt($ch, CURLOPT_URL, "crashreporter.pfsense.org/submit.php"); + curl_setopt($ch, CURLOPT_URL, "http://crashreporter.pfsense.org/crash_reporter.php"); curl_setopt($ch, CURLOPT_POST, true); - // same as - $post = array(); - $counter = 0; - foreach($files as $file) { - $tmp = array(); - $tmp["file{$counter}"] = "@{$file}"; - $post[] = $tmp; - $counter++; - } curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $response = curl_exec($ch); return $response; @@ -87,7 +84,6 @@ include('head.inc');
-

"; if(is_array($files_to_upload)) { - upload_crash_report($files_to_upload); + $resp = upload_crash_report($files_to_upload); + print_r($resp); exec("rm /var/crash/*"); echo gettext("Crash files have been submitted for inspection."); echo "

" . gettext("Continue") . ""; -- cgit v1.1 From f5208bf25829200c3d5d2833607cb2077f4d8bbb Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 6 Feb 2011 14:40:35 -0500 Subject: If product name == pfSense show a link to redmine / bug database --- usr/local/www/fbegin.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 6efb7a6..734b9a2 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -212,6 +212,8 @@ $diagnostics_menu = msort(array_merge($diagnostics_menu, return_ext_menu("Diagno if(! $g['disablehelpmenu']) { $help_menu = array(); $help_menu[] = array("About this Page", $helpurl); + if($g['product_name'] == "pfSense") + $help_menu[] = array("Bug Database", "http://rcs.pfsense.org/j.php?jumpto=redmine"); $help_menu[] = array("User Forum", "http://www.pfsense.org/j.php?jumpto=forum"); $help_menu[] = array("Documentation", "http://www.pfsense.org/j.php?jumpto=doc"); $help_menu[] = array("Developers Wiki", "http://www.pfsense.org/j.php?jumpto=devwiki"); @@ -431,4 +433,4 @@ if(is_subsystem_dirty('packagelock')) { print_info_box(gettext("Packages are currently being reinstalled in the background.

Do not make changes in the GUI until this is complete.") . "

"); } $pgtitle_output = true; -?> +?> \ No newline at end of file -- cgit v1.1 From 998930abd0f319cd662146f8073eb5909575150a Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 6 Feb 2011 14:44:10 -0500 Subject: fix url for jumpto --- usr/local/www/fbegin.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 734b9a2..8f94164 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -213,7 +213,7 @@ if(! $g['disablehelpmenu']) { $help_menu = array(); $help_menu[] = array("About this Page", $helpurl); if($g['product_name'] == "pfSense") - $help_menu[] = array("Bug Database", "http://rcs.pfsense.org/j.php?jumpto=redmine"); + $help_menu[] = array("Bug Database", "http://www.pfsense.org/j.php?jumpto=redmine"); $help_menu[] = array("User Forum", "http://www.pfsense.org/j.php?jumpto=forum"); $help_menu[] = array("Documentation", "http://www.pfsense.org/j.php?jumpto=doc"); $help_menu[] = array("Developers Wiki", "http://www.pfsense.org/j.php?jumpto=devwiki"); -- cgit v1.1