summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2017-02-10 12:37:18 -0500
committerjim-p <jimp@pfsense.org>2017-02-10 12:42:17 -0500
commit804f6a165fbb80deac018be43e8d41607fa67594 (patch)
treec8f463878deca9b95de0f4f0b8fdd76478cc770f /src/usr
parent7a7559219f4fae2419285348dabd86788e5eefea (diff)
downloadpfsense-804f6a165fbb80deac018be43e8d41607fa67594.zip
pfsense-804f6a165fbb80deac018be43e8d41607fa67594.tar.gz
Sync up status.php with master, but keep the 2.3/10.3-specific parts. Fixes #7246
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/status.php241
1 files changed, 160 insertions, 81 deletions
diff --git a/src/usr/local/www/status.php b/src/usr/local/www/status.php
index 6806cca..e05b4ea 100644
--- a/src/usr/local/www/status.php
+++ b/src/usr/local/www/status.php
@@ -70,6 +70,7 @@
/* include all configuration functions */
require_once("guiconfig.inc");
require_once("functions.inc");
+require_once("gwlb.inc");
$output_path = "/tmp/status_output/";
$output_file = "/tmp/status_output.tgz";
@@ -80,7 +81,7 @@ if (is_dir($output_path)) {
unlink_if_exists($output_file);
mkdir($output_path);
-function doCmdT($title, $command) {
+function doCmdT($title, $command, $method) {
global $output_path, $output_file;
/* Fixup output directory */
@@ -134,7 +135,11 @@ function doCmdT($title, $command) {
$ofd = @fopen("{$output_path}/{$title}.txt", "w");
$execOutput = "";
$execStatus = "";
- exec ($command . " 2>&1", $execOutput, $execStatus);
+ if ($method == "exec") {
+ exec($command . " 2>&1", $execOutput, $execStatus);
+ } elseif ($method == "php_func") {
+ $execOutput = explode("\n", $command());
+ }
for ($i = 0; isset($execOutput[$i]); $i++) {
if ($i > 0) {
echo "\n";
@@ -151,10 +156,10 @@ function doCmdT($title, $command) {
}
/* Define a command, with a title, to be executed later. */
-function defCmdT($title, $command) {
+function defCmdT($title, $command, $method = "exec") {
global $commands;
$title = htmlspecialchars($title, ENT_NOQUOTES);
- $commands[] = array($title, $command);
+ $commands[] = array($title, $command, $method);
}
/* List all of the commands as an index. */
@@ -165,7 +170,7 @@ function listCmds() {
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
print('<div class="panel panel-default">');
- print('<div class="panel-heading"><h2 class="panel-title">' . gettext("System Status on ") . $currentDate . '</h2></div>');
+ print('<div class="panel-heading"><h2 class="panel-title">' . sprintf(gettext("Firewall Status on %s"), $currentDate) . '</h2></div>');
print('<div class="panel-body">');
print(' <div class="content">');
print("\n<p>" . gettext("This status page includes the following information") . ":\n");
@@ -184,114 +189,190 @@ function listCmds() {
function execCmds() {
global $commands;
for ($i = 0; isset($commands[$i]); $i++) {
- doCmdT($commands[$i][0], $commands[$i][1]);
+ doCmdT($commands[$i][0], $commands[$i][1], $commands[$i][2]);
}
}
+function get_firewall_info() {
+ global $g, $output_path;
+ /* Firewall Platform/Serial */
+ $firewall_info = "Product Name: " . htmlspecialchars($g['product_name']);
+ $platform = system_identify_specific_platform();
+ if (!empty($platform['descr'])) {
+ $firewall_info .= "<br/>Platform: " . htmlspecialchars($platform['descr']);
+ }
+ $serial = system_get_serial();
+ if (!empty($serial)) {
+ $firewall_info .= "<br/>SN/UUID: " . htmlspecialchars($serial);
+ }
+
+ if (!empty($g['product_version_string'])) {
+ $firewall_info .= "<br/>" . htmlspecialchars($g['product_name']) .
+ " version: " . htmlspecialchars($g['product_version_string']);
+ }
+
+ if (file_exists('/etc/version.buildtime')) {
+ $build_time = file_get_contents('/etc/version.buildtime');
+ if (!empty($build_time)) {
+ $firewall_info .= "<br/>Built On: " . htmlspecialchars($build_time);
+ }
+ }
+ if (file_exists('/etc/version.lastcommit')) {
+ $build_commit = file_get_contents('/etc/version.lastcommit');
+ if (!empty($build_commit)) {
+ $firewall_info .= "<br/>Last Commit: " . htmlspecialchars($build_commit);
+ }
+ }
+
+ if (file_exists('/etc/version.gitsync')) {
+ $gitsync = file_get_contents('/etc/version.gitsync');
+ if (!empty($gitsync)) {
+ $firewall_info .= "<br/>A gitsync was performed at " .
+ date("D M j G:i:s T Y", filemtime('/etc/version.gitsync')) .
+ " to commit " . htmlspecialchars($gitsync);
+ }
+ }
+
+ file_put_contents("{$output_path}/Product Info.txt", str_replace("<br/>", "\n", $firewall_info) . "\n");
+ return $firewall_info;
+}
+
+function get_gateway_status() {
+ return return_gateways_status_text(true, false);
+}
+
global $g, $config;
/* Set up all of the commands we want to execute. */
-/* System stats/info */
-defCmdT("System Uptime", "/usr/bin/uptime");
-defCmdT("Interfaces", "/sbin/ifconfig -a");
-defCmdT("Interface Statistics", "/usr/bin/netstat -nWi");
-defCmdT("Top Process Info", "/usr/bin/top | /usr/bin/head -n5");
-defCmdT("Processes", "/bin/ps xauww");
-defCmdT("Mounted Filesystems", "/sbin/mount");
-defCmdT("Free Disk Space", "/bin/df -hi");
-defCmdT("Routing tables", "/usr/bin/netstat -nWr");
-defCmdT("Mbuf Usage", "/usr/bin/netstat -mb");
-defCmdT("VMStat", "/usr/bin/vmstat -afimsz");
-defCmdT("Sockets", "/usr/bin/sockstat");
+/* OS stats/info */
+defCmdT("OS-Uptime", "/usr/bin/uptime");
+defCmdT("Network-Interfaces", "/sbin/ifconfig -a");
+defCmdT("Network-Interface Statistics", "/usr/bin/netstat -nWi");
+defCmdT("Process-Top Usage", "/usr/bin/top | /usr/bin/head -n5");
+defCmdT("Process-List", "/bin/ps xauwwd");
+defCmdT("Disk-Mounted Filesystems", "/sbin/mount");
+defCmdT("Disk-Free Space", "/bin/df -hi");
+defCmdT("Network-Routing tables", "/usr/bin/netstat -nWr");
+defCmdT("Network-Gateway Status", 'get_gateway_status', "php_func");
+defCmdT("Network-Mbuf Usage", "/usr/bin/netstat -mb");
+defCmdT("Network-Protocol Statistics", "/usr/bin/netstat -s");
+defCmdT("Network-Sockets", "/usr/bin/sockstat");
+defCmdT("Network-ARP Table", "/usr/sbin/arp -an");
+defCmdT("Network-NDP Table", "/usr/sbin/ndp -na");
+defCmdT("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
/* Firewall rules and info */
-defCmdT("Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
-defCmdT("Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
-defCmdT("Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
-defCmdT("pf NAT Rules", "/sbin/pfctl -vvsn");
-defCmdT("pf Firewall Rules", "/sbin/pfctl -vvsr");
-defCmdT("pf Tables", "/sbin/pfctl -vs Tables");
-defCmdT("pf State Table Contents", "/sbin/pfctl -vvss");
-defCmdT("pf Info", "/sbin/pfctl -si");
-defCmdT("pf Show All", "/sbin/pfctl -sa");
-defCmdT("pf Queues", "/sbin/pfctl -s queue -v");
-defCmdT("pf OSFP", "/sbin/pfctl -s osfp");
-defCmdT("pfsync Stats", "/usr/bin/netstat -s -ppfsync");
-defCmdT("pftop Default", "/usr/local/sbin/pftop -a -b");
-defCmdT("pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
-defCmdT("pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
-defCmdT("pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
-defCmdT("pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
-defCmdT("pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
+defCmdT("Firewall-Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
+defCmdT("Firewall-Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
+defCmdT("Firewall-Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
+defCmdT("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
+defCmdT("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
+defCmdT("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
+defCmdT("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
+defCmdT("Firewall-pf Info", "/sbin/pfctl -si");
+defCmdT("Firewall-pf Show All", "/sbin/pfctl -sa");
+defCmdT("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
+defCmdT("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
+defCmdT("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
+defCmdT("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
+defCmdT("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
+defCmdT("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
+defCmdT("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
+defCmdT("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
+defCmdT("Firewall-IPFW Limiter Info", "/sbin/ipfw pipe show");
+defCmdT("Firewall-IPFW Queue Info", "/sbin/ipfw queue show");
if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
foreach ($config['captiveportal'] as $cpZone => $cpdata) {
if (isset($cpdata['enable'])) {
- defCmdT("IPFW Rules for {$cpdata['zone']}", "/sbin/ipfw -x " . escapeshellarg($cpdata['zoneid']) . " show");
+ defCmdT("Firewall-IPFW Rules for Captive Portal {$cpdata['zone']}", "/sbin/ipfw -x " . escapeshellarg($cpdata['zoneid']) . " show");
}
}
}
+
+if (is_array($config['load_balancer']['lbpool']) && is_array($config['load_balancer']['virtual_server'])) {
+ defCmdT("Load Balancer-Redirects", "/usr/local/sbin/relayctl show redirects");
+ defCmdT("Load Balancer-Relays", "/usr/local/sbin/relayctl show relays");
+ defCmdT("Load Balancer-Summary", "/usr/local/sbin/relayctl show summary");
+}
+
/* Configuration Files */
-defCmdT("Contents of var run", "/bin/ls /var/run");
-defCmdT("Contents of conf", "/bin/ls /conf");
+defCmdT("Disk-Contents of var run", "/bin/ls /var/run");
+defCmdT("Disk-Contents of conf", "/bin/ls /conf");
defCmdT("config.xml", "dumpconfigxml");
-defCmdT("resolv.conf", "/bin/cat /etc/resolv.conf");
-defCmdT("DHCP Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
-defCmdT("DHCPv6 Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
-defCmdT("strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf");
-defCmdT("IPsec Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
-defCmdT("IPsec Status", "/usr/local/sbin/ipsec statusall");
-defCmdT("SPD", "/sbin/setkey -DP");
-defCmdT("SAD", "/sbin/setkey -D");
+defCmdT("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
+defCmdT("DHCP-IPv4 Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
+defCmdT("DHCP-IPv6-Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
+defCmdT("IPsec-strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf");
+defCmdT("IPsec-Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
+defCmdT("IPsec-Status", "/usr/local/sbin/ipsec statusall");
+defCmdT("IPsec-SPD", "/sbin/setkey -DP");
+defCmdT("IPsec-SAD", "/sbin/setkey -D");
if (file_exists("/cf/conf/upgrade_log.txt")) {
- defCmdT("Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
+ defCmdT("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
}
if (file_exists("/boot/loader.conf")) {
- defCmdT("Loader Configuration", "/bin/cat /boot/loader.conf");
+ defCmdT("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
}
if (file_exists("/boot/loader.conf.local")) {
- defCmdT("Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
+ defCmdT("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
}
if (file_exists("/var/etc/filterdns.conf")) {
- defCmdT("Filter DNS Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
+ defCmdT("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
}
-defCmdT("last 1000 system log entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 DHCP log entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
-defCmdT("last 500 filter log entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
-defCmdT("last 1000 gateways log entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 IPsec log entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 L2TP log entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 NTP log entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 OpenVPN log entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 Captive Portal auth log entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 PPP log entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 relayd log entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 resolver log entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 routing log entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
-defCmdT("last 1000 wireless log entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
+
+/* Logs */
+defCmdT("Log-System-Last 1000 entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
+defCmdT("Log-DHCP-Last 1000 entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
+defCmdT("Log-Filter-Last 500 entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
+defCmdT("Log-Gateways-Last 1000 entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
+defCmdT("Log-IPsec-Last 1000 entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
+defCmdT("Log-L2TP-Last 1000 entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
+defCmdT("Log-NTP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
+defCmdT("Log-OpenVPN-Last 1000 entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
+defCmdT("Log-Captive Portal Authentication-Last 1000 entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
+defCmdT("Log-PPP-Last 1000 entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
+defCmdT("Log-relayd-Last 1000 entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
+defCmdT("Log-DNS-Last 1000 entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
+defCmdT("Log-Routing-Last 1000 entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
+defCmdT("Log-Wireless-Last 1000 entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
if (file_exists("/tmp/PHP_errors.log")) {
- defCmdT("PHP Error Log", "/bin/cat /tmp/PHP_errors.log");
+ defCmdT("Log-PHP Errors", "/bin/cat /tmp/PHP_errors.log");
+}
+defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
+defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
+
+/* OS/Hardware Status */
+defCmdT("OS-sysctl values", "/sbin/sysctl -a");
+defCmdT("OS-Kernel Environment", "/bin/kenv");
+defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
+defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
+defCmdT("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
+
+if (is_module_loaded("zfs.ko")) {
+ defCmdT("Disk-ZFS List", "/sbin/zfs list");
+ defCmdT("Disk-ZFS Properties", "/sbin/zfs get all");
+ defCmdT("Disk-ZFS Pool List", "/sbin/zpool list");
+ defCmdT("Disk-ZFS Pool Status", "/sbin/zpool status");
}
-defCmdT("System Message Buffer", "/sbin/dmesg -a");
-defCmdT("System Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
-defCmdT("sysctl values", "/sbin/sysctl -a");
-defCmdT("Kernel Environment", "/bin/kenv");
-defCmdT("Installed OS Packages", "/usr/sbin/pkg info");
-defCmdT("System Devices-PCI", "/usr/sbin/pciconf -lvb");
-defCmdT("System Devices-USB", "/usr/sbin/usbconfig dump_device_desc");
+defCmdT("Disk-GEOM Mirror Status", "/sbin/gmirror status");
exec("/bin/date", $dateOutput, $dateStatus);
$currentDate = $dateOutput[0];
-$pgtitle = array("{$g['product_name']}", "Status");
+$pgtitle = array($g['product_name'], "Status");
include("head.inc");
-print_info_box(gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting " .
- "information from this page in public places (like mailing lists).") . '<br />' .
- gettext("Common password fields in config.xml have been automatically redacted.") . '<br />' .
- gettext("When the page has finished loading, the output will be stored in {$output_file}. It may be downloaded via scp or ") .
- "<a href=\"/diag_command.php?dlPath={$output_file}\">" . gettext("Diagnostics > Command Prompt.") . '</a>');
+print_info_box(
+ gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting information from this page in public places (like mailing lists).") .
+ '<br />' .
+ gettext("Common password fields in config.xml have been automatically redacted.") .
+ '<br />' .
+ sprintf(gettext('When the page has finished loading, the output will be stored in %1$s. It may be downloaded via scp or %2$sDiagnostics > Command Prompt%3$s.'),
+ $output_file, '<a href="/diag_command.php?dlPath=' . $output_file . '">', '</a>'));
+
+print_info_box(get_firewall_info(), 'info', false);
listCmds();
execCmds();
@@ -305,5 +386,3 @@ if (is_dir($output_path)) {
}
print(gettext("Done."));
-
-include("foot.inc");
OpenPOWER on IntegriCloud