1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
diag_logs_filter.php
|
5
|
part of pfSense
|
6
|
Copyright (C) 2004-2009 Scott Ullrich
|
7
|
originally based on m0n0wall (http://m0n0.ch/wall)
|
8
|
|
9
|
Copyright (C) 2003-2009 Manuel Kasper <mk@neon1.net>,
|
10
|
Jim Pingle jim@pingle.org
|
11
|
All rights reserved.
|
12
|
|
13
|
Redistribution and use in source and binary forms, with or without
|
14
|
modification, are permitted provided that the following conditions are met:
|
15
|
|
16
|
1. Redistributions of source code must retain the above copyright notice,
|
17
|
this list of conditions and the following disclaimer.
|
18
|
|
19
|
2. Redistributions in binary form must reproduce the above copyright
|
20
|
notice, this list of conditions and the following disclaimer in the
|
21
|
documentation and/or other materials provided with the distribution.
|
22
|
|
23
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
POSSIBILITY OF SUCH DAMAGE.
|
33
|
*/
|
34
|
|
35
|
/*
|
36
|
pfSense_MODULE: filter
|
37
|
*/
|
38
|
|
39
|
##|+PRIV
|
40
|
##|*IDENT=page-diagnostics-logs-firewall
|
41
|
##|*NAME=Diagnostics: Logs: Firewall page
|
42
|
##|*DESCR=Allow access to the 'Diagnostics: Logs: Firewall' page.
|
43
|
##|*MATCH=diag_logs_filter.php*
|
44
|
##|-PRIV
|
45
|
|
46
|
require("guiconfig.inc");
|
47
|
require_once("filter_log.inc");
|
48
|
|
49
|
# --- AJAX RESOLVE ---
|
50
|
if (isset($_POST['resolve'])) {
|
51
|
$ip = strtolower($_POST['resolve']);
|
52
|
$res = (is_ipaddr($ip) ? gethostbyaddr($ip) : '');
|
53
|
|
54
|
if ($res && $res != $ip)
|
55
|
$response = array('resolve_ip' => $ip, 'resolve_text' => $res);
|
56
|
else
|
57
|
$response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
|
58
|
|
59
|
echo json_encode(str_replace("\\","\\\\", $response)); // single escape chars can break JSON decode
|
60
|
exit;
|
61
|
}
|
62
|
|
63
|
function getGETPOSTsettingvalue($settingname, $default)
|
64
|
{
|
65
|
$settingvalue = $default;
|
66
|
if($_GET[$settingname])
|
67
|
$settingvalue = $_GET[$settingname];
|
68
|
if($_POST[$settingname])
|
69
|
$settingvalue = $_POST[$settingname];
|
70
|
return $settingvalue;
|
71
|
}
|
72
|
|
73
|
$rulenum = getGETPOSTsettingvalue('getrulenum', null);
|
74
|
if($rulenum) {
|
75
|
list($rulenum, $tracker, $type) = explode(',', $rulenum);
|
76
|
$rule = find_rule_by_number($rulenum, $tracker, $type);
|
77
|
echo gettext("The rule that triggered this action is") . ":\n\n{$rule}";
|
78
|
exit;
|
79
|
}
|
80
|
|
81
|
$filtersubmit = getGETPOSTsettingvalue('filtersubmit', null);
|
82
|
if ($filtersubmit) {
|
83
|
$interfacefilter = getGETPOSTsettingvalue('interface', null);
|
84
|
$filtertext = getGETPOSTsettingvalue('filtertext', "");
|
85
|
$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
|
86
|
}
|
87
|
|
88
|
$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
|
89
|
if ($filterlogentries_submit) {
|
90
|
$filterfieldsarray = array();
|
91
|
|
92
|
$actpass = getGETPOSTsettingvalue('actpass', null);
|
93
|
$actblock = getGETPOSTsettingvalue('actblock', null);
|
94
|
|
95
|
$filterfieldsarray['act'] = str_replace(" ", " ", trim($actpass . " " . $actblock));
|
96
|
$filterfieldsarray['act'] = $filterfieldsarray['act'] != "" ? $filterfieldsarray['act'] : 'All';
|
97
|
$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
|
98
|
$filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null);
|
99
|
$filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null);
|
100
|
$filterfieldsarray['srcport'] = getGETPOSTsettingvalue('filterlogentries_sourceport', null);
|
101
|
$filterfieldsarray['dstip'] = getGETPOSTsettingvalue('filterlogentries_destinationipaddress', null);
|
102
|
$filterfieldsarray['dstport'] = getGETPOSTsettingvalue('filterlogentries_destinationport', null);
|
103
|
$filterfieldsarray['proto'] = getGETPOSTsettingvalue('filterlogentries_protocol', null);
|
104
|
$filterfieldsarray['tcpflags'] = getGETPOSTsettingvalue('filterlogentries_protocolflags', null);
|
105
|
$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
|
106
|
}
|
107
|
|
108
|
$filter_logfile = "{$g['varlog_path']}/filter.log";
|
109
|
|
110
|
$nentries = $config['syslog']['nentries'];
|
111
|
|
112
|
# Override Display Quantity
|
113
|
if ($filterlogentries_qty)
|
114
|
$nentries = $filterlogentries_qty;
|
115
|
|
116
|
if (!$nentries)
|
117
|
$nentries = 50;
|
118
|
|
119
|
if ($_POST['clear'])
|
120
|
clear_log_file($filter_logfile);
|
121
|
|
122
|
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall"));
|
123
|
$shortcut_section = "firewall";
|
124
|
include("head.inc");
|
125
|
|
126
|
?>
|
127
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
128
|
<script src="/javascript/filter_log.js" type="text/javascript"></script>
|
129
|
<?php include("fbegin.inc"); ?>
|
130
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs filter">
|
131
|
<tr><td>
|
132
|
<?php
|
133
|
$tab_array = array();
|
134
|
$tab_array[] = array(gettext("System"), false, "diag_logs.php");
|
135
|
$tab_array[] = array(gettext("Firewall"), true, "diag_logs_filter.php");
|
136
|
$tab_array[] = array(gettext("DHCP"), false, "diag_logs_dhcp.php");
|
137
|
$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs_auth.php");
|
138
|
$tab_array[] = array(gettext("IPsec"), false, "diag_logs_ipsec.php");
|
139
|
$tab_array[] = array(gettext("PPP"), false, "diag_logs_ppp.php");
|
140
|
$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
|
141
|
$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs_relayd.php");
|
142
|
$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs_openvpn.php");
|
143
|
$tab_array[] = array(gettext("NTP"), false, "diag_logs_ntpd.php");
|
144
|
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
|
145
|
display_top_tabs($tab_array);
|
146
|
?>
|
147
|
</td></tr>
|
148
|
<tr><td class="tabnavtbl">
|
149
|
<?php
|
150
|
$tab_array = array();
|
151
|
$tab_array[] = array(gettext("Normal View"), true, "/diag_logs_filter.php");
|
152
|
$tab_array[] = array(gettext("Dynamic View"), false, "/diag_logs_filter_dynamic.php");
|
153
|
$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
|
154
|
display_top_tabs($tab_array);
|
155
|
?>
|
156
|
</td>
|
157
|
</tr>
|
158
|
<tr>
|
159
|
<td>
|
160
|
<div id="mainarea">
|
161
|
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" style="sortableMultirow:<?=$config['syslog']['filterdescriptions'] === "2"?2:1?>" summary="main area">
|
162
|
<tr>
|
163
|
<td colspan="<?=(!isset($config['syslog']['rawfilter']))?7:2?>" align="left" valign="middle">
|
164
|
<div id="filterlogentries_show" class="widgetconfigdiv" style="<?=(!isset($config['syslog']['rawfilter']))?"":"display:none"?>">
|
165
|
<form id="filterlogentries" name="filterlogentries" action="diag_logs_filter.php" method="post">
|
166
|
<?php
|
167
|
$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
|
168
|
if ($filterfieldsarray['interface'] == "All") $interface = "";
|
169
|
?>
|
170
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="action">
|
171
|
<tr>
|
172
|
<td rowspan="2">
|
173
|
<div align="center"><?=gettext("Action");?></div>
|
174
|
<div align="left">
|
175
|
<input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked=\"checked\""; ?> /> Pass<br />
|
176
|
<input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked=\"checked\""; ?> /> Block<br />
|
177
|
</div>
|
178
|
</td>
|
179
|
<td>
|
180
|
<div align="center"><?=gettext("Time");?></div>
|
181
|
<div align="center"><input id="filterlogentries_time" name="filterlogentries_time" class="formfld search" type="text" size="12" value="<?= $filterfieldsarray['time'] ?>" /></div>
|
182
|
</td>
|
183
|
<td>
|
184
|
<div align="center"><?=gettext("Source IP Address");?></div>
|
185
|
<div align="center"><input id="filterlogentries_sourceipaddress" name="filterlogentries_sourceipaddress" class="formfld search" type="text" size="35" value="<?= $filterfieldsarray['srcip'] ?>" /></div>
|
186
|
</td>
|
187
|
<td>
|
188
|
<div align="center"><?=gettext("Source Port");?></div>
|
189
|
<div align="center"><input id="filterlogentries_sourceport" name="filterlogentries_sourceport" class="formfld search" type="text" size="10" value="<?= $filterfieldsarray['srcport'] ?>" /></div>
|
190
|
</td>
|
191
|
<td>
|
192
|
<div align="center"><?=gettext("Protocol");?></div>
|
193
|
<div align="center"><input id="filterlogentries_protocol" name="filterlogentries_protocol" class="formfld search" type="text" size="5" value="<?= $filterfieldsarray['proto'] ?>" /></div>
|
194
|
</td>
|
195
|
<td>
|
196
|
<div align="center" style="vertical-align:top;"><?=gettext("Quantity");?></div>
|
197
|
<div align="center" style="vertical-align:top;"><input id="filterlogentries_qty" name="filterlogentries_qty" class="" type="text" size="6" value="<?= $filterlogentries_qty ?>" /></div>
|
198
|
</td>
|
199
|
</tr>
|
200
|
<tr>
|
201
|
<td valign="top">
|
202
|
<div align="center"><?=gettext("Interface");?></div>
|
203
|
<div align="center"><input id="filterlogentries_interfaces" name="filterlogentries_interfaces" class="formfld search" type="text" size="12" value="<?= $filterfieldsarray['interface'] ?>" /></div>
|
204
|
</td>
|
205
|
<td valign="top">
|
206
|
<div align="center"><?=gettext("Destination IP Address");?></div>
|
207
|
<div align="center"><input id="filterlogentries_destinationipaddress" name="filterlogentries_destinationipaddress" class="formfld search" type="text" size="35" value="<?= $filterfieldsarray['dstip'] ?>" /></div>
|
208
|
</td>
|
209
|
<td valign="top">
|
210
|
<div align="center"><?=gettext("Destination Port");?></div>
|
211
|
<div align="center"><input id="filterlogentries_destinationport" name="filterlogentries_destinationport" class="formfld search" type="text" size="10" value="<?= $filterfieldsarray['dstport'] ?>" /></div>
|
212
|
</td>
|
213
|
<td valign="top">
|
214
|
<div align="center"><?=gettext("Protocol Flags");?></div>
|
215
|
<div align="center"><input id="filterlogentries_protocolflags" name="filterlogentries_protocolflags" class="formfld search" type="text" size="5" value="<?= $filterfieldsarray['tcpflags'] ?>" /></div>
|
216
|
</td>
|
217
|
<td valign="bottom">
|
218
|
<div align="center"><input id="filterlogentries_submit" name="filterlogentries_submit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" /></div>
|
219
|
</td>
|
220
|
</tr>
|
221
|
<tr>
|
222
|
<td></td>
|
223
|
<td colspan="5">
|
224
|
<?printf(gettext('Matches %1$s regular expression%2$s.'), '<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">', '</a>');?>
|
225
|
<?=gettext("Precede with exclamation (!) as first character to exclude match.");?>
|
226
|
</td>
|
227
|
</tr>
|
228
|
</table>
|
229
|
</form>
|
230
|
</div>
|
231
|
<div id="filterform_show" class="widgetconfigdiv" style="<?=(!isset($config['syslog']['rawfilter']))?"display:none":""?>">
|
232
|
<form id="filterform" name="filterform" action="diag_logs_filter.php" method="post">
|
233
|
<table width="0%" border="0" cellpadding="0" cellspacing="0" summary="firewall log">
|
234
|
<tr>
|
235
|
<td>
|
236
|
<div align="center" style="vertical-align:top;"><?=gettext("Interface");?></div>
|
237
|
<div align="center" style="vertical-align:top;">
|
238
|
<select name="interface" onchange="dst_change(this.value,iface_old,document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
|
239
|
<option value="" <?=$interfacefilter?"":"selected=\"selected\""?>>*Any interface</option>
|
240
|
<?php
|
241
|
$iflist = get_configured_interface_with_descr(false, true);
|
242
|
//$iflist = get_interface_list();
|
243
|
// Allow extending of the firewall edit interfaces
|
244
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
|
245
|
foreach ($iflist as $if => $ifdesc)
|
246
|
$interfaces[$if] = $ifdesc;
|
247
|
|
248
|
if ($config['l2tp']['mode'] == "server")
|
249
|
$interfaces['l2tp'] = "L2TP VPN";
|
250
|
|
251
|
if ($config['pptpd']['mode'] == "server")
|
252
|
$interfaces['pptp'] = "PPTP VPN";
|
253
|
|
254
|
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
|
255
|
$interfaces['pppoe'] = "PPPoE Server";
|
256
|
|
257
|
/* add ipsec interfaces */
|
258
|
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
|
259
|
$interfaces["enc0"] = "IPsec";
|
260
|
|
261
|
/* add openvpn/tun interfaces */
|
262
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
|
263
|
$interfaces["openvpn"] = "OpenVPN";
|
264
|
|
265
|
foreach ($interfaces as $iface => $ifacename): ?>
|
266
|
<option value="<?=$iface;?>" <?=($iface==$interfacefilter)?"selected=\"selected\"":"";?>><?=htmlspecialchars($ifacename);?></option>
|
267
|
<?php endforeach; ?>
|
268
|
</select>
|
269
|
</div>
|
270
|
</td>
|
271
|
<td>
|
272
|
<div align="center" style="vertical-align:top;"><?=gettext("Filter expression");?></div>
|
273
|
<div align="center" style="vertical-align:top;"><input id="filtertext" name="filtertext" class="formfld search" style="vertical-align:top;" type="text" size="35" value="<?=$filtertext?>" /></div>
|
274
|
</td>
|
275
|
<td>
|
276
|
<div align="center" style="vertical-align:top;"><?=gettext("Quantity");?></div>
|
277
|
<div align="center" style="vertical-align:top;"><input id="filterlogentries_qty" name="filterlogentries_qty" class="" style="vertical-align:top;" type="text" size="6" value="<?= $filterlogentries_qty ?>" /></div>
|
278
|
</td>
|
279
|
<td>
|
280
|
<div align="center" style="vertical-align:top;"> </div>
|
281
|
<div align="center" style="vertical-align:top;"><input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" style="vertical-align:top;" value="<?=gettext("Filter");?>" /></div>
|
282
|
</td>
|
283
|
</tr>
|
284
|
<tr>
|
285
|
<td></td>
|
286
|
<td colspan="2">
|
287
|
<?printf(gettext('Matches %1$s regular expression%2$s.'), '<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">', '</a>');?>
|
288
|
</td>
|
289
|
</tr>
|
290
|
</table>
|
291
|
</form>
|
292
|
</div>
|
293
|
<div style="float: right; vertical-align:middle">
|
294
|
<br />
|
295
|
<?php if (!isset($config['syslog']['rawfilter']) && (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2")):?>
|
296
|
<a href="#" onclick="toggleListDescriptions()">Show/hide rule descriptions</a>
|
297
|
<?php endif;?>
|
298
|
</div>
|
299
|
</td>
|
300
|
</tr>
|
301
|
<?php if (!isset($config['syslog']['rawfilter'])):
|
302
|
$iflist = get_configured_interface_with_descr(false, true);
|
303
|
if ($iflist[$interfacefilter])
|
304
|
$interfacefilter = $iflist[$interfacefilter];
|
305
|
if ($filterlogentries_submit)
|
306
|
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
|
307
|
else
|
308
|
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
|
309
|
?>
|
310
|
<tr>
|
311
|
<td colspan="<?=$config['syslog']['filterdescriptions']==="1"?7:6?>" class="listtopic">
|
312
|
<?php if ( (!$filtertext) && (!$filterfieldsarray) )
|
313
|
printf(gettext("Last %s firewall log entries."),count($filterlog));
|
314
|
else
|
315
|
echo count($filterlog). ' ' . gettext("matched log entries.");
|
316
|
printf(gettext("Max(%s)"),$nentries);?>
|
317
|
</td>
|
318
|
</tr>
|
319
|
<tr class="sortableHeaderRowIdentifier">
|
320
|
<td width="10%" class="listhdrr"><?=gettext("Act");?></td>
|
321
|
<td width="10%" class="listhdrr"><?=gettext("Time");?></td>
|
322
|
<td width="15%" class="listhdrr"><?=gettext("If");?></td>
|
323
|
<?php if ($config['syslog']['filterdescriptions'] === "1"):?>
|
324
|
<td width="10%" class="listhdrr"><?=gettext("Rule");?></td>
|
325
|
<?php endif;?>
|
326
|
<td width="25%" class="listhdrr"><?=gettext("Source");?></td>
|
327
|
<td width="25%" class="listhdrr"><?=gettext("Destination");?></td>
|
328
|
<td width="15%" class="listhdrr"><?=gettext("Proto");?></td>
|
329
|
</tr>
|
330
|
<?php
|
331
|
if ($config['syslog']['filterdescriptions'])
|
332
|
buffer_rules_load();
|
333
|
$rowIndex = 0;
|
334
|
foreach ($filterlog as $filterent):
|
335
|
$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
|
336
|
$rowIndex++;?>
|
337
|
<tr class="<?=$evenRowClass?>">
|
338
|
<td class="listMRlr nowrap" align="center" sorttable_customkey="<?=$filterent['act']?>">
|
339
|
<center>
|
340
|
<a onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);">
|
341
|
<img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="middle" alt="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" />
|
342
|
<?php if ($filterent['count']) echo $filterent['count'];?></a></center></td>
|
343
|
<td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['time']);?></td>
|
344
|
<td class="listMRr nowrap">
|
345
|
<?php if ($filterent['direction'] == "out"): ?>
|
346
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/out.gif" alt="Direction=OUT" title="Direction=OUT"/>
|
347
|
<?php endif; ?>
|
348
|
<?php echo htmlspecialchars($filterent['interface']);?></td>
|
349
|
<?php
|
350
|
if ($config['syslog']['filterdescriptions'] === "1")
|
351
|
echo("<td class=\"listMRr nowrap\">".find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])."</td>");
|
352
|
|
353
|
$int = strtolower($filterent['interface']);
|
354
|
$proto = strtolower($filterent['proto']);
|
355
|
if($filterent['version'] == '6') {
|
356
|
$ipproto = "inet6";
|
357
|
$filterent['srcip'] = "[{$filterent['srcip']}]";
|
358
|
$filterent['dstip'] = "[{$filterent['dstip']}]";
|
359
|
} else {
|
360
|
$ipproto = "inet";
|
361
|
}
|
362
|
|
363
|
$srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
|
364
|
$src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
|
365
|
$dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
|
366
|
$dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
|
367
|
?>
|
368
|
<td class="listMRr nowrap">
|
369
|
<img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['srcip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $src_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
|
370
|
<a href="easyrule.php?<?php echo "action=block&int={$int}&src={$filterent['srcip']}&ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Add to Block List");?>" onclick="return confirm('<?=gettext("Do you really want to add this BLOCK rule?")."\n\n".gettext("Easy Rule is still experimental.")."\n".gettext("Continue at risk of your own peril.")."\n".gettext("Backups are also nice.")?>')">
|
371
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_block_add.gif" alt="Icon Easy Rule: Add to Block List" /></a>
|
372
|
<?php echo $srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>';?>
|
373
|
</td>
|
374
|
<td class="listMRr nowrap">
|
375
|
<img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['dstip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $dst_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
|
376
|
<a href="easyrule.php?<?php echo "action=pass&int={$int}&proto={$proto}&src={$filterent['srcip']}&dst={$filterent['dstip']}&dstport={$filterent['dstport']}&ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Pass this traffic");?>" onclick="return confirm('<?=gettext("Do you really want to add this PASS rule?")."\n\n".gettext("Easy Rule is still experimental.")."\n".gettext("Continue at risk of your own peril.")."\n".gettext("Backups are also nice.");?>')">
|
377
|
<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_pass_add.gif" alt="Icon Easy Rule: Pass this traffic" /></a>
|
378
|
<?php echo $dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>';?>
|
379
|
</td>
|
380
|
<?php
|
381
|
if ($filterent['proto'] == "TCP")
|
382
|
$filterent['proto'] .= ":{$filterent['tcpflags']}";
|
383
|
?>
|
384
|
<td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
|
385
|
</tr>
|
386
|
<?php if (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2"):?>
|
387
|
<tr class="<?=$evenRowClass?>">
|
388
|
<td colspan="2" class="listMRDescriptionL listMRlr" />
|
389
|
<td colspan="4" class="listMRDescriptionR listMRr nowrap"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act']);?></td>
|
390
|
</tr>
|
391
|
<?php endif;
|
392
|
endforeach;
|
393
|
buffer_rules_clear(); ?>
|
394
|
<?php else: ?>
|
395
|
<tr>
|
396
|
<td colspan="2" class="listtopic">
|
397
|
<?php printf(gettext("Last %s firewall log entries"),$nentries);?></td>
|
398
|
</tr>
|
399
|
<?php
|
400
|
if($filtertext)
|
401
|
dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
|
402
|
else
|
403
|
dump_clog($filter_logfile, $nentries);
|
404
|
?>
|
405
|
<?php endif; ?>
|
406
|
<tr>
|
407
|
<td align="left" valign="top" colspan="3">
|
408
|
<form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
|
409
|
<input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
|
410
|
</form>
|
411
|
</td>
|
412
|
</tr>
|
413
|
</table>
|
414
|
</div>
|
415
|
</td>
|
416
|
</tr>
|
417
|
</table>
|
418
|
|
419
|
<p><span class="vexpl"><a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F">TCP Flags</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, W - CWR</span></p>
|
420
|
|
421
|
<?php include("fend.inc"); ?>
|
422
|
|
423
|
<!-- AJAXY STUFF -->
|
424
|
<script type="text/javascript">
|
425
|
//<![CDATA[
|
426
|
function resolve_with_ajax(ip_to_resolve) {
|
427
|
var url = "/diag_logs_filter.php";
|
428
|
|
429
|
jQuery.ajax(
|
430
|
url,
|
431
|
{
|
432
|
type: 'post',
|
433
|
dataType: 'json',
|
434
|
data: {
|
435
|
resolve: ip_to_resolve,
|
436
|
},
|
437
|
complete: resolve_ip_callback
|
438
|
});
|
439
|
|
440
|
}
|
441
|
|
442
|
function resolve_ip_callback(transport) {
|
443
|
var response = jQuery.parseJSON(transport.responseText);
|
444
|
var resolve_class = htmlspecialchars(response.resolve_ip.replace(/[.:]/g, '-'));
|
445
|
var resolve_text = '<small><br />' + htmlspecialchars(response.resolve_text) + '<\/small>';
|
446
|
|
447
|
jQuery('span.RESOLVE-' + resolve_class).html(resolve_text);
|
448
|
jQuery('img.ICON-' + resolve_class).removeAttr('title');
|
449
|
jQuery('img.ICON-' + resolve_class).removeAttr('alt');
|
450
|
jQuery('img.ICON-' + resolve_class).attr('src', '/themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif');
|
451
|
jQuery('img.ICON-' + resolve_class).prop('onclick', null);
|
452
|
// jQuery cautions that "removeAttr('onclick')" fails in some versions of IE
|
453
|
}
|
454
|
|
455
|
// From http://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities
|
456
|
function htmlspecialchars(str) {
|
457
|
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
458
|
}
|
459
|
//]]>
|
460
|
</script>
|
461
|
|
462
|
</body>
|
463
|
</html>
|