1
|
<?php
|
2
|
/*
|
3
|
* status.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* 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
|
*
|
14
|
* 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
|
*
|
18
|
* http://www.apache.org/licenses/LICENSE-2.0
|
19
|
*
|
20
|
* 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
|
*/
|
26
|
|
27
|
##|+PRIV
|
28
|
##|*IDENT=page-hidden-detailedstatus
|
29
|
##|*NAME=Hidden: Detailed Status
|
30
|
##|*DESCR=Allow access to the 'Hidden: Detailed Status' page.
|
31
|
##|*MATCH=status.php*
|
32
|
##|-PRIV
|
33
|
|
34
|
/* Execute a command, with a title, and generate an HTML table
|
35
|
* showing the results.
|
36
|
*/
|
37
|
|
38
|
/* include all configuration functions */
|
39
|
require_once("guiconfig.inc");
|
40
|
require_once("functions.inc");
|
41
|
require_once("gwlb.inc");
|
42
|
$output_path = "/tmp/status_output/";
|
43
|
$output_file = "/tmp/status_output.tgz";
|
44
|
|
45
|
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
|
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
|
function doCmdT($title, $command, $method) {
|
72
|
global $output_path, $output_file;
|
73
|
/* Fixup output directory */
|
74
|
|
75
|
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
|
76
|
echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
|
77
|
|
78
|
print('<div class="panel panel-default">');
|
79
|
print('<div class="panel-heading"><h2 class="panel-title">' . $title . '</h2></div>');
|
80
|
print('<div class="panel-body">');
|
81
|
print('<pre>');
|
82
|
|
83
|
if ($command == "dumpconfigxml") {
|
84
|
$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
|
85
|
$fd = @fopen("/conf/config.xml", "r");
|
86
|
if ($fd) {
|
87
|
while (!feof($fd)) {
|
88
|
$line = fgets($fd);
|
89
|
/* remove sensitive contents */
|
90
|
$line = preg_replace("/<authorizedkeys>.*?<\\/authorizedkeys>/", "<authorizedkeys>xxxxx</authorizedkeys>", $line);
|
91
|
$line = preg_replace("/<secret>.*?<\\/secret>/", "<secret>xxxxx</secret>", $line);
|
92
|
$line = preg_replace("/<bcrypt-hash>.*?<\\/bcrypt-hash>/", "<bcrypt-hash>xxxxx</bcrypt-hash>", $line);
|
93
|
$line = preg_replace("/<password>.*?<\\/password>/", "<password>xxxxx</password>", $line);
|
94
|
$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
|
$line = preg_replace("/<pre-shared-key>.*?<\\/pre-shared-key>/", "<pre-shared-key>xxxxx</pre-shared-key>", $line);
|
101
|
$line = preg_replace("/<rocommunity>.*?<\\/rocommunity>/", "<rocommunity>xxxxx</rocommunity>", $line);
|
102
|
$line = preg_replace("/<prv>.*?<\\/prv>/", "<prv>xxxxx</prv>", $line);
|
103
|
$line = preg_replace("/<shared_key>.*?<\\/shared_key>/", "<shared_key>xxxxx</shared_key>", $line);
|
104
|
$line = preg_replace("/<tls>.*?<\\/tls>/", "<tls>xxxxx</tls>", $line);
|
105
|
$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
|
$line = preg_replace("/<nt-hash>.*?<\\/nt-hash>/", "<nt-hash>xxxxx</nt-hash>", $line);
|
109
|
$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
|
$line = preg_replace("/<md5sigpass>.*?<\\/md5sigpass>/", "<md5sigpass>xxxxx</md5sigpass>", $line);
|
115
|
$line = preg_replace("/<md5sigkey>.*?<\\/md5sigkey>/", "<md5sigkey>xxxxx</md5sigkey>", $line);
|
116
|
$line = preg_replace("/<redis_password>.*?<\\/redis_password>/", "<redis_password>xxxxx</redis_password>", $line);
|
117
|
$line = preg_replace("/<redis_passwordagain>.*?<\\/redis_passwordagain>/", "<redis_passwordagain>xxxxx</redis_passwordagain>", $line);
|
118
|
$line = preg_replace("/<varclientsharedsecret>.*?<\\/varclientsharedsecret>/", "<varclientsharedsecret>xxxxx</varclientsharedsecret>", $line);
|
119
|
$line = preg_replace("/<varclientpasswordinput>.*?<\\/varclientpasswordinput>/", "<varclientpasswordinput>xxxxx</varclientpasswordinput>", $line);
|
120
|
$line = preg_replace("/<varusersmotpinitsecret>.*?<\\/varusersmotpinitsecret>/", "<varusersmotpinitsecret>xxxxx</varusersmotpinitsecret>", $line);
|
121
|
$line = preg_replace("/<varusersmotppin>.*?<\\/varusersmotppin>/", "<varusersmotppin>xxxxx</varusersmotppin>", $line);
|
122
|
$line = str_replace("\t", " ", $line);
|
123
|
echo htmlspecialchars($line, ENT_NOQUOTES);
|
124
|
fwrite($ofd, $line);
|
125
|
}
|
126
|
}
|
127
|
fclose($fd);
|
128
|
fclose($ofd);
|
129
|
} else {
|
130
|
$ofd = @fopen("{$output_path}/{$title}.txt", "w");
|
131
|
$execOutput = "";
|
132
|
$execStatus = "";
|
133
|
if ($method == "exec") {
|
134
|
exec($command . " 2>&1", $execOutput, $execStatus);
|
135
|
} elseif ($method == "php_func") {
|
136
|
$execOutput = explode("\n", $command());
|
137
|
}
|
138
|
for ($i = 0; isset($execOutput[$i]); $i++) {
|
139
|
if ($i > 0) {
|
140
|
echo "\n";
|
141
|
}
|
142
|
echo htmlspecialchars($execOutput[$i], ENT_NOQUOTES);
|
143
|
fwrite($ofd, $execOutput[$i] . "\n");
|
144
|
}
|
145
|
fclose($ofd);
|
146
|
}
|
147
|
|
148
|
print('</pre>');
|
149
|
print('</div>');
|
150
|
print('</div>');
|
151
|
}
|
152
|
|
153
|
/* Define a command, with a title, to be executed later. */
|
154
|
function defCmdT($title, $command, $method = "exec") {
|
155
|
global $commands;
|
156
|
$title = htmlspecialchars($title, ENT_NOQUOTES);
|
157
|
$commands[] = array($title, $command, $method);
|
158
|
}
|
159
|
|
160
|
/* List all of the commands as an index. */
|
161
|
function listCmds() {
|
162
|
global $currentDate;
|
163
|
global $commands;
|
164
|
|
165
|
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
|
166
|
|
167
|
print('<div class="panel panel-default">');
|
168
|
print('<div class="panel-heading"><h2 class="panel-title">' . sprintf(gettext("Firewall Status on %s"), $currentDate) . '</h2></div>');
|
169
|
print('<div class="panel-body">');
|
170
|
print(' <div class="content">');
|
171
|
print("\n<p>" . gettext("This status page includes the following information") . ":\n");
|
172
|
print("<ul>\n");
|
173
|
for ($i = 0; isset($commands[$i]); $i++) {
|
174
|
print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
|
175
|
}
|
176
|
|
177
|
print("</ul>\n");
|
178
|
print(' </div>');
|
179
|
print(' </div>');
|
180
|
print('</div>');
|
181
|
}
|
182
|
|
183
|
/* Execute all of the commands which were defined by a call to defCmd. */
|
184
|
function execCmds() {
|
185
|
global $commands;
|
186
|
for ($i = 0; isset($commands[$i]); $i++) {
|
187
|
doCmdT($commands[$i][0], $commands[$i][1], $commands[$i][2]);
|
188
|
}
|
189
|
}
|
190
|
|
191
|
function get_firewall_info() {
|
192
|
global $g, $output_path;
|
193
|
/* Firewall Platform/Serial */
|
194
|
$firewall_info = "Product Name: " . htmlspecialchars($g['product_name']);
|
195
|
$platform = system_identify_specific_platform();
|
196
|
if (!empty($platform['descr'])) {
|
197
|
$firewall_info .= "<br/>Platform: " . htmlspecialchars($platform['descr']);
|
198
|
}
|
199
|
|
200
|
if (file_exists('/var/db/uniqueid')) {
|
201
|
$ngid = file_get_contents('/var/db/uniqueid');
|
202
|
if (!empty($ngid)) {
|
203
|
$firewall_info .= "<br/>Netgate Device ID: " . htmlspecialchars($ngid);
|
204
|
}
|
205
|
}
|
206
|
|
207
|
$serial = system_get_serial();
|
208
|
if (!empty($serial)) {
|
209
|
$firewall_info .= "<br/>Serial: " . htmlspecialchars($serial);
|
210
|
}
|
211
|
|
212
|
if (!empty($g['product_version_string'])) {
|
213
|
$firewall_info .= "<br/>" . htmlspecialchars($g['product_name']) .
|
214
|
" version: " . htmlspecialchars($g['product_version_string']);
|
215
|
}
|
216
|
|
217
|
if (file_exists('/etc/version.buildtime')) {
|
218
|
$build_time = file_get_contents('/etc/version.buildtime');
|
219
|
if (!empty($build_time)) {
|
220
|
$firewall_info .= "<br/>Built On: " . htmlspecialchars($build_time);
|
221
|
}
|
222
|
}
|
223
|
if (file_exists('/etc/version.lastcommit')) {
|
224
|
$build_commit = file_get_contents('/etc/version.lastcommit');
|
225
|
if (!empty($build_commit)) {
|
226
|
$firewall_info .= "<br/>Last Commit: " . htmlspecialchars($build_commit);
|
227
|
}
|
228
|
}
|
229
|
|
230
|
if (file_exists('/etc/version.gitsync')) {
|
231
|
$gitsync = file_get_contents('/etc/version.gitsync');
|
232
|
if (!empty($gitsync)) {
|
233
|
$firewall_info .= "<br/>A gitsync was performed at " .
|
234
|
date("D M j G:i:s T Y", filemtime('/etc/version.gitsync')) .
|
235
|
" to commit " . htmlspecialchars($gitsync);
|
236
|
}
|
237
|
}
|
238
|
|
239
|
file_put_contents("{$output_path}/Product Info.txt", str_replace("<br/>", "\n", $firewall_info) . "\n");
|
240
|
return $firewall_info;
|
241
|
}
|
242
|
|
243
|
function get_gateway_status() {
|
244
|
return return_gateways_status_text(true, false);
|
245
|
}
|
246
|
|
247
|
global $g, $config;
|
248
|
|
249
|
/* Set up all of the commands we want to execute. */
|
250
|
|
251
|
/* OS stats/info */
|
252
|
defCmdT("OS-Uptime", "/usr/bin/uptime");
|
253
|
defCmdT("Network-Interfaces", "/sbin/ifconfig -a");
|
254
|
defCmdT("Network-Interface Statistics", "/usr/bin/netstat -nWi");
|
255
|
defCmdT("Process-Top Usage", "/usr/bin/top | /usr/bin/head -n5");
|
256
|
defCmdT("Process-List", "/bin/ps xauwwd");
|
257
|
defCmdT("Disk-Mounted Filesystems", "/sbin/mount");
|
258
|
defCmdT("Disk-Free Space", "/bin/df -hi");
|
259
|
defCmdT("Network-Routing tables", "/usr/bin/netstat -nWr");
|
260
|
defCmdT("Network-Gateway Status", 'get_gateway_status', "php_func");
|
261
|
defCmdT("Network-Mbuf Usage", "/usr/bin/netstat -mb");
|
262
|
defCmdT("Network-Protocol Statistics", "/usr/bin/netstat -s");
|
263
|
defCmdT("Network-Buffer and Timer Statistics", "/usr/bin/netstat -nWx");
|
264
|
defCmdT("Network-Sockets", "/usr/bin/sockstat");
|
265
|
defCmdT("Network-ARP Table", "/usr/sbin/arp -an");
|
266
|
defCmdT("Network-NDP Table", "/usr/sbin/ndp -na");
|
267
|
defCmdT("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
|
268
|
|
269
|
/* Firewall rules and info */
|
270
|
defCmdT("Firewall-Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
|
271
|
defCmdT("Firewall-Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
|
272
|
defCmdT("Firewall-Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
|
273
|
defCmdT("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
|
274
|
defCmdT("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
|
275
|
defCmdT("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
|
276
|
defCmdT("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
|
277
|
defCmdT("Firewall-pf Info", "/sbin/pfctl -si");
|
278
|
defCmdT("Firewall-pf Show All", "/sbin/pfctl -sa");
|
279
|
defCmdT("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
|
280
|
defCmdT("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
|
281
|
defCmdT("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
|
282
|
defCmdT("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
|
283
|
defCmdT("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
|
284
|
defCmdT("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
|
285
|
defCmdT("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
|
286
|
defCmdT("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
|
287
|
defCmdT("Firewall-IPFW Rules for Captive Portal", "/sbin/ipfw show");
|
288
|
defCmdT("Firewall-IPFW Limiter Info", "/sbin/ipfw pipe show");
|
289
|
defCmdT("Firewall-IPFW Queue Info", "/sbin/ipfw queue show");
|
290
|
|
291
|
if (is_array($config['load_balancer']['lbpool']) && is_array($config['load_balancer']['virtual_server'])) {
|
292
|
defCmdT("Load Balancer-Redirects", "/usr/local/sbin/relayctl show redirects");
|
293
|
defCmdT("Load Balancer-Relays", "/usr/local/sbin/relayctl show relays");
|
294
|
defCmdT("Load Balancer-Summary", "/usr/local/sbin/relayctl show summary");
|
295
|
}
|
296
|
|
297
|
/* Configuration Files */
|
298
|
defCmdT("Disk-Contents of var run", "/bin/ls /var/run");
|
299
|
defCmdT("Disk-Contents of conf", "/bin/ls /conf");
|
300
|
defCmdT("config.xml", "dumpconfigxml");
|
301
|
defCmdT("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
|
302
|
defCmdT("DHCP-IPv4 Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
|
303
|
defCmdT("DHCP-IPv6-Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
|
304
|
defCmdT("IPsec-strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf | /usr/bin/sed 's/[[:blank:]]secret = .*//'");
|
305
|
defCmdT("IPsec-Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
|
306
|
defCmdT("IPsec-Status", "/usr/local/sbin/ipsec statusall");
|
307
|
defCmdT("IPsec-SPD", "/sbin/setkey -DP");
|
308
|
defCmdT("IPsec-SAD", "/sbin/setkey -D");
|
309
|
if (file_exists("/cf/conf/upgrade_log.txt")) {
|
310
|
defCmdT("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
|
311
|
}
|
312
|
if (file_exists("/boot/loader.conf")) {
|
313
|
defCmdT("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
|
314
|
}
|
315
|
if (file_exists("/boot/loader.conf.local")) {
|
316
|
defCmdT("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
|
317
|
}
|
318
|
if (file_exists("/var/etc/filterdns.conf")) {
|
319
|
defCmdT("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
|
320
|
}
|
321
|
|
322
|
/* Logs */
|
323
|
defCmdT("Log-System-Last 1000 entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
|
324
|
defCmdT("Log-DHCP-Last 1000 entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
|
325
|
defCmdT("Log-Filter-Last 500 entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
|
326
|
defCmdT("Log-Gateways-Last 1000 entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
|
327
|
defCmdT("Log-IPsec-Last 1000 entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
|
328
|
defCmdT("Log-L2TP-Last 1000 entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
|
329
|
defCmdT("Log-NTP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
|
330
|
defCmdT("Log-OpenVPN-Last 1000 entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
|
331
|
defCmdT("Log-Captive Portal Authentication-Last 1000 entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
|
332
|
defCmdT("Log-PPP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ppp.log 2>&1 | tail -n 1000");
|
333
|
defCmdT("Log-PPPoE Server-Last 1000 entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
|
334
|
defCmdT("Log-relayd-Last 1000 entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
|
335
|
defCmdT("Log-DNS-Last 1000 entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
|
336
|
defCmdT("Log-Routing-Last 1000 entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
|
337
|
defCmdT("Log-Wireless-Last 1000 entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
|
338
|
if (file_exists("/tmp/PHP_errors.log")) {
|
339
|
defCmdT("Log-PHP Errors", "/bin/cat /tmp/PHP_errors.log");
|
340
|
}
|
341
|
defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
|
342
|
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
|
343
|
|
344
|
/* OS/Hardware Status */
|
345
|
defCmdT("OS-sysctl values", "/sbin/sysctl -aq");
|
346
|
defCmdT("OS-Kernel Environment", "/bin/kenv");
|
347
|
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
|
348
|
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
|
349
|
defCmdT("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
|
350
|
|
351
|
if (is_module_loaded("zfs.ko")) {
|
352
|
defCmdT("Disk-ZFS List", "/sbin/zfs list");
|
353
|
defCmdT("Disk-ZFS Properties", "/sbin/zfs get all");
|
354
|
defCmdT("Disk-ZFS Pool List", "/sbin/zpool list");
|
355
|
defCmdT("Disk-ZFS Pool Status", "/sbin/zpool status");
|
356
|
}
|
357
|
defCmdT("Disk-GEOM Mirror Status", "/sbin/gmirror status");
|
358
|
|
359
|
exec("/bin/date", $dateOutput, $dateStatus);
|
360
|
$currentDate = $dateOutput[0];
|
361
|
|
362
|
$pgtitle = array($g['product_name'], "Status");
|
363
|
include("head.inc"); ?>
|
364
|
|
365
|
<form action="status.php" method="post">
|
366
|
|
367
|
<?php print_info_box(
|
368
|
gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting information from this page in public places (like mailing lists).") .
|
369
|
'<br />' .
|
370
|
gettext("Common password fields in config.xml have been automatically redacted.") .
|
371
|
'<br />' .
|
372
|
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) .
|
373
|
' <button name="submit" type="submit" class="btn btn-primary btn-sm" id="download" value="DOWNLOAD">' .
|
374
|
'<i class="fa fa-download icon-embed-btn"></i>' .
|
375
|
gettext("Download") .
|
376
|
'</button>'); ?>
|
377
|
|
378
|
</form>
|
379
|
|
380
|
<?php print_info_box(get_firewall_info(), 'info', false);
|
381
|
|
382
|
listCmds();
|
383
|
execCmds();
|
384
|
|
385
|
print(gettext("Saving output to archive..."));
|
386
|
|
387
|
if (is_dir($output_path)) {
|
388
|
mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
|
389
|
unlink_if_exists("{$output_path}/*");
|
390
|
@rmdir($output_path);
|
391
|
}
|
392
|
|
393
|
print(gettext("Done."));
|
394
|
|
395
|
include("foot.inc");
|