Project

General

Profile

Download (16.4 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2 919d91f9 Phil Davis
/*
3 ac24dc24 Renato Botelho
 * status.php
4 5b237745 Scott Ullrich
 *
5 ac24dc24 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 81299b5c Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 ac24dc24 Renato Botelho
 * All rights reserved.
8 29aef6c4 Jim Thompson
 *
9 ac24dc24 Renato Botelho
 * originally based on m0n0wall (http://neon1.net/m0n0wall)
10
 * Copyright (c) 2003 Jim McBeath <jimmc@macrovision.com>
11
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
 * All rights reserved.
13 191cb31d Stephen Beaver
 *
14 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
15
 * you may not use this file except in compliance with the License.
16
 * You may obtain a copy of the License at
17 191cb31d Stephen Beaver
 *
18 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
19 191cb31d Stephen Beaver
 *
20 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
21
 * distributed under the License is distributed on an "AS IS" BASIS,
22
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
 * See the License for the specific language governing permissions and
24
 * limitations under the License.
25 191cb31d Stephen Beaver
 */
26 6b07c15a Matthew Grooms
27
##|+PRIV
28
##|*IDENT=page-hidden-detailedstatus
29 5230f468 jim-p
##|*NAME=Hidden: Detailed Status
30 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Hidden: Detailed Status' page.
31
##|*MATCH=status.php*
32
##|-PRIV
33 5b237745 Scott Ullrich
34
/* Execute a command, with a title, and generate an HTML table
35
 * showing the results.
36
 */
37 1d169baa Bill Marquette
38
/* include all configuration functions */
39 f977ac60 Bill Marquette
require_once("guiconfig.inc");
40 1d169baa Bill Marquette
require_once("functions.inc");
41 84fe48d4 jim-p
require_once("gwlb.inc");
42 6f62e89f jim-p
$output_path = "/tmp/status_output/";
43
$output_file = "/tmp/status_output.tgz";
44 1d169baa Bill Marquette
45 f7a72733 jim-p
if ($_POST['submit'] == "DOWNLOAD" && file_exists($output_file)) {
46
	session_cache_limiter('public');
47
	$fd = fopen($output_file, "rb");
48
	header("Content-Type: application/octet-stream");
49
	header("Content-Length: " . filesize($output_file));
50
	header("Content-Disposition: attachment; filename=\"" .
51
		trim(htmlentities(basename($output_file))) . "\"");
52
	if (isset($_SERVER['HTTPS'])) {
53
		header('Pragma: ');
54
		header('Cache-Control: ');
55
	} else {
56
		header("Pragma: private");
57
		header("Cache-Control: private, must-revalidate");
58
	}
59
60
	fpassthru($fd);
61
	exit;
62
}
63
64 289b91c8 jim-p
if (is_dir($output_path)) {
65
	unlink_if_exists("{$output_path}/*");
66
	@rmdir($output_path);
67
}
68
unlink_if_exists($output_file);
69
mkdir($output_path);
70
71 84fe48d4 jim-p
function doCmdT($title, $command, $method) {
72 6f62e89f jim-p
	global $output_path, $output_file;
73
	/* Fixup output directory */
74
75 2151894c Colin Fleming
	$rubbish = array('|', '-', '/', '.', ' ');  /* fixes the <a> tag to be W3C compliant */
76 6c07db48 Phil Davis
	echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
77 454cec57 sbeaver
78
	print('<div class="panel panel-default">');
79 95fa5cce Phil Davis
	print('<div class="panel-heading"><h2 class="panel-title">' . $title . '</h2></div>');
80 abe98adb Phil Davis
	print('<div class="panel-body">');
81
	print('<pre>');
82 f997992b Scott Ullrich
83 5b237745 Scott Ullrich
	if ($command == "dumpconfigxml") {
84 6f62e89f jim-p
		$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
85 5b237745 Scott Ullrich
		$fd = @fopen("/conf/config.xml", "r");
86
		if ($fd) {
87
			while (!feof($fd)) {
88
				$line = fgets($fd);
89 70069758 Bill Marquette
				/* remove sensitive contents */
90 abb48814 Chris Buechler
				$line = preg_replace("/<authorizedkeys>.*?<\\/authorizedkeys>/", "<authorizedkeys>xxxxx</authorizedkeys>", $line);
91 8d1a6065 Chris Buechler
				$line = preg_replace("/<secret>.*?<\\/secret>/", "<secret>xxxxx</secret>", $line);
92 abb48814 Chris Buechler
				$line = preg_replace("/<bcrypt-hash>.*?<\\/bcrypt-hash>/", "<bcrypt-hash>xxxxx</bcrypt-hash>", $line);
93 5b237745 Scott Ullrich
				$line = preg_replace("/<password>.*?<\\/password>/", "<password>xxxxx</password>", $line);
94 0529bedd jim-p
				$line = preg_replace("/<auth_user>.*?<\\/auth_user>/", "<auth_user>xxxxx</auth_user>", $line);
95
				$line = preg_replace("/<auth_pass>.*?<\\/auth_pass>/", "<auth_pass>xxxxx</auth_pass>", $line);
96
				$line = preg_replace("/<proxy_user>.*?<\\/proxy_user>/", "<proxy_user>xxxxx</proxy_user>", $line);
97
				$line = preg_replace("/<proxy_passwd>.*?<\\/proxy_passwd>/", "<proxy_passwd>xxxxx</proxy_passwd>", $line);
98
				$line = preg_replace("/<proxyuser>.*?<\\/proxyuser>/", "<proxyuser>xxxxx</proxyuser>", $line);
99
				$line = preg_replace("/<proxypass>.*?<\\/proxypass>/", "<proxypass>xxxxx</proxypass>", $line);
100 5b237745 Scott Ullrich
				$line = preg_replace("/<pre-shared-key>.*?<\\/pre-shared-key>/", "<pre-shared-key>xxxxx</pre-shared-key>", $line);
101 70069758 Bill Marquette
				$line = preg_replace("/<rocommunity>.*?<\\/rocommunity>/", "<rocommunity>xxxxx</rocommunity>", $line);
102 8a2229e3 jim-p
				$line = preg_replace("/<prv>.*?<\\/prv>/", "<prv>xxxxx</prv>", $line);
103 fd192dbc jim-p
				$line = preg_replace("/<shared_key>.*?<\\/shared_key>/", "<shared_key>xxxxx</shared_key>", $line);
104
				$line = preg_replace("/<tls>.*?<\\/tls>/", "<tls>xxxxx</tls>", $line);
105 8a2229e3 jim-p
				$line = preg_replace("/<ipsecpsk>.*?<\\/ipsecpsk>/", "<ipsecpsk>xxxxx</ipsecpsk>", $line);
106
				$line = preg_replace("/<md5-hash>.*?<\\/md5-hash>/", "<md5-hash>xxxxx</md5-hash>", $line);
107
				$line = preg_replace("/<md5password>.*?<\\/md5password>/", "<md5password>xxxxx</md5password>", $line);
108 289b91c8 jim-p
				$line = preg_replace("/<nt-hash>.*?<\\/nt-hash>/", "<nt-hash>xxxxx</nt-hash>", $line);
109 8a2229e3 jim-p
				$line = preg_replace("/<radius_secret>.*?<\\/radius_secret>/", "<radius_secret>xxxxx</radius_secret>", $line);
110
				$line = preg_replace("/<ldap_bindpw>.*?<\\/ldap_bindpw>/", "<ldap_bindpw>xxxxx</ldap_bindpw>", $line);
111
				$line = preg_replace("/<passwordagain>.*?<\\/passwordagain>/", "<passwordagain>xxxxx</passwordagain>", $line);
112
				$line = preg_replace("/<crypto_password>.*?<\\/crypto_password>/", "<crypto_password>xxxxx</crypto_password>", $line);
113
				$line = preg_replace("/<crypto_password2>.*?<\\/crypto_password2>/", "<crypto_password2>xxxxx</crypto_password2>", $line);
114 aa18c5b9 jim-p
				$line = preg_replace("/<md5sigpass>.*?<\\/md5sigpass>/", "<md5sigpass>xxxxx</md5sigpass>", $line);
115
				$line = preg_replace("/<md5sigkey>.*?<\\/md5sigkey>/", "<md5sigkey>xxxxx</md5sigkey>", $line);
116 5b237745 Scott Ullrich
				$line = str_replace("\t", "    ", $line);
117 6c07db48 Phil Davis
				echo htmlspecialchars($line, ENT_NOQUOTES);
118 6f62e89f jim-p
				fwrite($ofd, $line);
119 5b237745 Scott Ullrich
			}
120
		}
121
		fclose($fd);
122 6f62e89f jim-p
		fclose($ofd);
123 5b237745 Scott Ullrich
	} else {
124 6f62e89f jim-p
		$ofd = @fopen("{$output_path}/{$title}.txt", "w");
125 767a716e Scott Ullrich
		$execOutput = "";
126
		$execStatus = "";
127 84fe48d4 jim-p
		if ($method == "exec") {
128
			exec($command . " 2>&1", $execOutput, $execStatus);
129
		} elseif ($method == "php_func") {
130
			$execOutput = explode("\n", $command());
131
		}
132 5b237745 Scott Ullrich
		for ($i = 0; isset($execOutput[$i]); $i++) {
133
			if ($i > 0) {
134
				echo "\n";
135
			}
136 6c07db48 Phil Davis
			echo htmlspecialchars($execOutput[$i], ENT_NOQUOTES);
137 6f62e89f jim-p
			fwrite($ofd, $execOutput[$i] . "\n");
138 5b237745 Scott Ullrich
		}
139 6f62e89f jim-p
		fclose($ofd);
140 5b237745 Scott Ullrich
	}
141 454cec57 sbeaver
142 abe98adb Phil Davis
	print('</pre>');
143
	print('</div>');
144 454cec57 sbeaver
	print('</div>');
145 5b237745 Scott Ullrich
}
146
147
/* Define a command, with a title, to be executed later. */
148 84fe48d4 jim-p
function defCmdT($title, $command, $method = "exec") {
149 2151894c Colin Fleming
	global $commands;
150 6c07db48 Phil Davis
	$title = htmlspecialchars($title, ENT_NOQUOTES);
151 84fe48d4 jim-p
	$commands[] = array($title, $command, $method);
152 5b237745 Scott Ullrich
}
153
154
/* List all of the commands as an index. */
155
function listCmds() {
156 454cec57 sbeaver
	global $currentDate;
157 2151894c Colin Fleming
	global $commands;
158 454cec57 sbeaver
159
	$rubbish = array('|', '-', '/', '.', ' ');	/* fixes the <a> tag to be W3C compliant */
160
161
	print('<div class="panel panel-default">');
162 7f0d6ccf Phil Davis
	print('<div class="panel-heading"><h2 class="panel-title">' . sprintf(gettext("Firewall Status on %s"), $currentDate) . '</h2></div>');
163 abe98adb Phil Davis
	print('<div class="panel-body">');
164
	print('    <div class="content">');
165 454cec57 sbeaver
	print("\n<p>" . gettext("This status page includes the following information") . ":\n");
166
	print("<ul>\n");
167 abe98adb Phil Davis
	for ($i = 0; isset($commands[$i]); $i++) {
168
		print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
169 2151894c Colin Fleming
	}
170 454cec57 sbeaver
171
	print("</ul>\n");
172 2ca4eec2 Jared Dillard
	print('	       </div>');
173 454cec57 sbeaver
	print('	   </div>');
174
	print('</div>');
175 5b237745 Scott Ullrich
}
176
177
/* Execute all of the commands which were defined by a call to defCmd. */
178
function execCmds() {
179 2151894c Colin Fleming
	global $commands;
180 6c07db48 Phil Davis
	for ($i = 0; isset($commands[$i]); $i++) {
181 84fe48d4 jim-p
		doCmdT($commands[$i][0], $commands[$i][1], $commands[$i][2]);
182
	}
183
}
184
185
function get_firewall_info() {
186
	global $g, $output_path;
187
	/* Firewall Platform/Serial */
188 a2da1706 jim-p
	$firewall_info = "Product Name: " . htmlspecialchars($g['product_name']);
189 84fe48d4 jim-p
	$platform = system_identify_specific_platform();
190
	if (!empty($platform['descr'])) {
191 a2da1706 jim-p
		$firewall_info .= "<br/>Platform: " . htmlspecialchars($platform['descr']);
192 2151894c Colin Fleming
	}
193 fcc24426 jim-p
194
	if (file_exists('/var/db/uniqueid')) {
195
		$ngid = file_get_contents('/var/db/uniqueid');
196
		if (!empty($ngid)) {
197
			$firewall_info .= "<br/>Netgate Device ID: " . htmlspecialchars($ngid);
198
		}
199
	}
200
201 84fe48d4 jim-p
	$serial = system_get_serial();
202
	if (!empty($serial)) {
203 a2da1706 jim-p
		$firewall_info .= "<br/>SN/UUID: " . htmlspecialchars($serial);
204 84fe48d4 jim-p
	}
205 a2da1706 jim-p
206
	if (!empty($g['product_version_string'])) {
207 c7fd8cd0 jim-p
		$firewall_info .= "<br/>" . htmlspecialchars($g['product_name']) .
208 a2da1706 jim-p
		    " version: " . htmlspecialchars($g['product_version_string']);
209
	}
210
211
	if (file_exists('/etc/version.buildtime')) {
212
		$build_time = file_get_contents('/etc/version.buildtime');
213
		if (!empty($build_time)) {
214
			$firewall_info .= "<br/>Built On: " . htmlspecialchars($build_time);
215
		}
216
	}
217
	if (file_exists('/etc/version.lastcommit')) {
218
		$build_commit = file_get_contents('/etc/version.lastcommit');
219
		if (!empty($build_commit)) {
220
			$firewall_info .= "<br/>Last Commit: " . htmlspecialchars($build_commit);
221
		}
222
	}
223
224
	if (file_exists('/etc/version.gitsync')) {
225
		$gitsync = file_get_contents('/etc/version.gitsync');
226
		if (!empty($gitsync)) {
227
			$firewall_info .= "<br/>A gitsync was performed at " .
228
			    date("D M j G:i:s T Y", filemtime('/etc/version.gitsync')) .
229
			    " to commit " . htmlspecialchars($gitsync);
230
		}
231
	}
232
233 84fe48d4 jim-p
	file_put_contents("{$output_path}/Product Info.txt", str_replace("<br/>", "\n", $firewall_info) . "\n");
234
	return $firewall_info;
235
}
236
237
function get_gateway_status() {
238
	return return_gateways_status_text(true, false);
239 5b237745 Scott Ullrich
}
240
241 58f2f42a Renato Botelho
global $g, $config;
242 1d169baa Bill Marquette
243 5b237745 Scott Ullrich
/* Set up all of the commands we want to execute. */
244 289b91c8 jim-p
245 84fe48d4 jim-p
/* OS stats/info */
246
defCmdT("OS-Uptime", "/usr/bin/uptime");
247
defCmdT("Network-Interfaces", "/sbin/ifconfig -a");
248
defCmdT("Network-Interface Statistics", "/usr/bin/netstat -nWi");
249
defCmdT("Process-Top Usage", "/usr/bin/top | /usr/bin/head -n5");
250
defCmdT("Process-List", "/bin/ps xauwwd");
251
defCmdT("Disk-Mounted Filesystems", "/sbin/mount");
252
defCmdT("Disk-Free Space", "/bin/df -hi");
253
defCmdT("Network-Routing tables", "/usr/bin/netstat -nWr");
254
defCmdT("Network-Gateway Status", 'get_gateway_status', "php_func");
255
defCmdT("Network-Mbuf Usage", "/usr/bin/netstat -mb");
256
defCmdT("Network-Protocol Statistics", "/usr/bin/netstat -s");
257 6252b470 jim-p
defCmdT("Network-Buffer and Timer Statistics", "/usr/bin/netstat -nWx");
258 84fe48d4 jim-p
defCmdT("Network-Sockets", "/usr/bin/sockstat");
259
defCmdT("Network-ARP Table", "/usr/sbin/arp -an");
260
defCmdT("Network-NDP Table", "/usr/sbin/ndp -na");
261
defCmdT("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
262 37502a4a Scott Ullrich
263 289b91c8 jim-p
/* Firewall rules and info */
264 84fe48d4 jim-p
defCmdT("Firewall-Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
265
defCmdT("Firewall-Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
266
defCmdT("Firewall-Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
267
defCmdT("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
268
defCmdT("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
269
defCmdT("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
270
defCmdT("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
271
defCmdT("Firewall-pf Info", "/sbin/pfctl -si");
272
defCmdT("Firewall-pf Show All", "/sbin/pfctl -sa");
273
defCmdT("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
274
defCmdT("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
275
defCmdT("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
276
defCmdT("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
277
defCmdT("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
278
defCmdT("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
279
defCmdT("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
280
defCmdT("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
281
defCmdT("Firewall-IPFW Rules for Captive Portal", "/sbin/ipfw show");
282
defCmdT("Firewall-IPFW Limiter Info", "/sbin/ipfw pipe show");
283
defCmdT("Firewall-IPFW Queue Info", "/sbin/ipfw queue show");
284
285
if (is_array($config['load_balancer']['lbpool']) && is_array($config['load_balancer']['virtual_server'])) {
286
	defCmdT("Load Balancer-Redirects", "/usr/local/sbin/relayctl show redirects");
287
	defCmdT("Load Balancer-Relays", "/usr/local/sbin/relayctl show relays");
288
	defCmdT("Load Balancer-Summary", "/usr/local/sbin/relayctl show summary");
289 baec2b00 Ermal
}
290 58f2f42a Renato Botelho
291 6f62e89f jim-p
/* Configuration Files */
292 84fe48d4 jim-p
defCmdT("Disk-Contents of var run", "/bin/ls /var/run");
293
defCmdT("Disk-Contents of conf", "/bin/ls /conf");
294 abe98adb Phil Davis
defCmdT("config.xml", "dumpconfigxml");
295 84fe48d4 jim-p
defCmdT("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
296
defCmdT("DHCP-IPv4 Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
297
defCmdT("DHCP-IPv6-Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
298
defCmdT("IPsec-strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf");
299
defCmdT("IPsec-Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
300
defCmdT("IPsec-Status", "/usr/local/sbin/ipsec statusall");
301
defCmdT("IPsec-SPD", "/sbin/setkey -DP");
302
defCmdT("IPsec-SAD", "/sbin/setkey -D");
303 6f62e89f jim-p
if (file_exists("/cf/conf/upgrade_log.txt")) {
304 84fe48d4 jim-p
	defCmdT("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
305 6f62e89f jim-p
}
306
if (file_exists("/boot/loader.conf")) {
307 84fe48d4 jim-p
	defCmdT("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
308 6f62e89f jim-p
}
309
if (file_exists("/boot/loader.conf.local")) {
310 84fe48d4 jim-p
	defCmdT("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
311 6f62e89f jim-p
}
312
if (file_exists("/var/etc/filterdns.conf")) {
313 84fe48d4 jim-p
	defCmdT("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
314 6f62e89f jim-p
}
315 84fe48d4 jim-p
316
/* Logs */
317
defCmdT("Log-System-Last 1000 entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
318
defCmdT("Log-DHCP-Last 1000 entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
319
defCmdT("Log-Filter-Last 500 entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
320
defCmdT("Log-Gateways-Last 1000 entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
321
defCmdT("Log-IPsec-Last 1000 entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
322
defCmdT("Log-L2TP-Last 1000 entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
323
defCmdT("Log-NTP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
324
defCmdT("Log-OpenVPN-Last 1000 entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
325
defCmdT("Log-Captive Portal Authentication-Last 1000 entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
326
defCmdT("Log-PPP-Last 1000 entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
327
defCmdT("Log-relayd-Last 1000 entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
328
defCmdT("Log-DNS-Last 1000 entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
329
defCmdT("Log-Routing-Last 1000 entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
330
defCmdT("Log-Wireless-Last 1000 entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
331 6f62e89f jim-p
if (file_exists("/tmp/PHP_errors.log")) {
332 84fe48d4 jim-p
	defCmdT("Log-PHP Errors", "/bin/cat /tmp/PHP_errors.log");
333 6f62e89f jim-p
}
334 84fe48d4 jim-p
defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
335
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
336
337
/* OS/Hardware Status */
338
defCmdT("OS-sysctl values", "/sbin/sysctl -a");
339
defCmdT("OS-Kernel Environment", "/bin/kenv");
340
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
341
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
342
defCmdT("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
343 387dbe43 jim-p
344
if (is_module_loaded("zfs.ko")) {
345
	defCmdT("Disk-ZFS List", "/sbin/zfs list");
346
	defCmdT("Disk-ZFS Properties", "/sbin/zfs get all");
347
	defCmdT("Disk-ZFS Pool List", "/sbin/zpool list");
348
	defCmdT("Disk-ZFS Pool Status", "/sbin/zpool status");
349
}
350 a2da1706 jim-p
defCmdT("Disk-GEOM Mirror Status", "/sbin/gmirror status");
351 9cd0b618 Scott Ullrich
352 5b237745 Scott Ullrich
exec("/bin/date", $dateOutput, $dateStatus);
353
$currentDate = $dateOutput[0];
354
355 84fe48d4 jim-p
$pgtitle = array($g['product_name'], "Status");
356 f7a72733 jim-p
include("head.inc"); ?>
357
358
<form action="status.php" method="post">
359 4df96eff Scott Ullrich
360 f7a72733 jim-p
<?php print_info_box(
361 7f0d6ccf Phil Davis
	gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting information from this page in public places (like mailing lists).") .
362
	'<br />' .
363
	gettext("Common password fields in config.xml have been automatically redacted.") .
364
	'<br />' .
365 f7a72733 jim-p
	sprintf(gettext('When the page has finished loading, the output is stored in %1$s. It may be downloaded via scp or using this button: '), $output_file) .
366
	' <button name="submit" type="submit" class="btn btn-primary btn-sm" id="download" value="DOWNLOAD">' .
367
	'<i class="fa fa-download icon-embed-btn"></i>' .
368
	gettext("Download") .
369
	'</button>'); ?>
370
371
</form>
372 5b237745 Scott Ullrich
373 f7a72733 jim-p
<?php print_info_box(get_firewall_info(), 'info', false);
374 84fe48d4 jim-p
375 454cec57 sbeaver
listCmds();
376
execCmds();
377 5b237745 Scott Ullrich
378 6543ffa4 Stephen Beaver
print(gettext("Saving output to archive..."));
379
380
if (is_dir($output_path)) {
381
	mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
382
	unlink_if_exists("{$output_path}/*");
383
	@rmdir($output_path);
384
}
385
386
print(gettext("Done."));
387
388 56bd1847 Chris Buechler
include("foot.inc");