1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
firewall_rules.php
|
5
|
part of pfSense (https://www.pfsense.org)
|
6
|
Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
|
7
|
Copyright (C) 2013-2014 Electric Sheep Fencing, LP
|
8
|
|
9
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
10
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
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
|
pfSense_MODULE: filter
|
36
|
*/
|
37
|
|
38
|
##|+PRIV
|
39
|
##|*IDENT=page-firewall-rules
|
40
|
##|*NAME=Firewall: Rules page
|
41
|
##|*DESCR=Allow access to the 'Firewall: Rules' page.
|
42
|
##|*MATCH=firewall_rules.php*
|
43
|
##|-PRIV
|
44
|
|
45
|
require("guiconfig.inc");
|
46
|
require_once("functions.inc");
|
47
|
require_once("filter.inc");
|
48
|
require_once("shaper.inc");
|
49
|
|
50
|
$pgtitle = array(gettext("Firewall"),gettext("Rules"));
|
51
|
$shortcut_section = "firewall";
|
52
|
|
53
|
function delete_nat_association($id) {
|
54
|
global $config;
|
55
|
|
56
|
if (!$id || !is_array($config['nat']['rule']))
|
57
|
return;
|
58
|
|
59
|
$a_nat = &$config['nat']['rule'];
|
60
|
|
61
|
foreach ($a_nat as &$natent)
|
62
|
if ($natent['associated-rule-id'] == $id)
|
63
|
$natent['associated-rule-id'] = '';
|
64
|
}
|
65
|
|
66
|
if (!is_array($config['filter']['rule'])) {
|
67
|
$config['filter']['rule'] = array();
|
68
|
}
|
69
|
filter_rules_sort();
|
70
|
$a_filter = &$config['filter']['rule'];
|
71
|
|
72
|
$if = $_GET['if'];
|
73
|
if ($_POST['if'])
|
74
|
$if = $_POST['if'];
|
75
|
|
76
|
$ifdescs = get_configured_interface_with_descr();
|
77
|
|
78
|
// Drag and drop reordering
|
79
|
if($_REQUEST['dragdroporder']) {
|
80
|
// First create a new ruleset array and tmp arrays
|
81
|
$a_filter_before = array();
|
82
|
$a_filter_order = array();
|
83
|
$a_filter_order_tmp = array();
|
84
|
$a_filter_after = array();
|
85
|
$found = false;
|
86
|
$drag_order = $_REQUEST['dragtable'];
|
87
|
// Next traverse through rules building a new order for interface
|
88
|
for ($i = 0; isset($a_filter[$i]); $i++) {
|
89
|
if(( $_REQUEST['if'] == "FloatingRules" && isset($a_filter[$i]['floating']) ) || ( $a_filter[$i]['interface'] == $_REQUEST['if'] && !isset($a_filter[$i]['floating']) )) {
|
90
|
$a_filter_order_tmp[] = $a_filter[$i];
|
91
|
$found = true;
|
92
|
} else if (!$found)
|
93
|
$a_filter_before[] = $a_filter[$i];
|
94
|
else
|
95
|
$a_filter_after[] = $a_filter[$i];
|
96
|
}
|
97
|
// Reorder rules with the posted order
|
98
|
for ($i = 0; $i<count($drag_order); $i++)
|
99
|
$a_filter_order[] = $a_filter_order_tmp[$drag_order[$i]];
|
100
|
// In case $drag_order didn't account for some rules, make sure we don't lose them
|
101
|
if(count($a_filter_order) < count($a_filter_order_tmp)) {
|
102
|
for ($i = 0; $i<count($a_filter_order_tmp); $i++)
|
103
|
if(!in_array($i, $drag_order))
|
104
|
$a_filter_order[] = $a_filter_order_tmp[$i];
|
105
|
}
|
106
|
// Overwrite filter rules with newly created items
|
107
|
$config['filter']['rule'] = array_merge($a_filter_before, $a_filter_order, $a_filter_after);
|
108
|
// Write configuration
|
109
|
$config = write_config(gettext("Drag and drop firewall rules ordering update."));
|
110
|
// Redirect back to page
|
111
|
mark_subsystem_dirty('filter');
|
112
|
$undo = array();
|
113
|
foreach($_REQUEST['dragtable'] as $dt)
|
114
|
$undo[] = "";
|
115
|
$counter = 0;
|
116
|
foreach($_REQUEST['dragtable'] as $dt) {
|
117
|
$undo[$dt] = $counter;
|
118
|
$counter++;
|
119
|
}
|
120
|
foreach($undo as $dt)
|
121
|
$undotxt .= "&dragtable[]={$dt}";
|
122
|
header("Location: firewall_rules.php?if=" . $_REQUEST['if'] . "&undodrag=true" . $undotxt);
|
123
|
exit;
|
124
|
}
|
125
|
|
126
|
/* add group interfaces */
|
127
|
if (is_array($config['ifgroups']['ifgroupentry']))
|
128
|
foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
|
129
|
if (have_ruleint_access($ifgen['ifname']))
|
130
|
$iflist[$ifgen['ifname']] = $ifgen['ifname'];
|
131
|
|
132
|
foreach ($ifdescs as $ifent => $ifdesc)
|
133
|
if(have_ruleint_access($ifent))
|
134
|
$iflist[$ifent] = $ifdesc;
|
135
|
|
136
|
if ($config['l2tp']['mode'] == "server")
|
137
|
if(have_ruleint_access("l2tp"))
|
138
|
$iflist['l2tp'] = "L2TP VPN";
|
139
|
|
140
|
if ($config['pptpd']['mode'] == "server")
|
141
|
if(have_ruleint_access("pptp"))
|
142
|
$iflist['pptp'] = "PPTP VPN";
|
143
|
|
144
|
if (is_array($config['pppoes']['pppoe'])) {
|
145
|
foreach ($config['pppoes']['pppoe'] as $pppoes)
|
146
|
if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe"))
|
147
|
$iflist['pppoe'] = "PPPoE Server";
|
148
|
}
|
149
|
|
150
|
/* add ipsec interfaces */
|
151
|
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
|
152
|
if(have_ruleint_access("enc0"))
|
153
|
$iflist["enc0"] = "IPsec";
|
154
|
|
155
|
/* add openvpn/tun interfaces */
|
156
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
|
157
|
$iflist["openvpn"] = "OpenVPN";
|
158
|
|
159
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/interfaces_override");
|
160
|
|
161
|
if (!$if || !isset($iflist[$if])) {
|
162
|
if ("any" == $if)
|
163
|
$if = "FloatingRules";
|
164
|
else if ("FloatingRules" != $if) {
|
165
|
if (isset($iflist['wan']))
|
166
|
$if = "wan";
|
167
|
else
|
168
|
$if = "FloatingRules";
|
169
|
}
|
170
|
}
|
171
|
|
172
|
if ($_POST) {
|
173
|
|
174
|
$pconfig = $_POST;
|
175
|
|
176
|
if ($_POST['apply']) {
|
177
|
$retval = 0;
|
178
|
$retval = filter_configure();
|
179
|
|
180
|
clear_subsystem_dirty('filter');
|
181
|
|
182
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/apply");
|
183
|
|
184
|
$savemsg = sprintf(gettext("The settings have been applied. The firewall rules are now reloading in the background.<br />You can also %s monitor %s the reload progress"),"<a href='status_filter_reload.php'>","</a>");
|
185
|
}
|
186
|
}
|
187
|
|
188
|
if ($_GET['act'] == "del") {
|
189
|
if ($a_filter[$_GET['id']]) {
|
190
|
if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
|
191
|
delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
|
192
|
}
|
193
|
unset($a_filter[$_GET['id']]);
|
194
|
if (write_config())
|
195
|
mark_subsystem_dirty('filter');
|
196
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
197
|
exit;
|
198
|
}
|
199
|
}
|
200
|
|
201
|
// Handle save msg if defined
|
202
|
if($_REQUEST['savemsg'])
|
203
|
$savemsg = htmlentities($_REQUEST['savemsg']);
|
204
|
|
205
|
if (isset($_POST['del_x'])) {
|
206
|
/* delete selected rules */
|
207
|
if (is_array($_POST['rule']) && count($_POST['rule'])) {
|
208
|
foreach ($_POST['rule'] as $rulei) {
|
209
|
delete_nat_association($a_filter[$rulei]['associated-rule-id']);
|
210
|
unset($a_filter[$rulei]);
|
211
|
}
|
212
|
if (write_config())
|
213
|
mark_subsystem_dirty('filter');
|
214
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
215
|
exit;
|
216
|
}
|
217
|
} else if ($_GET['act'] == "toggle") {
|
218
|
if ($a_filter[$_GET['id']]) {
|
219
|
if(isset($a_filter[$_GET['id']]['disabled']))
|
220
|
unset($a_filter[$_GET['id']]['disabled']);
|
221
|
else
|
222
|
$a_filter[$_GET['id']]['disabled'] = true;
|
223
|
if (write_config())
|
224
|
mark_subsystem_dirty('filter');
|
225
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
226
|
exit;
|
227
|
}
|
228
|
} else {
|
229
|
/* yuck - IE won't send value attributes for image buttons, while Mozilla does -
|
230
|
so we use .x/.y to fine move button clicks instead... */
|
231
|
unset($movebtn);
|
232
|
foreach ($_POST as $pn => $pd) {
|
233
|
if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
|
234
|
$movebtn = $matches[1];
|
235
|
break;
|
236
|
}
|
237
|
}
|
238
|
/* move selected rules before this rule */
|
239
|
if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
|
240
|
$a_filter_new = array();
|
241
|
|
242
|
/* copy all rules < $movebtn and not selected */
|
243
|
for ($i = 0; $i < $movebtn; $i++) {
|
244
|
if (!in_array($i, $_POST['rule']))
|
245
|
$a_filter_new[] = $a_filter[$i];
|
246
|
}
|
247
|
|
248
|
/* copy all selected rules */
|
249
|
for ($i = 0; $i < count($a_filter); $i++) {
|
250
|
if ($i == $movebtn)
|
251
|
continue;
|
252
|
if (in_array($i, $_POST['rule']))
|
253
|
$a_filter_new[] = $a_filter[$i];
|
254
|
}
|
255
|
|
256
|
/* copy $movebtn rule */
|
257
|
if ($movebtn < count($a_filter))
|
258
|
$a_filter_new[] = $a_filter[$movebtn];
|
259
|
|
260
|
/* copy all rules > $movebtn and not selected */
|
261
|
for ($i = $movebtn+1; $i < count($a_filter); $i++) {
|
262
|
if (!in_array($i, $_POST['rule']))
|
263
|
$a_filter_new[] = $a_filter[$i];
|
264
|
}
|
265
|
|
266
|
$a_filter = $a_filter_new;
|
267
|
if (write_config())
|
268
|
mark_subsystem_dirty('filter');
|
269
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
270
|
exit;
|
271
|
}
|
272
|
}
|
273
|
$closehead = false;
|
274
|
|
275
|
include("head.inc");
|
276
|
?>
|
277
|
<link type="text/css" rel="stylesheet" href="/javascript/chosen/chosen.css" />
|
278
|
</head>
|
279
|
|
280
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
281
|
<script src="/javascript/chosen/chosen.jquery.js" type="text/javascript"></script>
|
282
|
<?php include("fbegin.inc"); ?>
|
283
|
<form action="firewall_rules.php" method="post">
|
284
|
|
285
|
<script type="text/javascript" src="/javascript/row_toggle.js"></script>
|
286
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
287
|
<?php if (is_subsystem_dirty('filter')): ?><p>
|
288
|
<?php
|
289
|
if($_REQUEST['undodrag']) {
|
290
|
foreach($_REQUEST['dragtable'] as $dt)
|
291
|
$dragtable .= "&dragtable[]={$dt}";
|
292
|
print_info_box_np_undo(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."), "apply" , gettext("Apply changes") , "firewall_rules.php?if={$_REQUEST['if']}&dragdroporder=true&{$dragtable}");
|
293
|
} else {
|
294
|
print_info_box_np(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."));
|
295
|
}
|
296
|
?>
|
297
|
<br />
|
298
|
<?php endif; ?>
|
299
|
<div id="loading" style="visibity:hidden">
|
300
|
<img src="/themes/<?=$g['theme']?>/images/misc/loader.gif" alt="loader" /> <?php echo gettext("Loading, please wait..."); ?>
|
301
|
<p> </p>
|
302
|
</div>
|
303
|
<?php
|
304
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_table");
|
305
|
?>
|
306
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firewall rules">
|
307
|
<tr><td class="tabnavtbl">
|
308
|
<?php
|
309
|
/* active tabs */
|
310
|
$tab_array = array();
|
311
|
if ("FloatingRules" == $if)
|
312
|
$active = true;
|
313
|
else
|
314
|
$active = false;
|
315
|
$tab_array[] = array(gettext("Floating"), $active, "firewall_rules.php?if=FloatingRules");
|
316
|
$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
|
317
|
if ($ifent == $if)
|
318
|
$active = true;
|
319
|
else
|
320
|
$active = false;
|
321
|
$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
|
322
|
}
|
323
|
display_top_tabs($tab_array);
|
324
|
?>
|
325
|
</td></tr>
|
326
|
<tr><td>
|
327
|
<div id="mainarea">
|
328
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
|
329
|
<?php
|
330
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/before_first_tr");
|
331
|
?>
|
332
|
<tr id="frheader">
|
333
|
<td width="3%" class="list"> </td>
|
334
|
<td width="5%" class="list"> </td>
|
335
|
<td width="3%" class="listhdrr"><?=gettext("ID");?></td>
|
336
|
<?php
|
337
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tablehead");
|
338
|
?>
|
339
|
<td width="6%" class="listhdrr"><?=gettext("Proto");?></td>
|
340
|
<td width="12%" class="listhdrr"><?=gettext("Source");?></td>
|
341
|
<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
|
342
|
<td width="12%" class="listhdrr"><?=gettext("Destination");?></td>
|
343
|
<td width="6%" class="listhdrr"><?=gettext("Port");?></td>
|
344
|
<td width="5%" class="listhdrr"><?=gettext("Gateway");?></td>
|
345
|
<td width="8%" class="listhdrr"><?=gettext("Queue");?></td>
|
346
|
<td width="5%" class="listhdrr"><?=gettext("Schedule");?></td>
|
347
|
<?php
|
348
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_desc_tablehead");
|
349
|
?>
|
350
|
<td width="19%" class="listhdr"><?=gettext("Description");?></td>
|
351
|
<td width="10%" class="list">
|
352
|
<table border="0" cellspacing="0" cellpadding="1" summary="delete selected rules">
|
353
|
<tr>
|
354
|
<?php
|
355
|
$nrules = 0;
|
356
|
for ($i = 0; isset($a_filter[$i]); $i++) {
|
357
|
$filterent = $a_filter[$i];
|
358
|
if ($filterent['interface'] != $if && !isset($filterent['floating']))
|
359
|
continue;
|
360
|
if (isset($filterent['floating']) && "FloatingRules" != $if)
|
361
|
continue;
|
362
|
$nrules++;
|
363
|
}
|
364
|
?>
|
365
|
<td>
|
366
|
<?php if ($nrules == 0): ?>
|
367
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?gettext("delete selected rules"); ?>" border="0" alt="delete" /><?php else: ?>
|
368
|
<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" />
|
369
|
<?php endif; ?>
|
370
|
</td>
|
371
|
<td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&after=-1"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0" alt="add" /></a></td>
|
372
|
</tr>
|
373
|
</table>
|
374
|
</td>
|
375
|
</tr>
|
376
|
<?php // Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1.
|
377
|
if (!isset($config['system']['webgui']['noantilockout']) &&
|
378
|
(((count($config['interfaces']) > 1) && ($if == 'lan'))
|
379
|
|| ((count($config['interfaces']) == 1) && ($if == 'wan')))):
|
380
|
|
381
|
$alports = implode('<br />', filter_get_antilockout_ports(true));
|
382
|
?>
|
383
|
<tr valign="top" id="antilockout">
|
384
|
<td class="list"> </td>
|
385
|
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" border="0" alt="pass" /></td>
|
386
|
<td class="listlr" style="background-color: #E0E0E0"> </td>
|
387
|
<?php
|
388
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_antilockout");
|
389
|
?>
|
390
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
391
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
392
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
393
|
<td class="listr" style="background-color: #E0E0E0"><?=$iflist[$if];?> Address</td>
|
394
|
<td class="listr" style="background-color: #E0E0E0"><?= $alports ?></td>
|
395
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
396
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
397
|
<td class="listr" style="background-color: #E0E0E0"> </td>
|
398
|
<td class="listbg"><?=gettext("Anti-Lockout Rule");?></td>
|
399
|
<td valign="middle" class="list nowrap">
|
400
|
<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
|
401
|
<tr>
|
402
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>" alt="move" /></td>
|
403
|
<td><a href="system_advanced_admin.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0" alt="edit" /></a></td>
|
404
|
</tr>
|
405
|
<tr>
|
406
|
<td align="center" valign="middle"></td>
|
407
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0" alt="add" /></td>
|
408
|
</tr>
|
409
|
</table>
|
410
|
</td>
|
411
|
</tr>
|
412
|
<?php endif; ?>
|
413
|
|
414
|
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
|
415
|
<tr valign="top" id="frrfc1918">
|
416
|
<td class="list"> </td>
|
417
|
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0" alt="block" /></td>
|
418
|
<td class="listlr" style="background-color: #E0E0E0"> </td>
|
419
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
420
|
<td class="listr" style="background-color: #E0E0E0"><?=gettext("RFC 1918 networks");?></td>
|
421
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
422
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
423
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
424
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
425
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
426
|
<td class="listr" style="background-color: #E0E0E0"> </td>
|
427
|
<td class="listbg"><?=gettext("Block private networks");?></td>
|
428
|
<td valign="middle" class="list nowrap">
|
429
|
<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
|
430
|
<tr>
|
431
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>" alt="edit" /></td>
|
432
|
<td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0" alt="edit" /></a></td>
|
433
|
</tr>
|
434
|
<tr>
|
435
|
<td align="center" valign="middle"></td>
|
436
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0" alt="add" /></td>
|
437
|
</tr>
|
438
|
</table>
|
439
|
</td>
|
440
|
</tr>
|
441
|
<?php endif; ?>
|
442
|
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
|
443
|
<tr valign="top" id="frrfc1918">
|
444
|
<td class="list"> </td>
|
445
|
<td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0" alt="block" /></td>
|
446
|
<td class="listlr" style="background-color: #E0E0E0"> </td>
|
447
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
448
|
<td class="listr" style="background-color: #E0E0E0"><?=gettext("Reserved/not assigned by IANA");?></td>
|
449
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
450
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
451
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
452
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
453
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
454
|
<td class="listr" style="background-color: #E0E0E0">*</td>
|
455
|
<td class="listbg"><?=gettext("Block bogon networks");?></td>
|
456
|
<td valign="middle" class="list nowrap">
|
457
|
<table border="0" cellspacing="0" cellpadding="1" summary="move rules before">
|
458
|
<tr>
|
459
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules before this rule");?>" alt="move" /></td>
|
460
|
<td><a href="interfaces.php?if=<?=htmlspecialchars($if)?>#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule");?>" width="17" height="17" border="0" alt=" edit" /></a></td>
|
461
|
</tr>
|
462
|
<tr>
|
463
|
<td align="center" valign="middle"></td>
|
464
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="<?=gettext("add a new rule based on this one");?>" width="17" height="17" border="0" alt="add" /></td>
|
465
|
</tr>
|
466
|
</table>
|
467
|
</td>
|
468
|
</tr>
|
469
|
<?php endif; ?>
|
470
|
<tbody id="dragtable">
|
471
|
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
|
472
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/row_start");
|
473
|
$filterent = $a_filter[$i];
|
474
|
if ($filterent['interface'] != $if && !isset($filterent['floating']))
|
475
|
continue;
|
476
|
if (isset($filterent['floating']) && "FloatingRules" != $if)
|
477
|
continue;
|
478
|
$isadvset = firewall_check_for_advanced_options($filterent);
|
479
|
if($isadvset)
|
480
|
$advanced_set = "<img src=\"./themes/{$g['theme']}/images/icons/icon_advanced.gif\" title=\"" . gettext("advanced settings set") . ": {$isadvset}\" border=\"0\" alt=\"avanced\" />";
|
481
|
else
|
482
|
$advanced_set = "";
|
483
|
?>
|
484
|
<tr valign="top" id="fr<?=$nrules;?>">
|
485
|
<td class="listt">
|
486
|
<input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" />
|
487
|
<?php echo $advanced_set; ?>
|
488
|
</td>
|
489
|
<td class="listt" align="center">
|
490
|
<?php
|
491
|
if ($filterent['type'] == "block")
|
492
|
$iconfn = "block";
|
493
|
else if ($filterent['type'] == "reject")
|
494
|
$iconfn = "reject";
|
495
|
else if ($filterent['type'] == "match")
|
496
|
$iconfn = "match";
|
497
|
else
|
498
|
$iconfn = "pass";
|
499
|
if (isset($filterent['disabled'])) {
|
500
|
$textss = "<span class=\"gray\">";
|
501
|
$textse = "</span>";
|
502
|
$iconfn .= "_d";
|
503
|
} else {
|
504
|
$textss = $textse = "";
|
505
|
}
|
506
|
?>
|
507
|
<a href="?if=<?=htmlspecialchars($if);?>&act=toggle&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="<?=gettext("click to toggle enabled/disabled status");?>" alt="icon" /></a>
|
508
|
<?php
|
509
|
if (isset($filterent['log'])):
|
510
|
$iconfnlog = "log_s";
|
511
|
if (isset($filterent['disabled']))
|
512
|
$iconfnlog .= "_d";
|
513
|
?>
|
514
|
<br /><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0" alt="icon" />
|
515
|
<?php endif; ?>
|
516
|
</td>
|
517
|
<?php
|
518
|
|
519
|
//build Alias popup box
|
520
|
$alias_src_span_begin = "";
|
521
|
$alias_src_port_span_begin = "";
|
522
|
$alias_dst_span_begin = "";
|
523
|
$alias_dst_port_span_begin = "";
|
524
|
|
525
|
$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
|
526
|
|
527
|
$alias_src_span_begin = $alias_popup["src"];
|
528
|
$alias_src_port_span_begin = $alias_popup["srcport"];
|
529
|
$alias_dst_span_begin = $alias_popup["dst"];
|
530
|
$alias_dst_port_span_begin = $alias_popup["dstport"];
|
531
|
|
532
|
$alias_src_span_end = $alias_popup["src_end"];
|
533
|
$alias_src_port_span_end = $alias_popup["srcport_end"];
|
534
|
$alias_dst_span_end = $alias_popup["dst_end"];
|
535
|
$alias_dst_port_span_end = $alias_popup["dstport_end"];
|
536
|
|
537
|
//build Schedule popup box
|
538
|
$a_schedules = &$config['schedules']['schedule'];
|
539
|
$schedule_span_begin = "";
|
540
|
$schedule_span_end = "";
|
541
|
$sched_caption_escaped = "";
|
542
|
$sched_content = "";
|
543
|
$schedstatus = false;
|
544
|
$dayArray = array (gettext('Mon'),gettext('Tues'),gettext('Wed'),gettext('Thur'),gettext('Fri'),gettext('Sat'),gettext('Sun'));
|
545
|
$monthArray = array (gettext('January'),gettext('February'),gettext('March'),gettext('April'),gettext('May'),gettext('June'),gettext('July'),gettext('August'),gettext('September'),gettext('October'),gettext('November'),gettext('December'));
|
546
|
if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])) {
|
547
|
foreach ($a_schedules as $schedule)
|
548
|
{
|
549
|
if ($schedule['name'] == $filterent['sched'] ){
|
550
|
$schedstatus = filter_get_time_based_rule_status($schedule);
|
551
|
|
552
|
foreach($schedule['timerange'] as $timerange) {
|
553
|
$tempFriendlyTime = "";
|
554
|
$tempID = "";
|
555
|
$firstprint = false;
|
556
|
if ($timerange){
|
557
|
$dayFriendly = "";
|
558
|
$tempFriendlyTime = "";
|
559
|
|
560
|
//get hours
|
561
|
$temptimerange = $timerange['hour'];
|
562
|
$temptimeseparator = strrpos($temptimerange, "-");
|
563
|
|
564
|
$starttime = substr ($temptimerange, 0, $temptimeseparator);
|
565
|
$stoptime = substr ($temptimerange, $temptimeseparator+1);
|
566
|
|
567
|
if ($timerange['month']){
|
568
|
$tempmontharray = explode(",", $timerange['month']);
|
569
|
$tempdayarray = explode(",",$timerange['day']);
|
570
|
$arraycounter = 0;
|
571
|
$firstDayFound = false;
|
572
|
$firstPrint = false;
|
573
|
foreach ($tempmontharray as $monthtmp){
|
574
|
$month = $tempmontharray[$arraycounter];
|
575
|
$day = $tempdayarray[$arraycounter];
|
576
|
|
577
|
if (!$firstDayFound)
|
578
|
{
|
579
|
$firstDay = $day;
|
580
|
$firstmonth = $month;
|
581
|
$firstDayFound = true;
|
582
|
}
|
583
|
|
584
|
$currentDay = $day;
|
585
|
$nextDay = $tempdayarray[$arraycounter+1];
|
586
|
$currentDay++;
|
587
|
if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
|
588
|
if ($firstPrint)
|
589
|
$dayFriendly .= ", ";
|
590
|
$currentDay--;
|
591
|
if ($currentDay != $firstDay)
|
592
|
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
|
593
|
else
|
594
|
$dayFriendly .= $monthArray[$month-1] . " " . $day;
|
595
|
$firstDayFound = false;
|
596
|
$firstPrint = true;
|
597
|
}
|
598
|
$arraycounter++;
|
599
|
}
|
600
|
}
|
601
|
else
|
602
|
{
|
603
|
$tempdayFriendly = $timerange['position'];
|
604
|
$firstDayFound = false;
|
605
|
$tempFriendlyDayArray = explode(",", $tempdayFriendly);
|
606
|
$currentDay = "";
|
607
|
$firstDay = "";
|
608
|
$nextDay = "";
|
609
|
$counter = 0;
|
610
|
foreach ($tempFriendlyDayArray as $day){
|
611
|
if ($day != ""){
|
612
|
if (!$firstDayFound)
|
613
|
{
|
614
|
$firstDay = $tempFriendlyDayArray[$counter];
|
615
|
$firstDayFound = true;
|
616
|
}
|
617
|
$currentDay =$tempFriendlyDayArray[$counter];
|
618
|
//get next day
|
619
|
$nextDay = $tempFriendlyDayArray[$counter+1];
|
620
|
$currentDay++;
|
621
|
if ($currentDay != $nextDay){
|
622
|
if ($firstprint)
|
623
|
$dayFriendly .= ", ";
|
624
|
$currentDay--;
|
625
|
if ($currentDay != $firstDay)
|
626
|
$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
|
627
|
else
|
628
|
$dayFriendly .= $dayArray[$firstDay-1];
|
629
|
$firstDayFound = false;
|
630
|
$firstprint = true;
|
631
|
}
|
632
|
$counter++;
|
633
|
}
|
634
|
}
|
635
|
}
|
636
|
$timeFriendly = $starttime . " - " . $stoptime;
|
637
|
$description = $timerange['rangedescr'];
|
638
|
$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br />";
|
639
|
}
|
640
|
}
|
641
|
$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
|
642
|
$schedule_span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>{$sched_caption_escaped}</h1><p>{$sched_content}</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><u>";
|
643
|
$schedule_span_end = "</u></span>";
|
644
|
}
|
645
|
}
|
646
|
}
|
647
|
$printicon = false;
|
648
|
$alttext = "";
|
649
|
$image = "";
|
650
|
if (!isset($filterent['disabled'])) {
|
651
|
if ($schedstatus) {
|
652
|
if ($iconfn == "block" || $iconfn == "reject") {
|
653
|
$image = "icon_block";
|
654
|
$alttext = gettext("Traffic matching this rule is currently being denied");
|
655
|
} else {
|
656
|
$image = "icon_pass";
|
657
|
$alttext = gettext("Traffic matching this rule is currently being allowed");
|
658
|
}
|
659
|
$printicon = true;
|
660
|
} else if ($filterent['sched']) {
|
661
|
if ($iconfn == "block" || $iconfn == "reject")
|
662
|
$image = "icon_block_d";
|
663
|
else
|
664
|
$image = "icon_block";
|
665
|
$alttext = gettext("This rule is not currently active because its period has expired");
|
666
|
$printicon = true;
|
667
|
}
|
668
|
}
|
669
|
?>
|
670
|
<td class="listlr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
671
|
<?=$textss;?><?php if (isset($filterent['id'])) echo $filterent['id']." "; else echo " "; ?><?=$textse;?>
|
672
|
</td>
|
673
|
<?php
|
674
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr");
|
675
|
?>
|
676
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
677
|
<?=$textss;?>
|
678
|
<?php
|
679
|
if (isset($filterent['ipprotocol'])) {
|
680
|
switch($filterent['ipprotocol']) {
|
681
|
case "inet":
|
682
|
echo "IPv4 ";
|
683
|
break;
|
684
|
case "inet6":
|
685
|
echo "IPv6 ";
|
686
|
break;
|
687
|
case "inet46":
|
688
|
echo "IPv4+6 ";
|
689
|
break;
|
690
|
}
|
691
|
} else {
|
692
|
echo "IPv4 ";
|
693
|
}
|
694
|
if (isset($filterent['protocol'])) {
|
695
|
echo strtoupper($filterent['protocol']);
|
696
|
if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
|
697
|
echo ' <span style="cursor: help;" title="ICMP type: ' .
|
698
|
( $filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']] ) .
|
699
|
'"><u>';
|
700
|
echo $filterent['icmptype'];
|
701
|
echo '</u></span>';
|
702
|
}
|
703
|
} else echo "*";
|
704
|
?>
|
705
|
<?=$textse;?>
|
706
|
</td>
|
707
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
708
|
<?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
|
709
|
</td>
|
710
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
711
|
<?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?>
|
712
|
</td>
|
713
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
714
|
<?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
|
715
|
</td>
|
716
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
717
|
<?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
|
718
|
</td>
|
719
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
720
|
<?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
|
721
|
</td>
|
722
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
723
|
<?=$textss;?>
|
724
|
<?php
|
725
|
if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
|
726
|
$desc = $filterent['ackqueue'] ;
|
727
|
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>";
|
728
|
$desc = $filterent['defaultqueue'];
|
729
|
echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
|
730
|
} else if (isset($filterent['defaultqueue'])) {
|
731
|
$desc = $filterent['defaultqueue'];
|
732
|
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
|
733
|
} else
|
734
|
echo gettext("none");
|
735
|
?>
|
736
|
<?=$textse;?>
|
737
|
</td>
|
738
|
<td class="listr" onclick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black">
|
739
|
<?php if ($printicon) { ?><img src="./themes/<?= $g['theme']; ?>/images/icons/<?php echo $image; ?>.gif" title="<?php echo $alttext;?>" border="0" alt="icon" /><?php } ?><?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?> <?php echo $schedule_span_end; ?><?=$textse;?>
|
740
|
</font></td>
|
741
|
<?php
|
742
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_descr_tr");
|
743
|
?>
|
744
|
<td class="listbg descr" onclick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
|
745
|
<?=$textss;?><?=htmlspecialchars($filterent['descr']);?> <?=$textse;?>
|
746
|
</td>
|
747
|
<td valign="middle" class="list nowrap">
|
748
|
<table border="0" cellspacing="0" cellpadding="1" summary="move before">
|
749
|
<tr>
|
750
|
<td><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17" title="<?=gettext("move selected rules before this rule"); ?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" /></td>
|
751
|
<td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit rule"); ?>" width="17" height="17" border="0" alt="edit" /></a></td>
|
752
|
</tr>
|
753
|
<tr>
|
754
|
<td align="center" valign="middle"><a href="firewall_rules.php?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule"); ?>" onclick="return confirm('Do you really want to delete this rule?')" alt="delete" /></a></td>
|
755
|
<td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new rule based on this one"); ?>" width="17" height="17" border="0" alt="add" /></a></td>
|
756
|
</tr>
|
757
|
</table>
|
758
|
</td>
|
759
|
</tr>
|
760
|
<?php $nrules++; endfor; ?>
|
761
|
<tr><td></td></tr></tbody>
|
762
|
<?php if ($nrules == 0): ?>
|
763
|
<tr>
|
764
|
<td class="listt"></td>
|
765
|
<td class="listt"></td>
|
766
|
<td class="listlr" colspan="10" align="center" valign="middle">
|
767
|
<span class="gray">
|
768
|
<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
|
769
|
<?=gettext("No floating rules are currently defined."); ?><br /><br />
|
770
|
<?php else: ?>
|
771
|
<?=gettext("No rules are currently defined for this interface"); ?><br />
|
772
|
<?=gettext("All incoming connections on this interface will be blocked until you add pass rules."); ?><br /><br />
|
773
|
<?php endif; ?>
|
774
|
<?=gettext("Click the"); ?> <a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" border="0" width="17" height="17" align="middle" alt="add" /></a><?=gettext(" button to add a new rule.");?></span>
|
775
|
</td>
|
776
|
</tr>
|
777
|
<?php endif; ?>
|
778
|
<tr id="fr<?=$nrules;?>">
|
779
|
<td class="list"></td>
|
780
|
<td class="list"></td>
|
781
|
<?php
|
782
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_id_tr_belowtable");
|
783
|
?>
|
784
|
<td class="list"> </td>
|
785
|
<td class="list"> </td>
|
786
|
<td class="list"> </td>
|
787
|
<td class="list"> </td>
|
788
|
<td class="list"> </td>
|
789
|
<td class="list"> </td>
|
790
|
<td class="list"> </td>
|
791
|
<td class="list"> </td>
|
792
|
<td class="list"> </td>
|
793
|
<td class="list"> </td>
|
794
|
<td class="list">
|
795
|
<table border="0" cellspacing="0" cellpadding="1" summary="move rules">
|
796
|
<tr>
|
797
|
<td>
|
798
|
<?php if ($nrules == 0): ?><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected rules to end");?>" border="0" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17" title="<?=gettext("move selected rules to end");?>" onmouseover="fr_insline(<?=$nrules;?>, true)" onmouseout="fr_insline(<?=$nrules;?>, false)" /><?php endif; ?></td>
|
799
|
<td></td>
|
800
|
</tr>
|
801
|
<tr>
|
802
|
<td>
|
803
|
<?php if ($nrules == 0): ?>
|
804
|
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0" alt="delete" /><?php else: ?>
|
805
|
<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected rules");?>" onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" />
|
806
|
<?php endif; ?>
|
807
|
</td>
|
808
|
<td><a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add new rule");?>" width="17" height="17" border="0" alt="add" /></a></td>
|
809
|
</tr>
|
810
|
</table>
|
811
|
</td>
|
812
|
</tr>
|
813
|
</table>
|
814
|
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="icons">
|
815
|
<tr>
|
816
|
<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11" alt="pass" /></td>
|
817
|
<td width="100"><?=gettext("pass");?></td>
|
818
|
<td width="14"></td>
|
819
|
<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_match.gif" width="11" height="11" alt="match" /></td>
|
820
|
<td width="100"><?=gettext("match");?></td>
|
821
|
<td width="14"></td>
|
822
|
<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" alt="block" /></td>
|
823
|
<td width="100"><?=gettext("block");?></td>
|
824
|
<td width="14"></td>
|
825
|
<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11" alt="reject" /></td>
|
826
|
<td width="100"><?=gettext("reject");?></td>
|
827
|
<td width="14"></td>
|
828
|
<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11" alt="log" /></td>
|
829
|
<td width="100"><?=gettext("log");?></td>
|
830
|
</tr>
|
831
|
<tr>
|
832
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11" alt="pass disabled" /></td>
|
833
|
<td class="nowrap"><?=gettext("pass (disabled)");?></td>
|
834
|
<td> </td>
|
835
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_match_d.gif" width="11" height="11" alt="match disabled" /></td>
|
836
|
<td class="nowrap"><?=gettext("match (disabled)");?></td>
|
837
|
<td> </td>
|
838
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11" alt="block disabled" /></td>
|
839
|
<td class="nowrap"><?=gettext("block (disabled)");?></td>
|
840
|
<td> </td>
|
841
|
<td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11" alt="reject disabled" /></td>
|
842
|
<td class="nowrap"><?=gettext("reject (disabled)");?></td>
|
843
|
<td> </td>
|
844
|
<td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11" alt="log disabled" /></td>
|
845
|
<td class="nowrap"><?=gettext("log (disabled)");?></td>
|
846
|
</tr>
|
847
|
<tr>
|
848
|
<td colspan="10">
|
849
|
<p> </p>
|
850
|
<strong>
|
851
|
<span class="red"><?=gettext("Hint:");?></span>
|
852
|
</strong><br />
|
853
|
<ul>
|
854
|
<?php if ("FloatingRules" != $if): ?>
|
855
|
<li><?=gettext("Rules are evaluated on a first-match basis (i.e. " .
|
856
|
"the action of the first rule to match a packet will be executed). " .
|
857
|
"This means that if you use block rules, you'll have to pay attention " .
|
858
|
"to the rule order. Everything that isn't explicitly passed is blocked " .
|
859
|
"by default. ");?>
|
860
|
</li>
|
861
|
<?php else: ?>
|
862
|
<li><?=gettext("Floating rules are evaluated on a first-match basis (i.e. " .
|
863
|
"the action of the first rule to match a packet will be executed) only " .
|
864
|
"if the 'quick' option is checked on a rule. Otherwise they will only apply if no " .
|
865
|
"other rules match. Pay close attention to the rule order and options " .
|
866
|
"chosen. If no rule here matches, the per-interface or default rules are used. ");?>
|
867
|
</li>
|
868
|
<?php endif; ?>
|
869
|
</ul>
|
870
|
</td>
|
871
|
</tr>
|
872
|
</table>
|
873
|
</div>
|
874
|
</td>
|
875
|
</tr>
|
876
|
</table>
|
877
|
<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" />
|
878
|
<script type="text/javascript">
|
879
|
//<![CDATA[
|
880
|
var number_of_rules = <?=$nrules?>;
|
881
|
<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++): ?>
|
882
|
/*
|
883
|
Sortable.create("dragtable", {
|
884
|
tag:"tr",
|
885
|
format:"fr([0-9999999])",
|
886
|
containment:["dragtable"],
|
887
|
onChange:function(affected) {
|
888
|
document.body.style.cursor = 'move';
|
889
|
},
|
890
|
onUpdate:function(container) {
|
891
|
document.body.style.cursor = 'move';
|
892
|
updateOrder(Sortable.serialize('dragtable', 'tr'));
|
893
|
}
|
894
|
});
|
895
|
*/
|
896
|
<?php endfor; ?>
|
897
|
function updateOrder(order) {
|
898
|
if(document.getElementById("redboxtable"))
|
899
|
jQuery('#redboxtable').hide();
|
900
|
jQuery('#loading').show();
|
901
|
document.body.style.cursor = 'wait';
|
902
|
document.location = 'firewall_rules.php?if=<?=htmlspecialchars($if);?>&dragdroporder=true&' + Sortable.serialize('dragtable', 'tr');
|
903
|
return;
|
904
|
}
|
905
|
jQuery('#loading').hide();
|
906
|
//]]>
|
907
|
</script>
|
908
|
</form>
|
909
|
<?php include("fend.inc"); ?>
|
910
|
</body>
|
911
|
</html>
|