1
|
<?php
|
2
|
/*
|
3
|
* status.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 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
|
* Redistribution and use in source and binary forms, with or without
|
15
|
* modification, are permitted provided that the following conditions are met:
|
16
|
*
|
17
|
* 1. Redistributions of source code must retain the above copyright notice,
|
18
|
* this list of conditions and the following disclaimer.
|
19
|
*
|
20
|
* 2. Redistributions in binary form must reproduce the above copyright
|
21
|
* notice, this list of conditions and the following disclaimer in
|
22
|
* the documentation and/or other materials provided with the
|
23
|
* distribution.
|
24
|
*
|
25
|
* 3. All advertising materials mentioning features or use of this software
|
26
|
* must display the following acknowledgment:
|
27
|
* "This product includes software developed by the pfSense Project
|
28
|
* for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
29
|
*
|
30
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
31
|
* endorse or promote products derived from this software without
|
32
|
* prior written permission. For written permission, please contact
|
33
|
* coreteam@pfsense.org.
|
34
|
*
|
35
|
* 5. Products derived from this software may not be called "pfSense"
|
36
|
* nor may "pfSense" appear in their names without prior written
|
37
|
* permission of the Electric Sheep Fencing, LLC.
|
38
|
*
|
39
|
* 6. Redistributions of any form whatsoever must retain the following
|
40
|
* acknowledgment:
|
41
|
*
|
42
|
* "This product includes software developed by the pfSense Project
|
43
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
44
|
*
|
45
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
46
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
47
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
48
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
49
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
50
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
51
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
52
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
53
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
54
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
55
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
56
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
57
|
*/
|
58
|
|
59
|
##|+PRIV
|
60
|
##|*IDENT=page-hidden-detailedstatus
|
61
|
##|*NAME=Hidden: Detailed Status
|
62
|
##|*DESCR=Allow access to the 'Hidden: Detailed Status' page.
|
63
|
##|*MATCH=status.php*
|
64
|
##|-PRIV
|
65
|
|
66
|
/* Execute a command, with a title, and generate an HTML table
|
67
|
* showing the results.
|
68
|
*/
|
69
|
|
70
|
/* include all configuration functions */
|
71
|
require_once("guiconfig.inc");
|
72
|
require_once("functions.inc");
|
73
|
require_once("gwlb.inc");
|
74
|
$output_path = "/tmp/status_output/";
|
75
|
$output_file = "/tmp/status_output.tgz";
|
76
|
|
77
|
if ($_POST['submit'] == "DOWNLOAD" && file_exists($output_file)) {
|
78
|
session_cache_limiter('public');
|
79
|
$fd = fopen($output_file, "rb");
|
80
|
header("Content-Type: application/octet-stream");
|
81
|
header("Content-Length: " . filesize($output_file));
|
82
|
header("Content-Disposition: attachment; filename=\"" .
|
83
|
trim(htmlentities(basename($output_file))) . "\"");
|
84
|
if (isset($_SERVER['HTTPS'])) {
|
85
|
header('Pragma: ');
|
86
|
header('Cache-Control: ');
|
87
|
} else {
|
88
|
header("Pragma: private");
|
89
|
header("Cache-Control: private, must-revalidate");
|
90
|
}
|
91
|
|
92
|
fpassthru($fd);
|
93
|
exit;
|
94
|
}
|
95
|
|
96
|
if (is_dir($output_path)) {
|
97
|
unlink_if_exists("{$output_path}/*");
|
98
|
@rmdir($output_path);
|
99
|
}
|
100
|
unlink_if_exists($output_file);
|
101
|
mkdir($output_path);
|
102
|
|
103
|
function doCmdT($title, $command, $method) {
|
104
|
global $output_path, $output_file;
|
105
|
/* Fixup output directory */
|
106
|
|
107
|
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
|
108
|
echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
|
109
|
|
110
|
print('<div class="panel panel-default">');
|
111
|
print('<div class="panel-heading"><h2 class="panel-title">' . $title . '</h2></div>');
|
112
|
print('<div class="panel-body">');
|
113
|
print('<pre>');
|
114
|
|
115
|
if ($command == "dumpconfigxml") {
|
116
|
$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
|
117
|
$fd = @fopen("/conf/config.xml", "r");
|
118
|
if ($fd) {
|
119
|
while (!feof($fd)) {
|
120
|
$line = fgets($fd);
|
121
|
/* remove sensitive contents */
|
122
|
$line = preg_replace("/<authorizedkeys>.*?<\\/authorizedkeys>/", "<authorizedkeys>xxxxx</authorizedkeys>", $line);
|
123
|
$line = preg_replace("/<secret>.*?<\\/secret>/", "<secret>xxxxx</secret>", $line);
|
124
|
$line = preg_replace("/<bcrypt-hash>.*?<\\/bcrypt-hash>/", "<bcrypt-hash>xxxxx</bcrypt-hash>", $line);
|
125
|
$line = preg_replace("/<password>.*?<\\/password>/", "<password>xxxxx</password>", $line);
|
126
|
$line = preg_replace("/<auth_user>.*?<\\/auth_user>/", "<auth_user>xxxxx</auth_user>", $line);
|
127
|
$line = preg_replace("/<auth_pass>.*?<\\/auth_pass>/", "<auth_pass>xxxxx</auth_pass>", $line);
|
128
|
$line = preg_replace("/<proxy_user>.*?<\\/proxy_user>/", "<proxy_user>xxxxx</proxy_user>", $line);
|
129
|
$line = preg_replace("/<proxy_passwd>.*?<\\/proxy_passwd>/", "<proxy_passwd>xxxxx</proxy_passwd>", $line);
|
130
|
$line = preg_replace("/<proxyuser>.*?<\\/proxyuser>/", "<proxyuser>xxxxx</proxyuser>", $line);
|
131
|
$line = preg_replace("/<proxypass>.*?<\\/proxypass>/", "<proxypass>xxxxx</proxypass>", $line);
|
132
|
$line = preg_replace("/<pre-shared-key>.*?<\\/pre-shared-key>/", "<pre-shared-key>xxxxx</pre-shared-key>", $line);
|
133
|
$line = preg_replace("/<rocommunity>.*?<\\/rocommunity>/", "<rocommunity>xxxxx</rocommunity>", $line);
|
134
|
$line = preg_replace("/<prv>.*?<\\/prv>/", "<prv>xxxxx</prv>", $line);
|
135
|
$line = preg_replace("/<shared_key>.*?<\\/shared_key>/", "<shared_key>xxxxx</shared_key>", $line);
|
136
|
$line = preg_replace("/<tls>.*?<\\/tls>/", "<tls>xxxxx</tls>", $line);
|
137
|
$line = preg_replace("/<ipsecpsk>.*?<\\/ipsecpsk>/", "<ipsecpsk>xxxxx</ipsecpsk>", $line);
|
138
|
$line = preg_replace("/<md5-hash>.*?<\\/md5-hash>/", "<md5-hash>xxxxx</md5-hash>", $line);
|
139
|
$line = preg_replace("/<md5password>.*?<\\/md5password>/", "<md5password>xxxxx</md5password>", $line);
|
140
|
$line = preg_replace("/<nt-hash>.*?<\\/nt-hash>/", "<nt-hash>xxxxx</nt-hash>", $line);
|
141
|
$line = preg_replace("/<radius_secret>.*?<\\/radius_secret>/", "<radius_secret>xxxxx</radius_secret>", $line);
|
142
|
$line = preg_replace("/<ldap_bindpw>.*?<\\/ldap_bindpw>/", "<ldap_bindpw>xxxxx</ldap_bindpw>", $line);
|
143
|
$line = preg_replace("/<passwordagain>.*?<\\/passwordagain>/", "<passwordagain>xxxxx</passwordagain>", $line);
|
144
|
$line = preg_replace("/<crypto_password>.*?<\\/crypto_password>/", "<crypto_password>xxxxx</crypto_password>", $line);
|
145
|
$line = preg_replace("/<crypto_password2>.*?<\\/crypto_password2>/", "<crypto_password2>xxxxx</crypto_password2>", $line);
|
146
|
$line = str_replace("\t", " ", $line);
|
147
|
echo htmlspecialchars($line, ENT_NOQUOTES);
|
148
|
fwrite($ofd, $line);
|
149
|
}
|
150
|
}
|
151
|
fclose($fd);
|
152
|
fclose($ofd);
|
153
|
} else {
|
154
|
$ofd = @fopen("{$output_path}/{$title}.txt", "w");
|
155
|
$execOutput = "";
|
156
|
$execStatus = "";
|
157
|
if ($method == "exec") {
|
158
|
exec($command . " 2>&1", $execOutput, $execStatus);
|
159
|
} elseif ($method == "php_func") {
|
160
|
$execOutput = explode("\n", $command());
|
161
|
}
|
162
|
for ($i = 0; isset($execOutput[$i]); $i++) {
|
163
|
if ($i > 0) {
|
164
|
echo "\n";
|
165
|
}
|
166
|
echo htmlspecialchars($execOutput[$i], ENT_NOQUOTES);
|
167
|
fwrite($ofd, $execOutput[$i] . "\n");
|
168
|
}
|
169
|
fclose($ofd);
|
170
|
}
|
171
|
|
172
|
print('</pre>');
|
173
|
print('</div>');
|
174
|
print('</div>');
|
175
|
}
|
176
|
|
177
|
/* Define a command, with a title, to be executed later. */
|
178
|
function defCmdT($title, $command, $method = "exec") {
|
179
|
global $commands;
|
180
|
$title = htmlspecialchars($title, ENT_NOQUOTES);
|
181
|
$commands[] = array($title, $command, $method);
|
182
|
}
|
183
|
|
184
|
/* List all of the commands as an index. */
|
185
|
function listCmds() {
|
186
|
global $currentDate;
|
187
|
global $commands;
|
188
|
|
189
|
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
|
190
|
|
191
|
print('<div class="panel panel-default">');
|
192
|
print('<div class="panel-heading"><h2 class="panel-title">' . sprintf(gettext("Firewall Status on %s"), $currentDate) . '</h2></div>');
|
193
|
print('<div class="panel-body">');
|
194
|
print(' <div class="content">');
|
195
|
print("\n<p>" . gettext("This status page includes the following information") . ":\n");
|
196
|
print("<ul>\n");
|
197
|
for ($i = 0; isset($commands[$i]); $i++) {
|
198
|
print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
|
199
|
}
|
200
|
|
201
|
print("</ul>\n");
|
202
|
print(' </div>');
|
203
|
print(' </div>');
|
204
|
print('</div>');
|
205
|
}
|
206
|
|
207
|
/* Execute all of the commands which were defined by a call to defCmd. */
|
208
|
function execCmds() {
|
209
|
global $commands;
|
210
|
for ($i = 0; isset($commands[$i]); $i++) {
|
211
|
doCmdT($commands[$i][0], $commands[$i][1], $commands[$i][2]);
|
212
|
}
|
213
|
}
|
214
|
|
215
|
function get_firewall_info() {
|
216
|
global $g, $output_path;
|
217
|
/* Firewall Platform/Serial */
|
218
|
$firewall_info = "Product Name: " . htmlspecialchars($g['product_name']);
|
219
|
$platform = system_identify_specific_platform();
|
220
|
if (!empty($platform['descr'])) {
|
221
|
$firewall_info .= "<br/>Platform: " . htmlspecialchars($platform['descr']);
|
222
|
}
|
223
|
|
224
|
if (file_exists('/var/db/uniqueid')) {
|
225
|
$ngid = file_get_contents('/var/db/uniqueid');
|
226
|
if (!empty($ngid)) {
|
227
|
$firewall_info .= "<br/>Netgate Device ID: " . htmlspecialchars($ngid);
|
228
|
}
|
229
|
}
|
230
|
|
231
|
$serial = system_get_serial();
|
232
|
if (!empty($serial)) {
|
233
|
$firewall_info .= "<br/>SN/UUID: " . htmlspecialchars($serial);
|
234
|
}
|
235
|
|
236
|
if (!empty($g['product_version_string'])) {
|
237
|
$firewall_info .= "<br/>" . htmlspecialchars($g['product_name']) .
|
238
|
" version: " . htmlspecialchars($g['product_version_string']);
|
239
|
}
|
240
|
|
241
|
if (file_exists('/etc/version.buildtime')) {
|
242
|
$build_time = file_get_contents('/etc/version.buildtime');
|
243
|
if (!empty($build_time)) {
|
244
|
$firewall_info .= "<br/>Built On: " . htmlspecialchars($build_time);
|
245
|
}
|
246
|
}
|
247
|
if (file_exists('/etc/version.lastcommit')) {
|
248
|
$build_commit = file_get_contents('/etc/version.lastcommit');
|
249
|
if (!empty($build_commit)) {
|
250
|
$firewall_info .= "<br/>Last Commit: " . htmlspecialchars($build_commit);
|
251
|
}
|
252
|
}
|
253
|
|
254
|
if (file_exists('/etc/version.gitsync')) {
|
255
|
$gitsync = file_get_contents('/etc/version.gitsync');
|
256
|
if (!empty($gitsync)) {
|
257
|
$firewall_info .= "<br/>A gitsync was performed at " .
|
258
|
date("D M j G:i:s T Y", filemtime('/etc/version.gitsync')) .
|
259
|
" to commit " . htmlspecialchars($gitsync);
|
260
|
}
|
261
|
}
|
262
|
|
263
|
file_put_contents("{$output_path}/Product Info.txt", str_replace("<br/>", "\n", $firewall_info) . "\n");
|
264
|
return $firewall_info;
|
265
|
}
|
266
|
|
267
|
function get_gateway_status() {
|
268
|
return return_gateways_status_text(true, false);
|
269
|
}
|
270
|
|
271
|
global $g, $config;
|
272
|
|
273
|
/* Set up all of the commands we want to execute. */
|
274
|
|
275
|
/* OS stats/info */
|
276
|
defCmdT("OS-Uptime", "/usr/bin/uptime");
|
277
|
defCmdT("Network-Interfaces", "/sbin/ifconfig -a");
|
278
|
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
|
defCmdT("Network-Buffer and Timer Statistics", "/usr/bin/netstat -nWx");
|
288
|
defCmdT("Network-Sockets", "/usr/bin/sockstat");
|
289
|
defCmdT("Network-ARP Table", "/usr/sbin/arp -an");
|
290
|
defCmdT("Network-NDP Table", "/usr/sbin/ndp -na");
|
291
|
defCmdT("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
|
292
|
|
293
|
/* Firewall rules and info */
|
294
|
defCmdT("Firewall-Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
|
295
|
defCmdT("Firewall-Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
|
296
|
defCmdT("Firewall-Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
|
297
|
defCmdT("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
|
298
|
defCmdT("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
|
299
|
defCmdT("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
|
300
|
defCmdT("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
|
301
|
defCmdT("Firewall-pf Info", "/sbin/pfctl -si");
|
302
|
defCmdT("Firewall-pf Show All", "/sbin/pfctl -sa");
|
303
|
defCmdT("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
|
304
|
defCmdT("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
|
305
|
defCmdT("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
|
306
|
defCmdT("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
|
307
|
defCmdT("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
|
308
|
defCmdT("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
|
309
|
defCmdT("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
|
310
|
defCmdT("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
|
311
|
defCmdT("Firewall-IPFW Limiter Info", "/sbin/ipfw pipe show");
|
312
|
defCmdT("Firewall-IPFW Queue Info", "/sbin/ipfw queue show");
|
313
|
if (isset($config['captiveportal']) && is_array($config['captiveportal'])) {
|
314
|
foreach ($config['captiveportal'] as $cpZone => $cpdata) {
|
315
|
if (isset($cpdata['enable'])) {
|
316
|
defCmdT("Firewall-IPFW Rules for Captive Portal {$cpdata['zone']}", "/sbin/ipfw -x " . escapeshellarg($cpdata['zoneid']) . " show");
|
317
|
}
|
318
|
}
|
319
|
}
|
320
|
|
321
|
|
322
|
if (is_array($config['load_balancer']['lbpool']) && is_array($config['load_balancer']['virtual_server'])) {
|
323
|
defCmdT("Load Balancer-Redirects", "/usr/local/sbin/relayctl show redirects");
|
324
|
defCmdT("Load Balancer-Relays", "/usr/local/sbin/relayctl show relays");
|
325
|
defCmdT("Load Balancer-Summary", "/usr/local/sbin/relayctl show summary");
|
326
|
}
|
327
|
|
328
|
/* Configuration Files */
|
329
|
defCmdT("Disk-Contents of var run", "/bin/ls /var/run");
|
330
|
defCmdT("Disk-Contents of conf", "/bin/ls /conf");
|
331
|
defCmdT("config.xml", "dumpconfigxml");
|
332
|
defCmdT("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
|
333
|
defCmdT("DHCP-IPv4 Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
|
334
|
defCmdT("DHCP-IPv6-Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
|
335
|
defCmdT("IPsec-strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf");
|
336
|
defCmdT("IPsec-Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
|
337
|
defCmdT("IPsec-Status", "/usr/local/sbin/ipsec statusall");
|
338
|
defCmdT("IPsec-SPD", "/sbin/setkey -DP");
|
339
|
defCmdT("IPsec-SAD", "/sbin/setkey -D");
|
340
|
if (file_exists("/cf/conf/upgrade_log.txt")) {
|
341
|
defCmdT("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
|
342
|
}
|
343
|
if (file_exists("/boot/loader.conf")) {
|
344
|
defCmdT("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
|
345
|
}
|
346
|
if (file_exists("/boot/loader.conf.local")) {
|
347
|
defCmdT("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
|
348
|
}
|
349
|
if (file_exists("/var/etc/filterdns.conf")) {
|
350
|
defCmdT("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
|
351
|
}
|
352
|
|
353
|
/* Logs */
|
354
|
defCmdT("Log-System-Last 1000 entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
|
355
|
defCmdT("Log-DHCP-Last 1000 entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
|
356
|
defCmdT("Log-Filter-Last 500 entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
|
357
|
defCmdT("Log-Gateways-Last 1000 entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
|
358
|
defCmdT("Log-IPsec-Last 1000 entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
|
359
|
defCmdT("Log-L2TP-Last 1000 entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
|
360
|
defCmdT("Log-NTP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
|
361
|
defCmdT("Log-OpenVPN-Last 1000 entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
|
362
|
defCmdT("Log-Captive Portal Authentication-Last 1000 entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
|
363
|
defCmdT("Log-PPP-Last 1000 entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
|
364
|
defCmdT("Log-relayd-Last 1000 entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
|
365
|
defCmdT("Log-DNS-Last 1000 entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
|
366
|
defCmdT("Log-Routing-Last 1000 entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
|
367
|
defCmdT("Log-Wireless-Last 1000 entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
|
368
|
if (file_exists("/tmp/PHP_errors.log")) {
|
369
|
defCmdT("Log-PHP Errors", "/bin/cat /tmp/PHP_errors.log");
|
370
|
}
|
371
|
defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
|
372
|
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
|
373
|
|
374
|
/* OS/Hardware Status */
|
375
|
defCmdT("OS-sysctl values", "/sbin/sysctl -a");
|
376
|
defCmdT("OS-Kernel Environment", "/bin/kenv");
|
377
|
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
|
378
|
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
|
379
|
defCmdT("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
|
380
|
|
381
|
if (is_module_loaded("zfs.ko")) {
|
382
|
defCmdT("Disk-ZFS List", "/sbin/zfs list");
|
383
|
defCmdT("Disk-ZFS Properties", "/sbin/zfs get all");
|
384
|
defCmdT("Disk-ZFS Pool List", "/sbin/zpool list");
|
385
|
defCmdT("Disk-ZFS Pool Status", "/sbin/zpool status");
|
386
|
}
|
387
|
defCmdT("Disk-GEOM Mirror Status", "/sbin/gmirror status");
|
388
|
|
389
|
exec("/bin/date", $dateOutput, $dateStatus);
|
390
|
$currentDate = $dateOutput[0];
|
391
|
|
392
|
$pgtitle = array($g['product_name'], "Status");
|
393
|
include("head.inc"); ?>
|
394
|
|
395
|
<form action="status.php" method="post">
|
396
|
|
397
|
<?php print_info_box(
|
398
|
gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting information from this page in public places (like mailing lists).") .
|
399
|
'<br />' .
|
400
|
gettext("Common password fields in config.xml have been automatically redacted.") .
|
401
|
'<br />' .
|
402
|
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) .
|
403
|
' <button name="submit" type="submit" class="btn btn-primary btn-sm" id="download" value="DOWNLOAD">' .
|
404
|
'<i class="fa fa-download icon-embed-btn"></i>' .
|
405
|
gettext("Download") .
|
406
|
'</button>'); ?>
|
407
|
|
408
|
</form>
|
409
|
|
410
|
<?php print_info_box(get_firewall_info(), 'info', false);
|
411
|
|
412
|
listCmds();
|
413
|
execCmds();
|
414
|
|
415
|
print(gettext("Saving output to archive..."));
|
416
|
|
417
|
if (is_dir($output_path)) {
|
418
|
mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
|
419
|
unlink_if_exists("{$output_path}/*");
|
420
|
@rmdir($output_path);
|
421
|
}
|
422
|
|
423
|
print(gettext("Done."));
|
424
|
|
425
|
include("foot.inc");
|