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 |
38809d47
|
Renato Botelho do Couto
|
* Copyright (c) 2004-2013 BSD Perimeter
|
7 |
|
|
* Copyright (c) 2013-2016 Electric Sheep Fencing
|
8 |
a68f7a3d
|
Luiz Otavio O Souza
|
* Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
|
9 |
ac24dc24
|
Renato Botelho
|
* All rights reserved.
|
10 |
29aef6c4
|
Jim Thompson
|
*
|
11 |
ac24dc24
|
Renato Botelho
|
* originally based on m0n0wall (http://neon1.net/m0n0wall)
|
12 |
|
|
* Copyright (c) 2003 Jim McBeath <jimmc@macrovision.com>
|
13 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
14 |
|
|
* All rights reserved.
|
15 |
191cb31d
|
Stephen Beaver
|
*
|
16 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
17 |
|
|
* you may not use this file except in compliance with the License.
|
18 |
|
|
* You may obtain a copy of the License at
|
19 |
191cb31d
|
Stephen Beaver
|
*
|
20 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
21 |
191cb31d
|
Stephen Beaver
|
*
|
22 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
23 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
24 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
25 |
|
|
* See the License for the specific language governing permissions and
|
26 |
|
|
* limitations under the License.
|
27 |
191cb31d
|
Stephen Beaver
|
*/
|
28 |
6b07c15a
|
Matthew Grooms
|
|
29 |
|
|
##|+PRIV
|
30 |
|
|
##|*IDENT=page-hidden-detailedstatus
|
31 |
5230f468
|
jim-p
|
##|*NAME=Hidden: Detailed Status
|
32 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Hidden: Detailed Status' page.
|
33 |
|
|
##|*MATCH=status.php*
|
34 |
|
|
##|-PRIV
|
35 |
5b237745
|
Scott Ullrich
|
|
36 |
|
|
/* Execute a command, with a title, and generate an HTML table
|
37 |
|
|
* showing the results.
|
38 |
|
|
*/
|
39 |
1d169baa
|
Bill Marquette
|
|
40 |
6c17da07
|
jim-p
|
global $console;
|
41 |
|
|
global $show_output;
|
42 |
1e7eb790
|
jim-p
|
global $errors;
|
43 |
6c17da07
|
jim-p
|
|
44 |
|
|
$console = false;
|
45 |
|
|
$show_output = !isset($_GET['archiveonly']);
|
46 |
1e7eb790
|
jim-p
|
$errors = [];
|
47 |
edba13d5
|
jim-p
|
$output_path = "/tmp/status_output/";
|
48 |
|
|
$output_file = "/tmp/status_output.tgz";
|
49 |
6c17da07
|
jim-p
|
|
50 |
1e7eb790
|
jim-p
|
if ((php_sapi_name() == 'cli') ||
|
51 |
|
|
(defined('STDIN'))) {
|
52 |
6c17da07
|
jim-p
|
/* Running from console/shell, not web */
|
53 |
|
|
$console = true;
|
54 |
|
|
$show_output = false;
|
55 |
|
|
parse_str($argv[1], $_GET);
|
56 |
|
|
}
|
57 |
|
|
|
58 |
edba13d5
|
jim-p
|
require_once('status_output.inc');
|
59 |
6fee2381
|
Viktor G
|
|
60 |
1e7eb790
|
jim-p
|
if ($_POST['submit'] == "DOWNLOAD" &&
|
61 |
|
|
file_exists($output_file)) {
|
62 |
f7a72733
|
jim-p
|
session_cache_limiter('public');
|
63 |
ecb594d0
|
jim-p
|
send_user_download('file', $output_file);
|
64 |
f7a72733
|
jim-p
|
}
|
65 |
|
|
|
66 |
289b91c8
|
jim-p
|
if (is_dir($output_path)) {
|
67 |
|
|
unlink_if_exists("{$output_path}/*");
|
68 |
|
|
@rmdir($output_path);
|
69 |
|
|
}
|
70 |
|
|
unlink_if_exists($output_file);
|
71 |
|
|
mkdir($output_path);
|
72 |
|
|
|
73 |
1e7eb790
|
jim-p
|
if ($console) {
|
74 |
|
|
print(gettext("Gathering status data...") . "\n");
|
75 |
|
|
}
|
76 |
|
|
|
77 |
5b237745
|
Scott Ullrich
|
/* Set up all of the commands we want to execute. */
|
78 |
289b91c8
|
jim-p
|
|
79 |
84fe48d4
|
jim-p
|
/* OS stats/info */
|
80 |
2309b26a
|
jim-p
|
|
81 |
edba13d5
|
jim-p
|
status_cmd_define("OS-Uptime", "/usr/bin/uptime");
|
82 |
|
|
status_cmd_define("Network-Interfaces", "/sbin/ifconfig -vvvvvam");
|
83 |
|
|
status_cmd_define("Network-Interface Statistics", "/usr/bin/netstat -nWi");
|
84 |
|
|
status_cmd_define("Network-Multicast Groups", "/usr/sbin/ifmcstat");
|
85 |
|
|
status_cmd_define("Process-Top Usage", "/usr/bin/top | /usr/bin/head -n5");
|
86 |
|
|
status_cmd_define("Process-List", "/bin/ps xauwwd");
|
87 |
|
|
status_cmd_define("Disk-Mounted Filesystems", "/sbin/mount");
|
88 |
|
|
status_cmd_define("Disk-Free Space", "/bin/df -hi");
|
89 |
|
|
status_cmd_define("Network-Routing tables", "/usr/bin/netstat -nWr");
|
90 |
|
|
status_cmd_define("Network-IPv4 Nexthop Data", "/usr/bin/netstat -4onW");
|
91 |
|
|
status_cmd_define("Network-IPv6 Nexthop Data", "/usr/bin/netstat -6onW");
|
92 |
|
|
status_cmd_define("Network-IPv4 Nexthop Group Data", "/usr/bin/netstat -4OnW");
|
93 |
|
|
status_cmd_define("Network-IPv6 Nexthop Group Data", "/usr/bin/netstat -6OnW");
|
94 |
|
|
status_cmd_define("Network-Gateway Status", 'status_get_gateway_status', "php_func");
|
95 |
|
|
status_cmd_define("Network-Mbuf Usage", "/usr/bin/netstat -mb");
|
96 |
|
|
status_cmd_define("Network-Protocol Statistics", "/usr/bin/netstat -s");
|
97 |
|
|
status_cmd_define("Network-Buffer and Timer Statistics", "/usr/bin/netstat -nWx");
|
98 |
|
|
status_cmd_define("Network-Listen Queues", "/usr/bin/netstat -LaAn");
|
99 |
|
|
status_cmd_define("Network-Sockets", "/usr/bin/sockstat");
|
100 |
|
|
status_cmd_define("Network-ARP Table", "/usr/sbin/arp -an");
|
101 |
|
|
status_cmd_define("Network-NDP Table", "/usr/sbin/ndp -na");
|
102 |
|
|
status_cmd_define("OS-Kernel Modules", "/sbin/kldstat -v");
|
103 |
|
|
status_cmd_define("OS-Kernel VMStat", "/usr/bin/vmstat -afimsz");
|
104 |
37502a4a
|
Scott Ullrich
|
|
105 |
03ce1107
|
jim-p
|
/* If a device has a switch, put the switch configuration in the status output */
|
106 |
|
|
if (file_exists("/dev/etherswitch0")) {
|
107 |
edba13d5
|
jim-p
|
status_cmd_define("Network-Switch Configuration", "/sbin/etherswitchcfg -f /dev/etherswitch0 info");
|
108 |
03ce1107
|
jim-p
|
}
|
109 |
|
|
|
110 |
289b91c8
|
jim-p
|
/* Firewall rules and info */
|
111 |
edba13d5
|
jim-p
|
status_cmd_define("Firewall-Generated Ruleset", "/bin/cat " . g_get('tmp_path') . "/rules.debug");
|
112 |
|
|
status_cmd_define("Firewall-Generated Ruleset Limiters", "/bin/cat " . g_get('tmp_path') . "/rules.limiter");
|
113 |
|
|
status_cmd_define("Firewall-Generated Ruleset Limits", "/bin/cat " . g_get('tmp_path') . "/rules.limits");
|
114 |
|
|
foreach (glob(g_get('tmp_path') . "/rules.packages.*") as $pkgrules) {
|
115 |
14b8b150
|
Viktor G
|
$pkgname = substr($pkgrules, strrpos($pkgrules, '.') + 1);
|
116 |
edba13d5
|
jim-p
|
status_cmd_define("Firewall-Generated Package Invalid Ruleset {$pkgname}", "/bin/cat " . escapeshellarg($pkgrules));
|
117 |
14b8b150
|
Viktor G
|
}
|
118 |
1004053d
|
Viktor G
|
$ovpnradrules = array();
|
119 |
edba13d5
|
jim-p
|
foreach (glob(g_get('tmp_path') . "/ovpn_ovpns*.rules") as $ovpnrules) {
|
120 |
1004053d
|
Viktor G
|
if (preg_match('/ovpn_ovpns(\d+)\_(\w+)\_(\d+)\.rules/', basename($ovpnrules), $matches)) {
|
121 |
|
|
$ovpnradrules[$matches[1]] .= "# user '{$matches[2]}' remote port {$matches[3]}\n";
|
122 |
|
|
$ovpnradrules[$matches[1]] .= file_get_contents($ovpnrules);
|
123 |
|
|
$ovpnradrules[$matches[1]] .= "\n";
|
124 |
|
|
}
|
125 |
|
|
}
|
126 |
|
|
foreach ($ovpnradrules as $ovpns => $genrules) {
|
127 |
edba13d5
|
jim-p
|
status_cmd_define("OpenVPN-Generated RADIUS ACL Ruleset for server{$ovpns}",
|
128 |
1004053d
|
Viktor G
|
"echo " . escapeshellarg($genrules));
|
129 |
|
|
}
|
130 |
edba13d5
|
jim-p
|
status_cmd_define("Firewall-pf NAT Rules", "/sbin/pfctl -vvsn");
|
131 |
|
|
status_cmd_define("Firewall-pf Firewall Rules", "/sbin/pfctl -vvsr");
|
132 |
|
|
status_cmd_define("Firewall-pf Tables", "/sbin/pfctl -vs Tables");
|
133 |
|
|
status_cmd_define("Firewall-pf State Table Contents", "/sbin/pfctl -vvss");
|
134 |
|
|
status_cmd_define("Firewall-pf Info", "/sbin/pfctl -si");
|
135 |
|
|
status_cmd_define("Firewall-pf Show All", "/sbin/pfctl -sa");
|
136 |
|
|
status_cmd_define("Firewall-pf Queues", "/sbin/pfctl -s queue -v");
|
137 |
|
|
status_cmd_define("Firewall-pf OSFP", "/sbin/pfctl -s osfp");
|
138 |
|
|
status_cmd_define("Firewall-pftop Default", "/usr/local/sbin/pftop -a -b");
|
139 |
|
|
status_cmd_define("Firewall-pftop Long", "/usr/local/sbin/pftop -w 150 -a -b -v long");
|
140 |
|
|
status_cmd_define("Firewall-pftop Queue", "/usr/local/sbin/pftop -w 150 -a -b -v queue");
|
141 |
|
|
status_cmd_define("Firewall-pftop Rules", "/usr/local/sbin/pftop -w 150 -a -b -v rules");
|
142 |
|
|
status_cmd_define("Firewall-pftop Size", "/usr/local/sbin/pftop -w 150 -a -b -v size");
|
143 |
|
|
status_cmd_define("Firewall-pftop Speed", "/usr/local/sbin/pftop -w 150 -a -b -v speed");
|
144 |
|
|
status_cmd_define("Firewall-Limiter Info", "/sbin/dnctl pipe show");
|
145 |
|
|
status_cmd_define("Firewall-Queue Info", "/sbin/dnctl queue show");
|
146 |
84fe48d4
|
jim-p
|
|
147 |
6f62e89f
|
jim-p
|
/* Configuration Files */
|
148 |
edba13d5
|
jim-p
|
status_cmd_define("Disk-Contents of var run", "/bin/ls /var/run");
|
149 |
|
|
status_cmd_define("Disk-Contents of conf", "/bin/ls /conf");
|
150 |
|
|
status_cmd_define("config.xml", "dumpconfigxml");
|
151 |
|
|
status_cmd_define("DNS-Resolution Configuration", "/bin/cat /etc/resolv.conf");
|
152 |
|
|
status_cmd_define("DNS-Resolver Access Lists", "/bin/cat /var/unbound/access_lists.conf");
|
153 |
|
|
status_cmd_define("DNS-Resolver Configuration", "/bin/cat /var/unbound/unbound.conf");
|
154 |
|
|
status_cmd_define("DNS-Resolver Domain Overrides", "/bin/cat /var/unbound/domainoverrides.conf");
|
155 |
|
|
status_cmd_define("DNS-Resolver Host Overrides", "/bin/cat /var/unbound/host_entries.conf");
|
156 |
b73a6caa
|
jim-p
|
|
157 |
|
|
if (file_exists("/var/dhcpd/etc/dhcpd.conf")) {
|
158 |
|
|
status_cmd_define("DHCP-ISC-IPv4 Configuration", '/usr/bin/sed "s/\([[:blank:]]secret \).*/\1<redacted>/" /var/dhcpd/etc/dhcpd.conf');
|
159 |
|
|
}
|
160 |
|
|
if (file_exists("/var/dhcpd/etc/dhcpdv6.conf")) {
|
161 |
|
|
status_cmd_define("DHCP-ISC-IPv6-Configuration", '/usr/bin/sed "s/\([[:blank:]]secret \).*/\1<redacted>/" /var/dhcpd/etc/dhcpdv6.conf');
|
162 |
|
|
}
|
163 |
328919e8
|
jim-p
|
if (file_exists("/usr/local/etc/kea/kea-dhcp4.conf") &&
|
164 |
|
|
!compare_files("/usr/local/etc/kea/kea-dhcp4.conf", "/usr/local/etc/kea/kea-dhcp4.conf.sample")) {
|
165 |
b73a6caa
|
jim-p
|
status_cmd_define("DHCP-Kea-IPv4 Configuration", '/bin/cat /usr/local/etc/kea/kea-dhcp4.conf');
|
166 |
|
|
}
|
167 |
328919e8
|
jim-p
|
if (file_exists("/usr/local/etc/kea/kea-dhcp6.conf") &&
|
168 |
|
|
!compare_files("/usr/local/etc/kea/kea-dhcp6.conf", "/usr/local/etc/kea/kea-dhcp6.conf.sample")) {
|
169 |
b73a6caa
|
jim-p
|
status_cmd_define("DHCP-Kea-IPv6 Configuration", '/bin/cat /usr/local/etc/kea/kea-dhcp6.conf');
|
170 |
|
|
}
|
171 |
|
|
|
172 |
a46b65d8
|
jim-p
|
if (file_exists("/var/etc/ipsec/strongswan.conf")) {
|
173 |
|
|
status_cmd_define("IPsec-strongSwan Configuration", '/usr/bin/sed "s/\([[:blank:]]secret = \).*/\1<redacted>/" /var/etc/ipsec/strongswan.conf');
|
174 |
|
|
}
|
175 |
|
|
if (file_exists("/var/etc/ipsec/swanctl.conf")) {
|
176 |
|
|
status_cmd_define("IPsec-Configuration", '/usr/bin/sed -E "s/([[:blank:]]*(secret|pin) = ).*/\1<redacted>/" /var/etc/ipsec/swanctl.conf');
|
177 |
|
|
}
|
178 |
|
|
if (file_exists("/var/run/charon.vici")) {
|
179 |
|
|
status_cmd_define("IPsec-Status-Statistics", "/usr/local/sbin/swanctl --stats --pretty");
|
180 |
|
|
status_cmd_define("IPsec-Status-Connections", "/usr/local/sbin/swanctl --list-conns");
|
181 |
|
|
status_cmd_define("IPsec-Status-Active SAs", "/usr/local/sbin/swanctl --list-sas");
|
182 |
|
|
status_cmd_define("IPsec-Status-Policies", "/usr/local/sbin/swanctl --list-pols");
|
183 |
|
|
status_cmd_define("IPsec-Status-Certificates", "/usr/local/sbin/swanctl --list-certs --utc");
|
184 |
|
|
status_cmd_define("IPsec-Status-Pools", "/usr/local/sbin/swanctl --list-pools --leases");
|
185 |
|
|
}
|
186 |
|
|
|
187 |
edba13d5
|
jim-p
|
status_cmd_define("IPsec-SPD", "/sbin/setkey -DP");
|
188 |
|
|
status_cmd_define("IPsec-SAD", "/sbin/setkey -D");
|
189 |
6f62e89f
|
jim-p
|
if (file_exists("/cf/conf/upgrade_log.txt")) {
|
190 |
edba13d5
|
jim-p
|
status_cmd_define("OS-Upgrade Log", "/bin/cat /cf/conf/upgrade_log.txt");
|
191 |
6f62e89f
|
jim-p
|
}
|
192 |
6c773de2
|
Viktor Gurov
|
if (file_exists("/cf/conf/upgrade_log.latest.txt")) {
|
193 |
edba13d5
|
jim-p
|
status_cmd_define("OS-Upgrade Log Latest", "/bin/cat /cf/conf/upgrade_log.latest.txt");
|
194 |
6c773de2
|
Viktor Gurov
|
}
|
195 |
6f62e89f
|
jim-p
|
if (file_exists("/boot/loader.conf")) {
|
196 |
edba13d5
|
jim-p
|
status_cmd_define("OS-Boot Loader Configuration", "/bin/cat /boot/loader.conf");
|
197 |
6f62e89f
|
jim-p
|
}
|
198 |
|
|
if (file_exists("/boot/loader.conf.local")) {
|
199 |
edba13d5
|
jim-p
|
status_cmd_define("OS-Boot Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
|
200 |
6f62e89f
|
jim-p
|
}
|
201 |
607a638b
|
jim-p
|
if (file_exists("/boot/loader.conf.lua")) {
|
202 |
|
|
status_cmd_define("OS-Boot Loader Configuration (Lua)", "/bin/cat /boot/loader.conf.lua");
|
203 |
|
|
}
|
204 |
6f62e89f
|
jim-p
|
if (file_exists("/var/etc/filterdns.conf")) {
|
205 |
edba13d5
|
jim-p
|
status_cmd_define("DNS-filterdns Daemon Configuration", "/bin/cat /var/etc/filterdns.conf");
|
206 |
6f62e89f
|
jim-p
|
}
|
207 |
84fe48d4
|
jim-p
|
|
208 |
edc7e81f
|
jim-p
|
if (is_dir("/var/etc/openvpn")) {
|
209 |
|
|
foreach(glob('/var/etc/openvpn/*/config.ovpn') as $file) {
|
210 |
|
|
$ovpnfile = explode('/', $file);
|
211 |
|
|
if (!count($ovpnfile) || (count($ovpnfile) < 6)) {
|
212 |
|
|
continue;
|
213 |
|
|
}
|
214 |
edba13d5
|
jim-p
|
status_cmd_define("OpenVPN-Configuration {$ovpnfile[4]}", "/bin/cat " . escapeshellarg($file));
|
215 |
edc7e81f
|
jim-p
|
}
|
216 |
|
|
}
|
217 |
|
|
|
218 |
ef1bc81d
|
Viktor G
|
if (file_exists("/var/etc/l2tp-vpn/mpd.conf")) {
|
219 |
edba13d5
|
jim-p
|
status_cmd_define("L2TP-Configuration", '/usr/bin/sed -E "s/([[:blank:]](secret|radius server .*) ).*/\1<redacted>/" /var/etc/l2tp-vpn/mpd.conf');
|
220 |
ef1bc81d
|
Viktor G
|
}
|
221 |
|
|
|
222 |
db95baf1
|
Viktor G
|
/* Config History */
|
223 |
|
|
$confvers = get_backups();
|
224 |
|
|
unset($confvers['versions']);
|
225 |
|
|
if (count($confvers) != 0) {
|
226 |
|
|
for ($c = count($confvers)-1; $c >= 0; $c--) {
|
227 |
|
|
$conf_history .= backup_info($confvers[$c], $c+1);
|
228 |
|
|
$conf_history .= "\n";
|
229 |
|
|
}
|
230 |
edba13d5
|
jim-p
|
status_cmd_define("Config History", "echo " . escapeshellarg($conf_history));
|
231 |
|
|
}
|
232 |
|
|
|
233 |
|
|
status_log_add("System", '/var/log/system.log');
|
234 |
|
|
status_log_add("DHCP", '/var/log/dhcpd.log');
|
235 |
|
|
status_log_add("Filter", '/var/log/filter.log');
|
236 |
|
|
status_log_add("Gateways", '/var/log/gateways.log');
|
237 |
|
|
status_log_add("IPsec", '/var/log/ipsec.log');
|
238 |
|
|
status_log_add("L2TP", '/var/log/l2tps.log');
|
239 |
|
|
status_log_add("NTP", '/var/log/ntpd.log');
|
240 |
|
|
status_log_add("OpenVPN", '/var/log/openvpn.log');
|
241 |
|
|
status_log_add("Captive Portal Authentication", '/var/log/portalauth.log');
|
242 |
|
|
status_log_add("PPP", '/var/log/ppp.log');
|
243 |
|
|
status_log_add("PPPoE Server", '/var/log/poes.log');
|
244 |
|
|
status_log_add("DNS", '/var/log/resolver.log');
|
245 |
|
|
status_log_add("Routing", '/var/log/routing.log');
|
246 |
|
|
status_log_add("Wireless", '/var/log/wireless.log');
|
247 |
|
|
status_log_add("PHP Errors", '/tmp/PHP_errors.log', 'all');
|
248 |
|
|
|
249 |
|
|
status_cmd_define("OS-Message Buffer", "/sbin/dmesg -a");
|
250 |
|
|
status_cmd_define("OS-Message Buffer (Boot)", "/bin/cat /var/log/dmesg.boot");
|
251 |
84fe48d4
|
jim-p
|
|
252 |
|
|
/* OS/Hardware Status */
|
253 |
edba13d5
|
jim-p
|
status_cmd_define("OS-sysctl values", "/sbin/sysctl -aq");
|
254 |
|
|
status_cmd_define("OS-Kernel Environment", "/bin/kenv");
|
255 |
|
|
status_cmd_define("OS-Kernel Memory Usage", "/usr/local/sbin/kmemusage.sh");
|
256 |
|
|
status_cmd_define("OS-Installed Packages", "/usr/local/sbin/pkg-static info");
|
257 |
|
|
status_cmd_define("OS-Package Manager Configuration", "/usr/local/sbin/pkg-static -vv");
|
258 |
|
|
status_cmd_define("Hardware-PCI Devices", "/usr/sbin/pciconf -lvb");
|
259 |
|
|
status_cmd_define("Hardware-USB Devices", "/usr/sbin/usbconfig dump_device_desc");
|
260 |
387dbe43
|
jim-p
|
|
261 |
edba13d5
|
jim-p
|
status_cmd_define("Disk-Filesystem Table", "/bin/cat /etc/fstab");
|
262 |
|
|
status_cmd_define("Disk-Swap Information", "/usr/sbin/swapinfo");
|
263 |
d6911589
|
jim-p
|
|
264 |
387dbe43
|
jim-p
|
if (is_module_loaded("zfs.ko")) {
|
265 |
edba13d5
|
jim-p
|
status_cmd_define("Disk-ZFS List", "/sbin/zfs list");
|
266 |
|
|
status_cmd_define("Disk-ZFS Properties", "/sbin/zfs get all");
|
267 |
|
|
status_cmd_define("Disk-ZFS Pool List", "/sbin/zpool list");
|
268 |
|
|
status_cmd_define("Disk-ZFS Pool Status", "/sbin/zpool status");
|
269 |
387dbe43
|
jim-p
|
}
|
270 |
d6911589
|
jim-p
|
|
271 |
edba13d5
|
jim-p
|
status_cmd_define("Disk-GEOM Tree", "/sbin/geom -t");
|
272 |
|
|
status_cmd_define("Disk-GEOM Disk List", "/sbin/geom disk list -a");
|
273 |
|
|
status_cmd_define("Disk-GEOM Partition Summary", "/sbin/geom part show -p");
|
274 |
|
|
status_cmd_define("Disk-GEOM Partition Details", "/sbin/geom part list");
|
275 |
|
|
status_cmd_define("Disk-GEOM Label Status", "/sbin/geom label status");
|
276 |
|
|
status_cmd_define("Disk-GEOM Label Details", "/sbin/geom label list");
|
277 |
|
|
status_cmd_define("Disk-GEOM Mirror Status", "/sbin/gmirror status");
|
278 |
9cd0b618
|
Scott Ullrich
|
|
279 |
36ab2068
|
jim-p
|
/* Items specific to EFI */
|
280 |
|
|
if (get_single_sysctl("machdep.bootmethod") == "UEFI") {
|
281 |
|
|
/* Basic EFI boot list is easier to read but only includes active entries */
|
282 |
|
|
status_cmd_define("EFI-Boot Manager List", "/usr/sbin/efibootmgr");
|
283 |
|
|
/* Verbose EFI boot list has a lot more detail but is more difficult to read */
|
284 |
|
|
status_cmd_define("EFI-Boot Manager List (Verbose)", "/usr/sbin/efibootmgr -v");
|
285 |
|
|
}
|
286 |
|
|
|
287 |
5b237745
|
Scott Ullrich
|
exec("/bin/date", $dateOutput, $dateStatus);
|
288 |
|
|
$currentDate = $dateOutput[0];
|
289 |
|
|
|
290 |
2568e151
|
Christian McDonald
|
$pgtitle = array(g_get('product_label'), "Status");
|
291 |
6c17da07
|
jim-p
|
|
292 |
|
|
if (!$console):
|
293 |
f7a72733
|
jim-p
|
include("head.inc"); ?>
|
294 |
|
|
|
295 |
|
|
<form action="status.php" method="post">
|
296 |
4df96eff
|
Scott Ullrich
|
|
297 |
f7a72733
|
jim-p
|
<?php print_info_box(
|
298 |
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.") .
|
299 |
7f0d6ccf
|
Phil Davis
|
'<br />' .
|
300 |
6c17da07
|
jim-p
|
gettext("Common password and other private fields in config.xml have been automatically redacted.") .
|
301 |
7f0d6ccf
|
Phil Davis
|
'<br />' .
|
302 |
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) .
|
303 |
|
|
' <button name="submit" type="submit" class="btn btn-primary btn-sm" id="download" value="DOWNLOAD">' .
|
304 |
e0cb987c
|
Marcos Mendoza
|
'<i class="fa-solid fa-download icon-embed-btn"></i>' .
|
305 |
f7a72733
|
jim-p
|
gettext("Download") .
|
306 |
|
|
'</button>'); ?>
|
307 |
|
|
|
308 |
|
|
</form>
|
309 |
5b237745
|
Scott Ullrich
|
|
310 |
edba13d5
|
jim-p
|
<?php print_info_box(status_get_firewall_info(), 'info', false);
|
311 |
|
|
|
312 |
|
|
/* Call any registeredd package plugins which define status output to include
|
313 |
|
|
* See https://redmine.pfsense.org/issues/14777 and
|
314 |
|
|
* https://redmine.pfsense.org/issues/1458
|
315 |
|
|
*/
|
316 |
|
|
$pluginparams = array();
|
317 |
|
|
$pluginparams['type'] = 'statusoutput';
|
318 |
|
|
pkg_call_plugins('plugin_statusoutput', $pluginparams);
|
319 |
84fe48d4
|
jim-p
|
|
320 |
6c17da07
|
jim-p
|
if ($show_output) {
|
321 |
edba13d5
|
jim-p
|
status_cmd_list();
|
322 |
6c17da07
|
jim-p
|
} else {
|
323 |
|
|
print_info_box(gettext("Status output suppressed. Download archive to view."), 'info', false);
|
324 |
|
|
}
|
325 |
|
|
|
326 |
|
|
endif;
|
327 |
|
|
|
328 |
|
|
if ($console) {
|
329 |
edba13d5
|
jim-p
|
status_get_firewall_info();
|
330 |
6c17da07
|
jim-p
|
}
|
331 |
edba13d5
|
jim-p
|
|
332 |
|
|
status_cmd_run_all();
|
333 |
5b237745
|
Scott Ullrich
|
|
334 |
1e7eb790
|
jim-p
|
if (!empty($errors)) {
|
335 |
edba13d5
|
jim-p
|
$errorheader = gettext('Errors') . ": " . count($errors) . "\n";
|
336 |
b44dbd7c
|
jim-p
|
$errors[] = gettext("NOTE: Some errors are normal if a feature is not enabled or is inaccessible by the current user.\n");
|
337 |
edba13d5
|
jim-p
|
$errortext = $errorheader . implode('', $errors);
|
338 |
1e7eb790
|
jim-p
|
file_put_contents("{$output_path}/_errors.txt", $errortext);
|
339 |
|
|
if ($console) {
|
340 |
|
|
echo $errortext;
|
341 |
|
|
} else {
|
342 |
edba13d5
|
jim-p
|
print_info_box($errorheader . "<br/>" . implode('<br/>', $errors), 'warning', false);
|
343 |
1e7eb790
|
jim-p
|
}
|
344 |
|
|
}
|
345 |
|
|
|
346 |
6543ffa4
|
Stephen Beaver
|
print(gettext("Saving output to archive..."));
|
347 |
|
|
|
348 |
|
|
if (is_dir($output_path)) {
|
349 |
|
|
mwexec("/usr/bin/tar czpf " . escapeshellarg($output_file) . " -C " . escapeshellarg(dirname($output_path)) . " " . escapeshellarg(basename($output_path)));
|
350 |
6c17da07
|
jim-p
|
|
351 |
|
|
if (!isset($_GET["nocleanup"])) {
|
352 |
|
|
unlink_if_exists("{$output_path}/*");
|
353 |
|
|
@rmdir($output_path);
|
354 |
|
|
}
|
355 |
6543ffa4
|
Stephen Beaver
|
}
|
356 |
|
|
|
357 |
6c17da07
|
jim-p
|
print(gettext("Done.") . "\n");
|
358 |
6543ffa4
|
Stephen Beaver
|
|
359 |
6c17da07
|
jim-p
|
if (!$console) {
|
360 |
|
|
include("foot.inc");
|
361 |
|
|
}
|