1 |
cfc707f7
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* status_logs.php
|
4 |
fd9ebcd5
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
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 |
0284d79e
|
jim-p
|
* Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
|
9 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
10 |
fd9ebcd5
|
Stephen Beaver
|
*
|
11 |
c5d81585
|
Renato Botelho
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
12 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
13 |
|
|
* All rights reserved.
|
14 |
fd9ebcd5
|
Stephen Beaver
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
16 |
|
|
* you may not use this file except in compliance with the License.
|
17 |
|
|
* You may obtain a copy of the License at
|
18 |
fd9ebcd5
|
Stephen Beaver
|
*
|
19 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
20 |
fd9ebcd5
|
Stephen Beaver
|
*
|
21 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
22 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
23 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24 |
|
|
* See the License for the specific language governing permissions and
|
25 |
|
|
* limitations under the License.
|
26 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
27 |
5b237745
|
Scott Ullrich
|
|
28 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
29 |
|
|
##|*IDENT=page-diagnostics-logs-system
|
30 |
5230f468
|
jim-p
|
##|*NAME=Status: Logs: System
|
31 |
0b8328c5
|
jim-p
|
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
|
32 |
1af5edbf
|
Stephen Beaver
|
##|*MATCH=status_logs.php
|
33 |
6b07c15a
|
Matthew Grooms
|
##|-PRIV
|
34 |
|
|
|
35 |
55f8344d
|
NOYB
|
require_once("status_logs_common.inc");
|
36 |
|
|
|
37 |
5b237745
|
Scott Ullrich
|
|
38 |
d8af270c
|
jim-p
|
/*
|
39 |
|
|
Build a list of allowed log files so we can reject others to prevent the page
|
40 |
|
|
from acting on unauthorized files.
|
41 |
|
|
*/
|
42 |
|
|
$allowed_logs = array(
|
43 |
3bd74348
|
bruno
|
"system" => array("name" => gettext("General"),
|
44 |
d8af270c
|
jim-p
|
"shortcut" => ""),
|
45 |
3bd74348
|
bruno
|
"dhcpd" => array("name" => gettext("DHCP"),
|
46 |
d8af270c
|
jim-p
|
"shortcut" => "dhcp"),
|
47 |
49967ae7
|
jim-p
|
"auth" => array("name" => gettext("General"),
|
48 |
|
|
"shortcut" => ""),
|
49 |
44c0a159
|
k-paulius
|
"portalauth" => array("name" => gettext("Captive Portal Auth"),
|
50 |
d8af270c
|
jim-p
|
"shortcut" => "captiveportal"),
|
51 |
3bd74348
|
bruno
|
"ipsec" => array("name" => gettext("IPsec"),
|
52 |
d8af270c
|
jim-p
|
"shortcut" => "ipsec"),
|
53 |
3bd74348
|
bruno
|
"ppp" => array("name" => gettext("PPP"),
|
54 |
d8af270c
|
jim-p
|
"shortcut" => ""),
|
55 |
3bd74348
|
bruno
|
"openvpn" => array("name" => gettext("OpenVPN"),
|
56 |
d8af270c
|
jim-p
|
"shortcut" => "openvpn"),
|
57 |
44c0a159
|
k-paulius
|
"ntpd" => array("name" => gettext("NTP"),
|
58 |
d8af270c
|
jim-p
|
"shortcut" => "ntp"),
|
59 |
3bd74348
|
bruno
|
"gateways" => array("name" => gettext("Gateways"),
|
60 |
d8af270c
|
jim-p
|
"shortcut" => "gateways"),
|
61 |
3bd74348
|
bruno
|
"routing" => array("name" => gettext("Routing"),
|
62 |
d8af270c
|
jim-p
|
"shortcut" => "routing"),
|
63 |
3bd74348
|
bruno
|
"resolver" => array("name" => gettext("DNS Resolver"),
|
64 |
d8af270c
|
jim-p
|
"shortcut" => "resolver"),
|
65 |
3bd74348
|
bruno
|
"wireless" => array("name" => gettext("Wireless"),
|
66 |
d8af270c
|
jim-p
|
"shortcut" => "wireless"),
|
67 |
db948c42
|
jim-p
|
"nginx" => array("name" => gettext("GUI Service"),
|
68 |
|
|
"shortcut" => ""),
|
69 |
|
|
"dmesg.boot" => array("name" => gettext("OS Boot"),
|
70 |
|
|
"shortcut" => ""),
|
71 |
|
|
"utx" => array("name" => gettext("OS User Events"),
|
72 |
|
|
"shortcut" => ""),
|
73 |
|
|
"userlog" => array("name" => gettext("OS Account Changes"),
|
74 |
|
|
"shortcut" => ""),
|
75 |
d8af270c
|
jim-p
|
);
|
76 |
|
|
|
77 |
1a8b6554
|
Steve Beaver
|
// The logs to display are specified in a REQUEST argument. Default to 'system' logs
|
78 |
|
|
if (!$_REQUEST['logfile']) {
|
79 |
0a5d0b7b
|
sbeaver
|
$logfile = 'system';
|
80 |
d8af270c
|
jim-p
|
} else {
|
81 |
1a8b6554
|
Steve Beaver
|
$logfile = $_REQUEST['logfile'];
|
82 |
d8af270c
|
jim-p
|
if (!array_key_exists($logfile, $allowed_logs)) {
|
83 |
|
|
/* Do not let someone attempt to load an unauthorized log. */
|
84 |
|
|
$logfile = 'system';
|
85 |
|
|
}
|
86 |
|
|
}
|
87 |
0a5d0b7b
|
sbeaver
|
|
88 |
76af8cdb
|
NOYB
|
|
89 |
55f8344d
|
NOYB
|
// Log Filter Submit - System
|
90 |
|
|
log_filter_form_system_submit();
|
91 |
76af8cdb
|
NOYB
|
|
92 |
|
|
|
93 |
55f8344d
|
NOYB
|
// Manage Log Section - Code
|
94 |
|
|
manage_log_code();
|
95 |
5b237745
|
Scott Ullrich
|
|
96 |
|
|
|
97 |
0039dab0
|
NOYB
|
// Status Logs Common - Code
|
98 |
|
|
status_logs_common_code();
|
99 |
0541e302
|
Scott Ullrich
|
|
100 |
|
|
|
101 |
5f601060
|
Phil Davis
|
if ($filtertext) {
|
102 |
36a166de
|
Scott Ullrich
|
$filtertextmeta="?filtertext=$filtertext";
|
103 |
5f601060
|
Phil Davis
|
}
|
104 |
59769c23
|
Scott Ullrich
|
|
105 |
db948c42
|
jim-p
|
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless', 'nginx', 'dmesg.boot'))) {
|
106 |
44c0a159
|
k-paulius
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext("System"), $allowed_logs[$logfile]["name"]);
|
107 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "status_logs.php", "status_logs.php", "@self");
|
108 |
49967ae7
|
jim-p
|
} elseif (in_array($logfile, array('auth', 'portalauth', 'utx', 'userlog'))) {
|
109 |
db948c42
|
jim-p
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext("Authentication"), $allowed_logs[$logfile]["name"]);
|
110 |
|
|
$pglinks = array("", "status_logs.php", "status_logs.php", "@self");
|
111 |
44c0a159
|
k-paulius
|
} else {
|
112 |
|
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
|
113 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "status_logs.php", "@self");
|
114 |
44c0a159
|
k-paulius
|
}
|
115 |
db948c42
|
jim-p
|
|
116 |
|
|
if (in_array($logfile, array('userlog', 'dmesg.boot'))) {
|
117 |
|
|
$rawfilter = true;
|
118 |
|
|
}
|
119 |
|
|
|
120 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
121 |
|
|
|
122 |
44c42356
|
Phil Davis
|
if ($changes_applied) {
|
123 |
|
|
print_apply_result_box($retval, $extra_save_msg);
|
124 |
76af8cdb
|
NOYB
|
$manage_log_active = false;
|
125 |
|
|
}
|
126 |
|
|
|
127 |
55f8344d
|
NOYB
|
// Tab Array
|
128 |
|
|
tab_array_logs_common();
|
129 |
33d52df1
|
sbeaver
|
|
130 |
c05363c8
|
NOYB
|
// Manage Log - Section/Form
|
131 |
|
|
if ($system_logs_manage_log_form_hidden) {
|
132 |
|
|
manage_log_section();
|
133 |
|
|
}
|
134 |
|
|
|
135 |
55f8344d
|
NOYB
|
// Filter Section/Form - System
|
136 |
|
|
filter_form_system();
|
137 |
ee4390ff
|
jim-p
|
if (($logfile == 'resolver') || ($logfile == 'system')) {
|
138 |
|
|
$inverse = array("ppp");
|
139 |
|
|
} else {
|
140 |
|
|
$inverse = null;
|
141 |
|
|
}
|
142 |
76af8cdb
|
NOYB
|
if (!$rawfilter) {
|
143 |
dc14d2b0
|
NOYB
|
system_log_filter();
|
144 |
ee4390ff
|
jim-p
|
}
|
145 |
|
|
|
146 |
e0977fed
|
smos
|
?>
|
147 |
9279147a
|
Stephen Beaver
|
|
148 |
e3efcb23
|
NOYB
|
<div class="panel panel-default">
|
149 |
|
|
<div class="panel-heading">
|
150 |
|
|
<h2 class="panel-title">
|
151 |
ee4390ff
|
jim-p
|
<?php print(system_log_table_panel_title()); ?>
|
152 |
e3efcb23
|
NOYB
|
</h2>
|
153 |
|
|
</div>
|
154 |
|
|
<div class="panel-body">
|
155 |
ee4390ff
|
jim-p
|
<div class="table-responsive">
|
156 |
b9db8882
|
NOYB
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
157 |
ee4390ff
|
jim-p
|
<?php if ($logfile == 'utx'): ?>
|
158 |
|
|
<thead>
|
159 |
|
|
<tr class="text-nowrap">
|
160 |
|
|
<th><?=gettext("Login Time")?></th>
|
161 |
|
|
<th><?=gettext("Duration")?></th>
|
162 |
|
|
<th><?=gettext("TTY")?></th>
|
163 |
|
|
<th style="width:100%"><?=gettext("User/Message")?></th>
|
164 |
|
|
</tr>
|
165 |
|
|
</thead>
|
166 |
|
|
<?php elseif ($rawfilter): ?>
|
167 |
|
|
<thead>
|
168 |
|
|
<tr class="text-nowrap">
|
169 |
|
|
<th><?=gettext("Time")?></th>
|
170 |
|
|
<th style="width:100%"><?=gettext("Message")?></th>
|
171 |
|
|
</tr>
|
172 |
|
|
</thead>
|
173 |
|
|
<?php else: ?>
|
174 |
b9db8882
|
NOYB
|
<thead>
|
175 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
176 |
b9db8882
|
NOYB
|
<th><?=gettext("Time")?></th>
|
177 |
|
|
<th><?=gettext("Process")?></th>
|
178 |
13474eee
|
NOYB
|
<th><?=gettext("PID")?></th>
|
179 |
|
|
<th style="width:100%"><?=gettext("Message")?></th>
|
180 |
b9db8882
|
NOYB
|
</tr>
|
181 |
|
|
</thead>
|
182 |
ee4390ff
|
jim-p
|
<?php endif; ?>
|
183 |
|
|
|
184 |
b9db8882
|
NOYB
|
<tbody>
|
185 |
ee4390ff
|
jim-p
|
<?php if (!$rawfilter): ?>
|
186 |
|
|
<?php foreach ($filterlog as $filterent): ?>
|
187 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
188 |
13474eee
|
NOYB
|
<td>
|
189 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['time'])?>
|
190 |
|
|
</td>
|
191 |
13474eee
|
NOYB
|
<td>
|
192 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['process'])?>
|
193 |
|
|
</td>
|
194 |
13474eee
|
NOYB
|
<td>
|
195 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['pid'])?>
|
196 |
|
|
</td>
|
197 |
|
|
<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
|
198 |
|
|
<?=htmlspecialchars($filterent['message'])?>
|
199 |
|
|
</td>
|
200 |
|
|
</tr>
|
201 |
ee4390ff
|
jim-p
|
<?php endforeach; ?>
|
202 |
|
|
<?php else:
|
203 |
|
|
system_log_filter(); ?>
|
204 |
|
|
<?php endif; ?>
|
205 |
be5bacfd
|
NOYB
|
</tbody>
|
206 |
e3efcb23
|
NOYB
|
</table>
|
207 |
ee4390ff
|
jim-p
|
<?php if ($rawfilter): ?>
|
208 |
7345fad6
|
NOYB
|
<script type="text/javascript">
|
209 |
|
|
//<![CDATA[
|
210 |
|
|
events.push(function() {
|
211 |
|
|
$("#count").html(<?=$rows?>);
|
212 |
|
|
});
|
213 |
|
|
//]]>
|
214 |
|
|
</script>
|
215 |
ee4390ff
|
jim-p
|
<?php else:
|
216 |
|
|
$rows = count($filterlog); ?>
|
217 |
|
|
<?php endif; ?>
|
218 |
e3efcb23
|
NOYB
|
<?php
|
219 |
abe98adb
|
Phil Davis
|
if ($rows == 0) {
|
220 |
8545adde
|
k-paulius
|
print_info_box(gettext('No logs to display.'));
|
221 |
abe98adb
|
Phil Davis
|
}
|
222 |
76af8cdb
|
NOYB
|
?>
|
223 |
ee4390ff
|
jim-p
|
</div>
|
224 |
76af8cdb
|
NOYB
|
</div>
|
225 |
|
|
</div>
|
226 |
|
|
<?php
|
227 |
e3efcb23
|
NOYB
|
|
228 |
76af8cdb
|
NOYB
|
# Manage Log - Section/Form
|
229 |
c05363c8
|
NOYB
|
if (!$system_logs_manage_log_form_hidden) {
|
230 |
|
|
manage_log_section();
|
231 |
|
|
}
|
232 |
e3efcb23
|
NOYB
|
?>
|
233 |
33d52df1
|
sbeaver
|
|
234 |
c10cb196
|
Stephen Beaver
|
<?php include("foot.inc"); ?>
|