diff options
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/bin/ping_hosts.sh | 2 | ||||
-rwxr-xr-x | usr/local/www/crash_reporter.php | 123 | ||||
-rwxr-xr-x | usr/local/www/fbegin.inc | 2 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_1to1_edit.php | 2 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_out_edit.php | 13 | ||||
-rwxr-xr-x | usr/local/www/index.php | 18 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 5 | ||||
-rwxr-xr-x | usr/local/www/system_firmware_settings.php | 37 |
8 files changed, 194 insertions, 8 deletions
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 diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php new file mode 100755 index 0000000..06f3bdf --- /dev/null +++ b/usr/local/www/crash_reporter.php @@ -0,0 +1,123 @@ +<?php +/* $Id$ */ +/* + crash_reporter.php + part of pfSense + Copyright (C) 2011 Scott Ullrich + All rights reserved. + + 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. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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 + AUTHOR 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. +*/ +/* + pfSense_MODULE: header +*/ + +##|+PRIV +##|*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"); +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, "http://crashreporter.pfsense.org/crash_reporter.php"); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post); + $response = curl_exec($ch); + return $response; +} + +function output_crash_reporter_html($crash_reports) { + echo "<strong>" . gettext("Unfortunately we have detected a kernel crash (panic).") . "</strong></p>"; + echo "<strong>" . gettext("Would you like to submit the crash debug logs to the pfSense developers for inspection?") . "</strong></p>"; + echo "<p>"; + echo gettext("Contents of crash reports") . ":<br/>"; + echo "<textarea rows='40' cols='65' name='crashreports'>{$crash_reports}</textarea>"; + echo "<p/>"; + echo "<input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Yes") . "\">"; + echo "<input name=\"Submit\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("No") . "\">"; + echo "<p/>"; + echo "</form>"; +} + +$pgtitle = array(gettext("Diagnostics"),gettext("Crash reporter")); +include('head.inc'); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<?php include("fbegin.inc"); ?> + + <form action="crash_reporter.php" method="post"> + +<?php + if (gettext($_POST['Submit']) == "Yes") { + echo gettext("Processing..."); + exec("/usr/bin/gzip /var/crash/*"); + $files_to_upload = glob("/var/crash/*"); + echo "<p/>"; + echo gettext("Uploading..."); + echo "<p/>"; + if(is_array($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 "<p/><a href='/'>" . gettext("Continue") . "</a>"; + } else { + echo "Could not find any crash files."; + } + } else if(gettext($_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); + } +?> + +<?php include("fend.inc"); ?> + +</body> +</html> diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 2b3da3b..3fb1846 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -213,6 +213,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://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"); 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() { <tr> <td><?=gettext("Address:"); ?> </td> <td> - <input name="dst" type="text" class="formfld" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>"> + <input name="dst" type="text" autocomplete="off" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>"> / <select name="dstmask" class="formselect" id="dstmask"> <?php diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index f03bded..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'], @@ -132,18 +134,15 @@ 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."); } } 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'])) { + if ($_POST['destination'] && !is_ipaddroralias($_POST['destination'])) { $input_errors[] = gettext("A valid destination must be specified."); } } @@ -185,6 +184,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']; } @@ -192,6 +193,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']; } diff --git a/usr/local/www/index.php b/usr/local/www/index.php index c1fdc26..30c369d 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -42,6 +42,24 @@ ##|*MATCH=index.php* ##|-PRIV +$crash = glob("/var/crash/*"); +$x = 0; +if(is_array($crash)) { + foreach($crash as $c) { + if($c == ".") + continue; + if($c == "..") + continue; + if($c == "") + continue; + $x++; + } + if($x > 0) { + Header("Location: /crash_reporter.php"); + exit; + } +} + // Turn off csrf for the dashboard $nocsrf = true; diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index da729ae..76f618b 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -563,7 +563,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") diff --git a/usr/local/www/system_firmware_settings.php b/usr/local/www/system_firmware_settings.php index ea3c215..793b8fc 100755 --- a/usr/local/www/system_firmware_settings.php +++ b/usr/local/www/system_firmware_settings.php @@ -179,18 +179,53 @@ function enable_altfirmwareurl(enable_over) { <?=gettext("After updating, sync with the following repository/branch before reboot."); ?> </td> </tr> +<?php + if(is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) { + exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git config remote.origin.url", $output_str); + if(is_array($output_str) && !empty($output_str[0])) + $lastrepositoryurl = $output_str[0]; + unset($output_str); + } +?> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Repository URL"); ?></td> <td width="78%" class="vtable"> <input name="repositoryurl" type="input" class="formfld url" id="repositoryurl" size="64" value="<?php if ($gitcfg['repositoryurl']) echo $gitcfg['repositoryurl']; ?>"> +<?php if($lastrepositoryurl): ?> + <br /> + <?=sprintf(gettext("The most recently used repository was %s"), $lastrepositoryurl); ?> + <br /> + <?=gettext("This will be used if the field is left blank."); ?> +<?php endif; ?> </td> </tr> +<?php + if(is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) { + exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git branch", $output_str); + if(is_array($output_str)) { + foreach($output_str as $output_line) { + if(strstr($output_line, '* ')) { + $lastbranch = substr($output_line, 2); + break; + } + } + } + unset($output_str); + } +?> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Branch name"); ?></td> <td width="78%" class="vtable"> <input name="branch" type="input" class="formfld unknown" id="branch" size="64" value="<?php if ($gitcfg['branch']) echo $gitcfg['branch']; ?>"> +<?php if($lastbranch): ?> + <br /> + <?=sprintf(gettext("The most recently used branch was %s"), $lastbranch); ?> +<?php else: ?> + <br /> + <?=gettext("Usually the branch name is master"); ?> +<?php endif; ?> <br /> - <?=gettext("Sync will not be performed if a branch is not specified."); ?> + <?=gettext("Note: Sync will not be performed if a branch is not specified."); ?> </td> </tr> <?php endif; ?> |