Project

General

Profile

Download (15.9 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 0b4c14a4 Steve Beaver
 * Copyright (c) 2004-2019 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 6c17da07 jim-p
global $console;
39
global $show_output;
40
41
$console = false;
42
$show_output = !isset($_GET['archiveonly']);
43
44
if ((php_sapi_name() == 'cli') || (defined('STDIN'))) {
45
	/* Running from console/shell, not web */
46
	$console = true;
47
	$show_output = false;
48
	parse_str($argv[1], $_GET);
49
}
50
51 1d169baa Bill Marquette
/* include all configuration functions */
52 6c17da07 jim-p
if ($console) {
53
	require_once("config.inc");
54
} else {
55
	require_once("guiconfig.inc");
56
}
57 1d169baa Bill Marquette
require_once("functions.inc");
58 84fe48d4 jim-p
require_once("gwlb.inc");
59 6f62e89f jim-p
$output_path = "/tmp/status_output/";
60
$output_file = "/tmp/status_output.tgz";
61 1d169baa Bill Marquette
62 9858a361 jim-p
$filtered_tags = array(
63
	'accountkey', 'authorizedkeys', 'auth_pass', 'auth_user', 'bcrypt-hash',
64
	'crypto_password', 'crypto_password2', 'dns_nsupdatensupdate_key',
65
	'gold_encryption_password', 'gold_password', 'ipsecpsk', 'ldap_bindpw',
66
	'lighttpd_ls_password', 'lighttpd_ls_password', 'md5-hash',
67
	'md5password', 'md5sigkey', 'md5sigpass', 'nt-hash', 'passphrase',
68
	'password', 'passwordagain', 'pre-shared-key', 'proxypass',
69
	'proxy_passwd', 'proxyuser', 'proxy_user', 'prv', 'radius_secret',
70
	'redis_password', 'redis_passwordagain', 'rocommunity', 'secret',
71
	'shared_key', 'tls', 'varclientpasswordinput', 'varclientsharedsecret',
72
	'varsyncpassword', 'varusersmotpinitsecret', 'varusersmotppin'
73
);
74
75 f7a72733 jim-p
if ($_POST['submit'] == "DOWNLOAD" && file_exists($output_file)) {
76
	session_cache_limiter('public');
77
	$fd = fopen($output_file, "rb");
78
	header("Content-Type: application/octet-stream");
79
	header("Content-Length: " . filesize($output_file));
80
	header("Content-Disposition: attachment; filename=\"" .
81
		trim(htmlentities(basename($output_file))) . "\"");
82
	if (isset($_SERVER['HTTPS'])) {
83
		header('Pragma: ');
84
		header('Cache-Control: ');
85
	} else {
86
		header("Pragma: private");
87
		header("Cache-Control: private, must-revalidate");
88
	}
89
90
	fpassthru($fd);
91
	exit;
92
}
93
94 289b91c8 jim-p
if (is_dir($output_path)) {
95
	unlink_if_exists("{$output_path}/*");
96
	@rmdir($output_path);
97
}
98
unlink_if_exists($output_file);
99
mkdir($output_path);
100
101 84fe48d4 jim-p
function doCmdT($title, $command, $method) {
102 6c17da07 jim-p
	global $output_path, $output_file, $filtered_tags, $show_output;
103 6f62e89f jim-p
	/* Fixup output directory */
104
105 6c17da07 jim-p
	if ($show_output) {
106
		$rubbish = array('|', '-', '/', '.', ' ');  /* fixes the <a> tag to be W3C compliant */
107
		echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
108
		print('<div class="panel panel-default">');
109
		print('<div class="panel-heading"><h2 class="panel-title">' . $title . '</h2></div>');
110
		print('<div class="panel-body">');
111
		print('<pre>');
112
	}
113 f997992b Scott Ullrich
114 5b237745 Scott Ullrich
	if ($command == "dumpconfigxml") {
115 6f62e89f jim-p
		$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
116 5b237745 Scott Ullrich
		$fd = @fopen("/conf/config.xml", "r");
117
		if ($fd) {
118
			while (!feof($fd)) {
119
				$line = fgets($fd);
120 70069758 Bill Marquette
				/* remove sensitive contents */
121 9858a361 jim-p
				foreach ($filtered_tags as $tag) {
122
					$line = preg_replace("/<{$tag}>.*?<\\/{$tag}>/", "<{$tag}>xxxxx</{$tag}>", $line);
123
				}
124 6c17da07 jim-p
				if ($show_output) {
125
					echo htmlspecialchars(str_replace("\t", "    ", $line), ENT_NOQUOTES);
126
				}
127 6f62e89f jim-p
				fwrite($ofd, $line);
128 5b237745 Scott Ullrich
			}
129
		}
130
		fclose($fd);
131 6f62e89f jim-p
		fclose($ofd);
132 5b237745 Scott Ullrich
	} else {
133 767a716e Scott Ullrich
		$execOutput = "";
134
		$execStatus = "";
135 6c17da07 jim-p
		$fn = "{$output_path}/{$title}.txt";
136 84fe48d4 jim-p
		if ($method == "exec") {
137 6c17da07 jim-p
			exec($command . " > " . escapeshellarg($fn) . " 2>&1", $execOutput, $execStatus);
138
			if ($show_output) {
139
				$ofd = @fopen($fn, "r");
140
				if ($ofd) {
141
					while (!feof($ofd)) {
142
						echo htmlspecialchars(fgets($ofd), ENT_NOQUOTES);
143
					}
144
				}
145
				fclose($ofd);
146
			}
147 84fe48d4 jim-p
		} elseif ($method == "php_func") {
148 6c17da07 jim-p
			$execOutput = $command();
149
			if ($show_output) {
150
				echo htmlspecialchars($execOutput, ENT_NOQUOTES);
151 5b237745 Scott Ullrich
			}
152 6c17da07 jim-p
			file_put_contents($fn, $execOutput);
153 5b237745 Scott Ullrich
		}
154
	}
155 454cec57 sbeaver
156 6c17da07 jim-p
	if ($show_output) {
157
		print('</pre>');
158
		print('</div>');
159
		print('</div>');
160
	}
161 5b237745 Scott Ullrich
}
162
163
/* Define a command, with a title, to be executed later. */
164 84fe48d4 jim-p
function defCmdT($title, $command, $method = "exec") {
165 2151894c Colin Fleming
	global $commands;
166 6c07db48 Phil Davis
	$title = htmlspecialchars($title, ENT_NOQUOTES);
167 84fe48d4 jim-p
	$commands[] = array($title, $command, $method);
168 5b237745 Scott Ullrich
}
169
170
/* List all of the commands as an index. */
171
function listCmds() {
172 454cec57 sbeaver
	global $currentDate;
173 2151894c Colin Fleming
	global $commands;
174 454cec57 sbeaver
175
	$rubbish = array('|', '-', '/', '.', ' ');	/* fixes the <a> tag to be W3C compliant */
176
177
	print('<div class="panel panel-default">');
178 7f0d6ccf Phil Davis
	print('<div class="panel-heading"><h2 class="panel-title">' . sprintf(gettext("Firewall Status on %s"), $currentDate) . '</h2></div>');
179 abe98adb Phil Davis
	print('<div class="panel-body">');
180
	print('    <div class="content">');
181 454cec57 sbeaver
	print("\n<p>" . gettext("This status page includes the following information") . ":\n");
182
	print("<ul>\n");
183 abe98adb Phil Davis
	for ($i = 0; isset($commands[$i]); $i++) {
184
		print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
185 2151894c Colin Fleming
	}
186 454cec57 sbeaver
187
	print("</ul>\n");
188 2ca4eec2 Jared Dillard
	print('	       </div>');
189 454cec57 sbeaver
	print('	   </div>');
190
	print('</div>');
191 5b237745 Scott Ullrich
}
192
193
/* Execute all of the commands which were defined by a call to defCmd. */
194
function execCmds() {
195 2151894c Colin Fleming
	global $commands;
196 6c07db48 Phil Davis
	for ($i = 0; isset($commands[$i]); $i++) {
197 84fe48d4 jim-p
		doCmdT($commands[$i][0], $commands[$i][1], $commands[$i][2]);
198
	}
199
}
200
201
function get_firewall_info() {
202
	global $g, $output_path;
203
	/* Firewall Platform/Serial */
204 a2da1706 jim-p
	$firewall_info = "Product Name: " . htmlspecialchars($g['product_name']);
205 84fe48d4 jim-p
	$platform = system_identify_specific_platform();
206
	if (!empty($platform['descr'])) {
207 a2da1706 jim-p
		$firewall_info .= "<br/>Platform: " . htmlspecialchars($platform['descr']);
208 2151894c Colin Fleming
	}
209 fcc24426 jim-p
210
	if (file_exists('/var/db/uniqueid')) {
211
		$ngid = file_get_contents('/var/db/uniqueid');
212
		if (!empty($ngid)) {
213
			$firewall_info .= "<br/>Netgate Device ID: " . htmlspecialchars($ngid);
214
		}
215
	}
216
217 6c17da07 jim-p
	if (function_exists("system_get_thothid")) {
218
		$thothid = system_get_thothid();
219
		if (!empty($thothid)) {
220
			$firewall_info .= "<br/>Netgate Crypto ID: " . htmlspecialchars(chop($thothid));
221
		}
222
	}
223
224 84fe48d4 jim-p
	$serial = system_get_serial();
225
	if (!empty($serial)) {
226 df89ed3a Renato Botelho
		$firewall_info .= "<br/>Serial: " . htmlspecialchars($serial);
227 84fe48d4 jim-p
	}
228 a2da1706 jim-p
229
	if (!empty($g['product_version_string'])) {
230 c7fd8cd0 jim-p
		$firewall_info .= "<br/>" . htmlspecialchars($g['product_name']) .
231 a2da1706 jim-p
		    " version: " . htmlspecialchars($g['product_version_string']);
232
	}
233
234
	if (file_exists('/etc/version.buildtime')) {
235
		$build_time = file_get_contents('/etc/version.buildtime');
236
		if (!empty($build_time)) {
237
			$firewall_info .= "<br/>Built On: " . htmlspecialchars($build_time);
238
		}
239
	}
240
	if (file_exists('/etc/version.lastcommit')) {
241
		$build_commit = file_get_contents('/etc/version.lastcommit');
242
		if (!empty($build_commit)) {
243
			$firewall_info .= "<br/>Last Commit: " . htmlspecialchars($build_commit);
244
		}
245
	}
246
247
	if (file_exists('/etc/version.gitsync')) {
248
		$gitsync = file_get_contents('/etc/version.gitsync');
249
		if (!empty($gitsync)) {
250
			$firewall_info .= "<br/>A gitsync was performed at " .
251
			    date("D M j G:i:s T Y", filemtime('/etc/version.gitsync')) .
252
			    " to commit " . htmlspecialchars($gitsync);
253
		}
254
	}
255
256 2309b26a jim-p
	file_put_contents("{$output_path}/Product-Info.txt", str_replace("<br/>", "\n", $firewall_info) . "\n");
257 84fe48d4 jim-p
	return $firewall_info;
258
}
259
260
function get_gateway_status() {
261
	return return_gateways_status_text(true, false);
262 5b237745 Scott Ullrich
}
263
264 58f2f42a Renato Botelho
global $g, $config;
265 1d169baa Bill Marquette
266 5b237745 Scott Ullrich
/* Set up all of the commands we want to execute. */
267 289b91c8 jim-p
268 84fe48d4 jim-p
/* OS stats/info */
269 2309b26a jim-p
if (function_exists("system_get_thothid")) {
270
	$thothid = system_get_thothid();
271
	if (!empty($thothid)) {
272 80e50918 jim-p
		defCmdT("Product-Public Key", "/usr/local/sbin/ping-auth -p");
273 2309b26a jim-p
	}
274
}
275
276 84fe48d4 jim-p
defCmdT("OS-Uptime", "/usr/bin/uptime");
277 6c17da07 jim-p
defCmdT("Network-Interfaces", "/sbin/ifconfig -vvvvvam");
278 84fe48d4 jim-p
defCmdT("Network-Interface Statistics", "/usr/bin/netstat -nWi");
279
defCmdT("Process-Top Usage", "/usr/bin/top | /usr/bin/head -n5");
280
defCmdT("Process-List", "/bin/ps xauwwd");
281
defCmdT("Disk-Mounted Filesystems", "/sbin/mount");
282
defCmdT("Disk-Free Space", "/bin/df -hi");
283
defCmdT("Network-Routing tables", "/usr/bin/netstat -nWr");
284
defCmdT("Network-Gateway Status", 'get_gateway_status', "php_func");
285
defCmdT("Network-Mbuf Usage", "/usr/bin/netstat -mb");
286
defCmdT("Network-Protocol Statistics", "/usr/bin/netstat -s");
287 6252b470 jim-p
defCmdT("Network-Buffer and Timer Statistics", "/usr/bin/netstat -nWx");
288 6c17da07 jim-p
defCmdT("Network-Listen Queues", "/usr/bin/netstat -LaAn");
289 84fe48d4 jim-p
defCmdT("Network-Sockets", "/usr/bin/sockstat");
290
defCmdT("Network-ARP Table", "/usr/sbin/arp -an");
291
defCmdT("Network-NDP Table", "/usr/sbin/ndp -na");
292
defCmdT("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
293 37502a4a Scott Ullrich
294 03ce1107 jim-p
/* If a device has a switch, put the switch configuration in the status output */
295
if (file_exists("/dev/etherswitch0")) {
296
	defCmdT("Network-Switch Configuration", "/sbin/etherswitchcfg -f /dev/etherswitch0 info");
297
}
298
299 289b91c8 jim-p
/* Firewall rules and info */
300 84fe48d4 jim-p
defCmdT("Firewall-Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
301
defCmdT("Firewall-Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
302
defCmdT("Firewall-Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
303
defCmdT("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
304
defCmdT("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
305
defCmdT("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
306
defCmdT("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
307
defCmdT("Firewall-pf Info", "/sbin/pfctl -si");
308
defCmdT("Firewall-pf Show All", "/sbin/pfctl -sa");
309
defCmdT("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
310
defCmdT("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
311
defCmdT("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
312
defCmdT("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
313
defCmdT("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
314
defCmdT("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
315
defCmdT("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
316
defCmdT("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
317
defCmdT("Firewall-IPFW Rules for Captive Portal", "/sbin/ipfw show");
318
defCmdT("Firewall-IPFW Limiter Info", "/sbin/ipfw pipe show");
319
defCmdT("Firewall-IPFW Queue Info", "/sbin/ipfw queue show");
320
321 6f62e89f jim-p
/* Configuration Files */
322 84fe48d4 jim-p
defCmdT("Disk-Contents of var run", "/bin/ls /var/run");
323
defCmdT("Disk-Contents of conf", "/bin/ls /conf");
324 abe98adb Phil Davis
defCmdT("config.xml", "dumpconfigxml");
325 84fe48d4 jim-p
defCmdT("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
326
defCmdT("DHCP-IPv4 Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
327
defCmdT("DHCP-IPv6-Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
328 21fdf72c jim-p
defCmdT("IPsec-strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf | /usr/bin/sed 's/[[:blank:]]secret = .*//'");
329 84fe48d4 jim-p
defCmdT("IPsec-Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
330
defCmdT("IPsec-Status", "/usr/local/sbin/ipsec statusall");
331
defCmdT("IPsec-SPD", "/sbin/setkey -DP");
332
defCmdT("IPsec-SAD", "/sbin/setkey -D");
333 6f62e89f jim-p
if (file_exists("/cf/conf/upgrade_log.txt")) {
334 84fe48d4 jim-p
	defCmdT("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
335 6f62e89f jim-p
}
336
if (file_exists("/boot/loader.conf")) {
337 84fe48d4 jim-p
	defCmdT("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
338 6f62e89f jim-p
}
339
if (file_exists("/boot/loader.conf.local")) {
340 84fe48d4 jim-p
	defCmdT("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
341 6f62e89f jim-p
}
342
if (file_exists("/var/etc/filterdns.conf")) {
343 84fe48d4 jim-p
	defCmdT("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
344 6f62e89f jim-p
}
345 84fe48d4 jim-p
346
/* Logs */
347
defCmdT("Log-System-Last 1000 entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
348
defCmdT("Log-DHCP-Last 1000 entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
349
defCmdT("Log-Filter-Last 500 entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
350
defCmdT("Log-Gateways-Last 1000 entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
351
defCmdT("Log-IPsec-Last 1000 entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
352
defCmdT("Log-L2TP-Last 1000 entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
353
defCmdT("Log-NTP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
354
defCmdT("Log-OpenVPN-Last 1000 entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
355
defCmdT("Log-Captive Portal Authentication-Last 1000 entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
356 35e5c404 jim-p
defCmdT("Log-PPP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ppp.log 2>&1 | tail -n 1000");
357
defCmdT("Log-PPPoE Server-Last 1000 entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
358 84fe48d4 jim-p
defCmdT("Log-DNS-Last 1000 entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
359
defCmdT("Log-Routing-Last 1000 entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
360
defCmdT("Log-Wireless-Last 1000 entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
361 6f62e89f jim-p
if (file_exists("/tmp/PHP_errors.log")) {
362 84fe48d4 jim-p
	defCmdT("Log-PHP Errors", "/bin/cat /tmp/PHP_errors.log");
363 6f62e89f jim-p
}
364 84fe48d4 jim-p
defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
365
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
366
367
/* OS/Hardware Status */
368 3c44c845 Luiz Souza
defCmdT("OS-sysctl values", "/sbin/sysctl -aq");
369 84fe48d4 jim-p
defCmdT("OS-Kernel Environment", "/bin/kenv");
370
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
371 6c17da07 jim-p
defCmdT("OS-Package Manager Configuration", "/usr/sbin/pkg -vv");
372 84fe48d4 jim-p
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
373
defCmdT("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
374 387dbe43 jim-p
375
if (is_module_loaded("zfs.ko")) {
376
	defCmdT("Disk-ZFS List", "/sbin/zfs list");
377
	defCmdT("Disk-ZFS Properties", "/sbin/zfs get all");
378
	defCmdT("Disk-ZFS Pool List", "/sbin/zpool list");
379
	defCmdT("Disk-ZFS Pool Status", "/sbin/zpool status");
380
}
381 a2da1706 jim-p
defCmdT("Disk-GEOM Mirror Status", "/sbin/gmirror status");
382 9cd0b618 Scott Ullrich
383 5b237745 Scott Ullrich
exec("/bin/date", $dateOutput, $dateStatus);
384
$currentDate = $dateOutput[0];
385
386 84fe48d4 jim-p
$pgtitle = array($g['product_name'], "Status");
387 6c17da07 jim-p
388
if (!$console):
389 f7a72733 jim-p
include("head.inc"); ?>
390
391
<form action="status.php" method="post">
392 4df96eff Scott Ullrich
393 f7a72733 jim-p
<?php print_info_box(
394 6c17da07 jim-p
	gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting information from this page in public places such as forum or social media sites.") .
395 7f0d6ccf Phil Davis
	'<br />' .
396 6c17da07 jim-p
	gettext("Common password and other private fields in config.xml have been automatically redacted.") .
397 7f0d6ccf Phil Davis
	'<br />' .
398 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) .
399
	' <button name="submit" type="submit" class="btn btn-primary btn-sm" id="download" value="DOWNLOAD">' .
400
	'<i class="fa fa-download icon-embed-btn"></i>' .
401
	gettext("Download") .
402
	'</button>'); ?>
403
404
</form>
405 5b237745 Scott Ullrich
406 f7a72733 jim-p
<?php print_info_box(get_firewall_info(), 'info', false);
407 84fe48d4 jim-p
408 6c17da07 jim-p
if ($show_output) {
409
	listCmds();
410
} else {
411
	print_info_box(gettext("Status output suppressed. Download archive to view."), 'info', false);
412
}
413
414
endif;
415
416
if ($console) {
417
	print(gettext("Gathering status data...") . "\n");
418 2309b26a jim-p
	get_firewall_info();
419 6c17da07 jim-p
}
420 454cec57 sbeaver
execCmds();
421 5b237745 Scott Ullrich
422 6543ffa4 Stephen Beaver
print(gettext("Saving output to archive..."));
423
424
if (is_dir($output_path)) {
425
	mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
426 6c17da07 jim-p
427
	if (!isset($_GET["nocleanup"])) {
428
		unlink_if_exists("{$output_path}/*");
429
		@rmdir($output_path);
430
	}
431 6543ffa4 Stephen Beaver
}
432
433 6c17da07 jim-p
print(gettext("Done.") . "\n");
434 6543ffa4 Stephen Beaver
435 6c17da07 jim-p
if (!$console) {
436
	include("foot.inc");
437
}