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 |
289b91c8
|
jim-p
|
if (is_dir($output_path)) {
|
46 |
|
|
unlink_if_exists("{$output_path}/*");
|
47 |
|
|
@rmdir($output_path);
|
48 |
|
|
}
|
49 |
|
|
unlink_if_exists($output_file);
|
50 |
|
|
mkdir($output_path);
|
51 |
|
|
|
52 |
84fe48d4
|
jim-p
|
function doCmdT($title, $command, $method) {
|
53 |
6f62e89f
|
jim-p
|
global $output_path, $output_file;
|
54 |
|
|
/* Fixup output directory */
|
55 |
|
|
|
56 |
2151894c
|
Colin Fleming
|
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
|
57 |
6c07db48
|
Phil Davis
|
echo "\n<a name=\"" . str_replace($rubbish, '', $title) . "\" id=\"" . str_replace($rubbish, '', $title) . "\"></a>\n";
|
58 |
454cec57
|
sbeaver
|
|
59 |
|
|
print('<div class="panel panel-default">');
|
60 |
95fa5cce
|
Phil Davis
|
print('<div class="panel-heading"><h2 class="panel-title">' . $title . '</h2></div>');
|
61 |
abe98adb
|
Phil Davis
|
print('<div class="panel-body">');
|
62 |
|
|
print('<pre>');
|
63 |
f997992b
|
Scott Ullrich
|
|
64 |
5b237745
|
Scott Ullrich
|
if ($command == "dumpconfigxml") {
|
65 |
6f62e89f
|
jim-p
|
$ofd = @fopen("{$output_path}/config-sanitized.xml", "w");
|
66 |
5b237745
|
Scott Ullrich
|
$fd = @fopen("/conf/config.xml", "r");
|
67 |
|
|
if ($fd) {
|
68 |
|
|
while (!feof($fd)) {
|
69 |
|
|
$line = fgets($fd);
|
70 |
70069758
|
Bill Marquette
|
/* remove sensitive contents */
|
71 |
abb48814
|
Chris Buechler
|
$line = preg_replace("/<authorizedkeys>.*?<\\/authorizedkeys>/", "<authorizedkeys>xxxxx</authorizedkeys>", $line);
|
72 |
8d1a6065
|
Chris Buechler
|
$line = preg_replace("/<secret>.*?<\\/secret>/", "<secret>xxxxx</secret>", $line);
|
73 |
abb48814
|
Chris Buechler
|
$line = preg_replace("/<bcrypt-hash>.*?<\\/bcrypt-hash>/", "<bcrypt-hash>xxxxx</bcrypt-hash>", $line);
|
74 |
5b237745
|
Scott Ullrich
|
$line = preg_replace("/<password>.*?<\\/password>/", "<password>xxxxx</password>", $line);
|
75 |
0529bedd
|
jim-p
|
$line = preg_replace("/<auth_user>.*?<\\/auth_user>/", "<auth_user>xxxxx</auth_user>", $line);
|
76 |
|
|
$line = preg_replace("/<auth_pass>.*?<\\/auth_pass>/", "<auth_pass>xxxxx</auth_pass>", $line);
|
77 |
|
|
$line = preg_replace("/<proxy_user>.*?<\\/proxy_user>/", "<proxy_user>xxxxx</proxy_user>", $line);
|
78 |
|
|
$line = preg_replace("/<proxy_passwd>.*?<\\/proxy_passwd>/", "<proxy_passwd>xxxxx</proxy_passwd>", $line);
|
79 |
|
|
$line = preg_replace("/<proxyuser>.*?<\\/proxyuser>/", "<proxyuser>xxxxx</proxyuser>", $line);
|
80 |
|
|
$line = preg_replace("/<proxypass>.*?<\\/proxypass>/", "<proxypass>xxxxx</proxypass>", $line);
|
81 |
5b237745
|
Scott Ullrich
|
$line = preg_replace("/<pre-shared-key>.*?<\\/pre-shared-key>/", "<pre-shared-key>xxxxx</pre-shared-key>", $line);
|
82 |
70069758
|
Bill Marquette
|
$line = preg_replace("/<rocommunity>.*?<\\/rocommunity>/", "<rocommunity>xxxxx</rocommunity>", $line);
|
83 |
8a2229e3
|
jim-p
|
$line = preg_replace("/<prv>.*?<\\/prv>/", "<prv>xxxxx</prv>", $line);
|
84 |
fd192dbc
|
jim-p
|
$line = preg_replace("/<shared_key>.*?<\\/shared_key>/", "<shared_key>xxxxx</shared_key>", $line);
|
85 |
|
|
$line = preg_replace("/<tls>.*?<\\/tls>/", "<tls>xxxxx</tls>", $line);
|
86 |
8a2229e3
|
jim-p
|
$line = preg_replace("/<ipsecpsk>.*?<\\/ipsecpsk>/", "<ipsecpsk>xxxxx</ipsecpsk>", $line);
|
87 |
|
|
$line = preg_replace("/<md5-hash>.*?<\\/md5-hash>/", "<md5-hash>xxxxx</md5-hash>", $line);
|
88 |
|
|
$line = preg_replace("/<md5password>.*?<\\/md5password>/", "<md5password>xxxxx</md5password>", $line);
|
89 |
289b91c8
|
jim-p
|
$line = preg_replace("/<nt-hash>.*?<\\/nt-hash>/", "<nt-hash>xxxxx</nt-hash>", $line);
|
90 |
8a2229e3
|
jim-p
|
$line = preg_replace("/<radius_secret>.*?<\\/radius_secret>/", "<radius_secret>xxxxx</radius_secret>", $line);
|
91 |
|
|
$line = preg_replace("/<ldap_bindpw>.*?<\\/ldap_bindpw>/", "<ldap_bindpw>xxxxx</ldap_bindpw>", $line);
|
92 |
|
|
$line = preg_replace("/<passwordagain>.*?<\\/passwordagain>/", "<passwordagain>xxxxx</passwordagain>", $line);
|
93 |
|
|
$line = preg_replace("/<crypto_password>.*?<\\/crypto_password>/", "<crypto_password>xxxxx</crypto_password>", $line);
|
94 |
|
|
$line = preg_replace("/<crypto_password2>.*?<\\/crypto_password2>/", "<crypto_password2>xxxxx</crypto_password2>", $line);
|
95 |
5b237745
|
Scott Ullrich
|
$line = str_replace("\t", " ", $line);
|
96 |
6c07db48
|
Phil Davis
|
echo htmlspecialchars($line, ENT_NOQUOTES);
|
97 |
6f62e89f
|
jim-p
|
fwrite($ofd, $line);
|
98 |
5b237745
|
Scott Ullrich
|
}
|
99 |
|
|
}
|
100 |
|
|
fclose($fd);
|
101 |
6f62e89f
|
jim-p
|
fclose($ofd);
|
102 |
5b237745
|
Scott Ullrich
|
} else {
|
103 |
6f62e89f
|
jim-p
|
$ofd = @fopen("{$output_path}/{$title}.txt", "w");
|
104 |
767a716e
|
Scott Ullrich
|
$execOutput = "";
|
105 |
|
|
$execStatus = "";
|
106 |
84fe48d4
|
jim-p
|
if ($method == "exec") {
|
107 |
|
|
exec($command . " 2>&1", $execOutput, $execStatus);
|
108 |
|
|
} elseif ($method == "php_func") {
|
109 |
|
|
$execOutput = explode("\n", $command());
|
110 |
|
|
}
|
111 |
5b237745
|
Scott Ullrich
|
for ($i = 0; isset($execOutput[$i]); $i++) {
|
112 |
|
|
if ($i > 0) {
|
113 |
|
|
echo "\n";
|
114 |
|
|
}
|
115 |
6c07db48
|
Phil Davis
|
echo htmlspecialchars($execOutput[$i], ENT_NOQUOTES);
|
116 |
6f62e89f
|
jim-p
|
fwrite($ofd, $execOutput[$i] . "\n");
|
117 |
5b237745
|
Scott Ullrich
|
}
|
118 |
6f62e89f
|
jim-p
|
fclose($ofd);
|
119 |
5b237745
|
Scott Ullrich
|
}
|
120 |
454cec57
|
sbeaver
|
|
121 |
abe98adb
|
Phil Davis
|
print('</pre>');
|
122 |
|
|
print('</div>');
|
123 |
454cec57
|
sbeaver
|
print('</div>');
|
124 |
5b237745
|
Scott Ullrich
|
}
|
125 |
|
|
|
126 |
|
|
/* Define a command, with a title, to be executed later. */
|
127 |
84fe48d4
|
jim-p
|
function defCmdT($title, $command, $method = "exec") {
|
128 |
2151894c
|
Colin Fleming
|
global $commands;
|
129 |
6c07db48
|
Phil Davis
|
$title = htmlspecialchars($title, ENT_NOQUOTES);
|
130 |
84fe48d4
|
jim-p
|
$commands[] = array($title, $command, $method);
|
131 |
5b237745
|
Scott Ullrich
|
}
|
132 |
|
|
|
133 |
|
|
/* List all of the commands as an index. */
|
134 |
|
|
function listCmds() {
|
135 |
454cec57
|
sbeaver
|
global $currentDate;
|
136 |
2151894c
|
Colin Fleming
|
global $commands;
|
137 |
454cec57
|
sbeaver
|
|
138 |
|
|
$rubbish = array('|', '-', '/', '.', ' '); /* fixes the <a> tag to be W3C compliant */
|
139 |
|
|
|
140 |
|
|
print('<div class="panel panel-default">');
|
141 |
84fe48d4
|
jim-p
|
print('<div class="panel-heading"><h2 class="panel-title">' . gettext("Firewall Status on ") . $currentDate . '</h2></div>');
|
142 |
abe98adb
|
Phil Davis
|
print('<div class="panel-body">');
|
143 |
|
|
print(' <div class="content">');
|
144 |
454cec57
|
sbeaver
|
print("\n<p>" . gettext("This status page includes the following information") . ":\n");
|
145 |
|
|
print("<ul>\n");
|
146 |
abe98adb
|
Phil Davis
|
for ($i = 0; isset($commands[$i]); $i++) {
|
147 |
|
|
print("\t<li><strong><a href=\"#" . str_replace($rubbish, '', $commands[$i][0]) . "\">" . $commands[$i][0] . "</a></strong></li>\n");
|
148 |
2151894c
|
Colin Fleming
|
}
|
149 |
454cec57
|
sbeaver
|
|
150 |
|
|
print("</ul>\n");
|
151 |
2ca4eec2
|
Jared Dillard
|
print(' </div>');
|
152 |
454cec57
|
sbeaver
|
print(' </div>');
|
153 |
|
|
print('</div>');
|
154 |
5b237745
|
Scott Ullrich
|
}
|
155 |
|
|
|
156 |
|
|
/* Execute all of the commands which were defined by a call to defCmd. */
|
157 |
|
|
function execCmds() {
|
158 |
2151894c
|
Colin Fleming
|
global $commands;
|
159 |
6c07db48
|
Phil Davis
|
for ($i = 0; isset($commands[$i]); $i++) {
|
160 |
84fe48d4
|
jim-p
|
doCmdT($commands[$i][0], $commands[$i][1], $commands[$i][2]);
|
161 |
|
|
}
|
162 |
|
|
}
|
163 |
|
|
|
164 |
|
|
function get_firewall_info() {
|
165 |
|
|
global $g, $output_path;
|
166 |
|
|
/* Firewall Platform/Serial */
|
167 |
a2da1706
|
jim-p
|
$firewall_info = "Product Name: " . htmlspecialchars($g['product_name']);
|
168 |
84fe48d4
|
jim-p
|
$platform = system_identify_specific_platform();
|
169 |
|
|
if (!empty($platform['descr'])) {
|
170 |
a2da1706
|
jim-p
|
$firewall_info .= "<br/>Platform: " . htmlspecialchars($platform['descr']);
|
171 |
2151894c
|
Colin Fleming
|
}
|
172 |
84fe48d4
|
jim-p
|
$serial = system_get_serial();
|
173 |
|
|
if (!empty($serial)) {
|
174 |
a2da1706
|
jim-p
|
$firewall_info .= "<br/>SN/UUID: " . htmlspecialchars($serial);
|
175 |
84fe48d4
|
jim-p
|
}
|
176 |
a2da1706
|
jim-p
|
|
177 |
|
|
if (!empty($g['product_version_string'])) {
|
178 |
c7fd8cd0
|
jim-p
|
$firewall_info .= "<br/>" . htmlspecialchars($g['product_name']) .
|
179 |
a2da1706
|
jim-p
|
" version: " . htmlspecialchars($g['product_version_string']);
|
180 |
|
|
}
|
181 |
|
|
|
182 |
|
|
if (file_exists('/etc/version.buildtime')) {
|
183 |
|
|
$build_time = file_get_contents('/etc/version.buildtime');
|
184 |
|
|
if (!empty($build_time)) {
|
185 |
|
|
$firewall_info .= "<br/>Built On: " . htmlspecialchars($build_time);
|
186 |
|
|
}
|
187 |
|
|
}
|
188 |
|
|
if (file_exists('/etc/version.lastcommit')) {
|
189 |
|
|
$build_commit = file_get_contents('/etc/version.lastcommit');
|
190 |
|
|
if (!empty($build_commit)) {
|
191 |
|
|
$firewall_info .= "<br/>Last Commit: " . htmlspecialchars($build_commit);
|
192 |
|
|
}
|
193 |
|
|
}
|
194 |
|
|
|
195 |
|
|
if (file_exists('/etc/version.gitsync')) {
|
196 |
|
|
$gitsync = file_get_contents('/etc/version.gitsync');
|
197 |
|
|
if (!empty($gitsync)) {
|
198 |
|
|
$firewall_info .= "<br/>A gitsync was performed at " .
|
199 |
|
|
date("D M j G:i:s T Y", filemtime('/etc/version.gitsync')) .
|
200 |
|
|
" to commit " . htmlspecialchars($gitsync);
|
201 |
|
|
}
|
202 |
|
|
}
|
203 |
|
|
|
204 |
84fe48d4
|
jim-p
|
file_put_contents("{$output_path}/Product Info.txt", str_replace("<br/>", "\n", $firewall_info) . "\n");
|
205 |
|
|
return $firewall_info;
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
function get_gateway_status() {
|
209 |
|
|
return return_gateways_status_text(true, false);
|
210 |
5b237745
|
Scott Ullrich
|
}
|
211 |
|
|
|
212 |
58f2f42a
|
Renato Botelho
|
global $g, $config;
|
213 |
1d169baa
|
Bill Marquette
|
|
214 |
5b237745
|
Scott Ullrich
|
/* Set up all of the commands we want to execute. */
|
215 |
289b91c8
|
jim-p
|
|
216 |
84fe48d4
|
jim-p
|
/* OS stats/info */
|
217 |
|
|
defCmdT("OS-Uptime", "/usr/bin/uptime");
|
218 |
|
|
defCmdT("Network-Interfaces", "/sbin/ifconfig -a");
|
219 |
|
|
defCmdT("Network-Interface Statistics", "/usr/bin/netstat -nWi");
|
220 |
|
|
defCmdT("Process-Top Usage", "/usr/bin/top | /usr/bin/head -n5");
|
221 |
|
|
defCmdT("Process-List", "/bin/ps xauwwd");
|
222 |
|
|
defCmdT("Disk-Mounted Filesystems", "/sbin/mount");
|
223 |
|
|
defCmdT("Disk-Free Space", "/bin/df -hi");
|
224 |
|
|
defCmdT("Network-Routing tables", "/usr/bin/netstat -nWr");
|
225 |
|
|
defCmdT("Network-Gateway Status", 'get_gateway_status', "php_func");
|
226 |
|
|
defCmdT("Network-Mbuf Usage", "/usr/bin/netstat -mb");
|
227 |
|
|
defCmdT("Network-Protocol Statistics", "/usr/bin/netstat -s");
|
228 |
|
|
defCmdT("Network-Sockets", "/usr/bin/sockstat");
|
229 |
|
|
defCmdT("Network-ARP Table", "/usr/sbin/arp -an");
|
230 |
|
|
defCmdT("Network-NDP Table", "/usr/sbin/ndp -na");
|
231 |
|
|
defCmdT("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
|
232 |
37502a4a
|
Scott Ullrich
|
|
233 |
289b91c8
|
jim-p
|
/* Firewall rules and info */
|
234 |
84fe48d4
|
jim-p
|
defCmdT("Firewall-Generated Ruleset", "/bin/cat {$g['tmp_path']}/rules.debug");
|
235 |
|
|
defCmdT("Firewall-Generated Ruleset Limiters", "/bin/cat {$g['tmp_path']}/rules.limiter");
|
236 |
|
|
defCmdT("Firewall-Generated Ruleset Limits", "/bin/cat {$g['tmp_path']}/rules.limits");
|
237 |
|
|
defCmdT("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
|
238 |
|
|
defCmdT("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
|
239 |
|
|
defCmdT("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
|
240 |
|
|
defCmdT("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
|
241 |
|
|
defCmdT("Firewall-pf Info", "/sbin/pfctl -si");
|
242 |
|
|
defCmdT("Firewall-pf Show All", "/sbin/pfctl -sa");
|
243 |
|
|
defCmdT("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
|
244 |
|
|
defCmdT("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
|
245 |
|
|
defCmdT("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
|
246 |
|
|
defCmdT("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
|
247 |
|
|
defCmdT("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
|
248 |
|
|
defCmdT("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
|
249 |
|
|
defCmdT("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
|
250 |
|
|
defCmdT("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
|
251 |
|
|
defCmdT("Firewall-IPFW Rules for Captive Portal", "/sbin/ipfw show");
|
252 |
|
|
defCmdT("Firewall-IPFW Limiter Info", "/sbin/ipfw pipe show");
|
253 |
|
|
defCmdT("Firewall-IPFW Queue Info", "/sbin/ipfw queue show");
|
254 |
|
|
|
255 |
|
|
if (is_array($config['load_balancer']['lbpool']) && is_array($config['load_balancer']['virtual_server'])) {
|
256 |
|
|
defCmdT("Load Balancer-Redirects", "/usr/local/sbin/relayctl show redirects");
|
257 |
|
|
defCmdT("Load Balancer-Relays", "/usr/local/sbin/relayctl show relays");
|
258 |
|
|
defCmdT("Load Balancer-Summary", "/usr/local/sbin/relayctl show summary");
|
259 |
baec2b00
|
Ermal
|
}
|
260 |
58f2f42a
|
Renato Botelho
|
|
261 |
6f62e89f
|
jim-p
|
/* Configuration Files */
|
262 |
84fe48d4
|
jim-p
|
defCmdT("Disk-Contents of var run", "/bin/ls /var/run");
|
263 |
|
|
defCmdT("Disk-Contents of conf", "/bin/ls /conf");
|
264 |
abe98adb
|
Phil Davis
|
defCmdT("config.xml", "dumpconfigxml");
|
265 |
84fe48d4
|
jim-p
|
defCmdT("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
|
266 |
|
|
defCmdT("DHCP-IPv4 Configuration", "/bin/cat /var/dhcpd/etc/dhcpd.conf");
|
267 |
|
|
defCmdT("DHCP-IPv6-Configuration", "/bin/cat /var/dhcpd/etc/dhcpdv6.conf");
|
268 |
|
|
defCmdT("IPsec-strongSwan Configuration", "/bin/cat /var/etc/ipsec/strongswan.conf");
|
269 |
|
|
defCmdT("IPsec-Configuration", "/bin/cat /var/etc/ipsec/ipsec.conf");
|
270 |
|
|
defCmdT("IPsec-Status", "/usr/local/sbin/ipsec statusall");
|
271 |
|
|
defCmdT("IPsec-SPD", "/sbin/setkey -DP");
|
272 |
|
|
defCmdT("IPsec-SAD", "/sbin/setkey -D");
|
273 |
6f62e89f
|
jim-p
|
if (file_exists("/cf/conf/upgrade_log.txt")) {
|
274 |
84fe48d4
|
jim-p
|
defCmdT("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
|
275 |
6f62e89f
|
jim-p
|
}
|
276 |
|
|
if (file_exists("/boot/loader.conf")) {
|
277 |
84fe48d4
|
jim-p
|
defCmdT("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
|
278 |
6f62e89f
|
jim-p
|
}
|
279 |
|
|
if (file_exists("/boot/loader.conf.local")) {
|
280 |
84fe48d4
|
jim-p
|
defCmdT("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
|
281 |
6f62e89f
|
jim-p
|
}
|
282 |
|
|
if (file_exists("/var/etc/filterdns.conf")) {
|
283 |
84fe48d4
|
jim-p
|
defCmdT("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
|
284 |
6f62e89f
|
jim-p
|
}
|
285 |
84fe48d4
|
jim-p
|
|
286 |
|
|
/* Logs */
|
287 |
|
|
defCmdT("Log-System-Last 1000 entries", "/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 1000");
|
288 |
|
|
defCmdT("Log-DHCP-Last 1000 entries", "/usr/local/sbin/clog /var/log/dhcpd.log 2>&1 | tail -n 1000");
|
289 |
|
|
defCmdT("Log-Filter-Last 500 entries", "/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 500");
|
290 |
|
|
defCmdT("Log-Gateways-Last 1000 entries", "/usr/local/sbin/clog /var/log/gateways.log 2>&1 | tail -n 1000");
|
291 |
|
|
defCmdT("Log-IPsec-Last 1000 entries", "/usr/local/sbin/clog /var/log/ipsec.log 2>&1 | tail -n 1000");
|
292 |
|
|
defCmdT("Log-L2TP-Last 1000 entries", "/usr/local/sbin/clog /var/log/l2tps.log 2>&1 | tail -n 1000");
|
293 |
|
|
defCmdT("Log-NTP-Last 1000 entries", "/usr/local/sbin/clog /var/log/ntpd.log 2>&1 | tail -n 1000");
|
294 |
|
|
defCmdT("Log-OpenVPN-Last 1000 entries", "/usr/local/sbin/clog /var/log/openvpn.log 2>&1 | tail -n 1000");
|
295 |
|
|
defCmdT("Log-Captive Portal Authentication-Last 1000 entries", "/usr/local/sbin/clog /var/log/portalauth.log 2>&1 | tail -n 1000");
|
296 |
|
|
defCmdT("Log-PPP-Last 1000 entries", "/usr/local/sbin/clog /var/log/poes.log 2>&1 | tail -n 1000");
|
297 |
|
|
defCmdT("Log-relayd-Last 1000 entries", "/usr/local/sbin/clog /var/log/relayd.log 2>&1 | tail -n 1000");
|
298 |
|
|
defCmdT("Log-DNS-Last 1000 entries", "/usr/local/sbin/clog /var/log/resolver.log 2>&1 | tail -n 1000");
|
299 |
|
|
defCmdT("Log-Routing-Last 1000 entries", "/usr/local/sbin/clog /var/log/routing.log 2>&1 | tail -n 1000");
|
300 |
|
|
defCmdT("Log-Wireless-Last 1000 entries", "/usr/local/sbin/clog /var/log/wireless.log 2>&1 | tail -n 1000");
|
301 |
6f62e89f
|
jim-p
|
if (file_exists("/tmp/PHP_errors.log")) {
|
302 |
84fe48d4
|
jim-p
|
defCmdT("Log-PHP Errors", "/bin/cat /tmp/PHP_errors.log");
|
303 |
6f62e89f
|
jim-p
|
}
|
304 |
84fe48d4
|
jim-p
|
defCmdT("OS-Message Buffer", "/sbin/dmesg -a");
|
305 |
|
|
defCmdT("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
|
306 |
|
|
|
307 |
|
|
/* OS/Hardware Status */
|
308 |
|
|
defCmdT("OS-sysctl values", "/sbin/sysctl -a");
|
309 |
|
|
defCmdT("OS-Kernel Environment", "/bin/kenv");
|
310 |
|
|
defCmdT("OS-Installed Packages", "/usr/sbin/pkg info");
|
311 |
|
|
defCmdT("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
|
312 |
|
|
defCmdT("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
|
313 |
387dbe43
|
jim-p
|
|
314 |
|
|
if (is_module_loaded("zfs.ko")) {
|
315 |
|
|
defCmdT("Disk-ZFS List", "/sbin/zfs list");
|
316 |
|
|
defCmdT("Disk-ZFS Properties", "/sbin/zfs get all");
|
317 |
|
|
defCmdT("Disk-ZFS Pool List", "/sbin/zpool list");
|
318 |
|
|
defCmdT("Disk-ZFS Pool Status", "/sbin/zpool status");
|
319 |
|
|
}
|
320 |
a2da1706
|
jim-p
|
defCmdT("Disk-GEOM Mirror Status", "/sbin/gmirror status");
|
321 |
9cd0b618
|
Scott Ullrich
|
|
322 |
5b237745
|
Scott Ullrich
|
exec("/bin/date", $dateOutput, $dateStatus);
|
323 |
|
|
$currentDate = $dateOutput[0];
|
324 |
|
|
|
325 |
84fe48d4
|
jim-p
|
$pgtitle = array($g['product_name'], "Status");
|
326 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
327 |
|
|
|
328 |
289b91c8
|
jim-p
|
print_info_box(gettext("Make sure all sensitive information is removed! (Passwords, etc.) before posting " .
|
329 |
8545adde
|
k-paulius
|
"information from this page in public places (like mailing lists).") . '<br />' .
|
330 |
289b91c8
|
jim-p
|
gettext("Common password fields in config.xml have been automatically redacted.") . '<br />' .
|
331 |
|
|
gettext("When the page has finished loading, the output will be stored in {$output_file}. It may be downloaded via scp or ") .
|
332 |
36a844df
|
Stephen Beaver
|
"<a href=\"/diag_command.php?dlPath={$output_file}\">" . gettext("Diagnostics > Command Prompt.") . '</a>');
|
333 |
5b237745
|
Scott Ullrich
|
|
334 |
84fe48d4
|
jim-p
|
print_info_box(get_firewall_info(), 'info', false);
|
335 |
|
|
|
336 |
454cec57
|
sbeaver
|
listCmds();
|
337 |
|
|
execCmds();
|
338 |
5b237745
|
Scott Ullrich
|
|
339 |
6543ffa4
|
Stephen Beaver
|
print(gettext("Saving output to archive..."));
|
340 |
|
|
|
341 |
|
|
if (is_dir($output_path)) {
|
342 |
|
|
mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
|
343 |
|
|
unlink_if_exists("{$output_path}/*");
|
344 |
|
|
@rmdir($output_path);
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
print(gettext("Done."));
|
348 |
|
|
|
349 |
56bd1847
|
Chris Buechler
|
include("foot.inc");
|