1 |
b2ffe419
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
37e2071c
|
Scott Ullrich
|
firewall_rules.php
|
4 |
5b237745
|
Scott Ullrich
|
*/
|
5 |
fd9ebcd5
|
Stephen Beaver
|
/* ====================================================================
|
6 |
6cb366de
|
Stephen Beaver
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
9da2cf1c
|
Stephen Beaver
|
*
|
8 |
cb41dd63
|
Renato Botelho
|
* Some or all of this file is based on the m0n0wall project which is
|
9 |
|
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10 |
fd9ebcd5
|
Stephen Beaver
|
*
|
11 |
6cb366de
|
Stephen Beaver
|
* Redistribution and use in source and binary forms, with or without modification,
|
12 |
|
|
* are permitted provided that the following conditions are met:
|
13 |
fd9ebcd5
|
Stephen Beaver
|
*
|
14 |
6cb366de
|
Stephen Beaver
|
* 1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
* this list of conditions and the following disclaimer.
|
16 |
fd9ebcd5
|
Stephen Beaver
|
*
|
17 |
6cb366de
|
Stephen Beaver
|
* 2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
* notice, this list of conditions and the following disclaimer in
|
19 |
|
|
* the documentation and/or other materials provided with the
|
20 |
|
|
* distribution.
|
21 |
fd9ebcd5
|
Stephen Beaver
|
*
|
22 |
6cb366de
|
Stephen Beaver
|
* 3. All advertising materials mentioning features or use of this software
|
23 |
|
|
* must display the following acknowledgment:
|
24 |
|
|
* "This product includes software developed by the pfSense Project
|
25 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
26 |
fd9ebcd5
|
Stephen Beaver
|
*
|
27 |
6cb366de
|
Stephen Beaver
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
28 |
|
|
* endorse or promote products derived from this software without
|
29 |
|
|
* prior written permission. For written permission, please contact
|
30 |
|
|
* coreteam@pfsense.org.
|
31 |
fd9ebcd5
|
Stephen Beaver
|
*
|
32 |
6cb366de
|
Stephen Beaver
|
* 5. Products derived from this software may not be called "pfSense"
|
33 |
|
|
* nor may "pfSense" appear in their names without prior written
|
34 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
35 |
fd9ebcd5
|
Stephen Beaver
|
*
|
36 |
6cb366de
|
Stephen Beaver
|
* 6. Redistributions of any form whatsoever must retain the following
|
37 |
|
|
* acknowledgment:
|
38 |
fd9ebcd5
|
Stephen Beaver
|
*
|
39 |
6cb366de
|
Stephen Beaver
|
* "This product includes software developed by the pfSense Project
|
40 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
41 |
919d91f9
|
Phil Davis
|
*
|
42 |
6cb366de
|
Stephen Beaver
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
43 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
45 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
46 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
47 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
48 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
49 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
51 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
52 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
53 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
54 |
fd9ebcd5
|
Stephen Beaver
|
*
|
55 |
6cb366de
|
Stephen Beaver
|
* ====================================================================
|
56 |
fd9ebcd5
|
Stephen Beaver
|
*
|
57 |
|
|
*/
|
58 |
5b237745
|
Scott Ullrich
|
|
59 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
60 |
|
|
##|*IDENT=page-firewall-rules
|
61 |
5230f468
|
jim-p
|
##|*NAME=Firewall: Rules
|
62 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Firewall: Rules' page.
|
63 |
|
|
##|*MATCH=firewall_rules.php*
|
64 |
|
|
##|-PRIV
|
65 |
|
|
|
66 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
67 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
68 |
|
|
require_once("filter.inc");
|
69 |
179ab6b3
|
Luiz Otavio O Souza
|
require_once("ipsec.inc");
|
70 |
7a927e67
|
Scott Ullrich
|
require_once("shaper.inc");
|
71 |
5b237745
|
Scott Ullrich
|
|
72 |
6c07db48
|
Phil Davis
|
$pgtitle = array(gettext("Firewall"), gettext("Rules"));
|
73 |
b32dd0a6
|
jim-p
|
$shortcut_section = "firewall";
|
74 |
7a808e01
|
Carlos Eduardo Ramos
|
|
75 |
00c82782
|
Renato Botelho
|
function delete_nat_association($id) {
|
76 |
|
|
global $config;
|
77 |
|
|
|
78 |
603d3c16
|
Phil Davis
|
if (!$id || !is_array($config['nat']['rule'])) {
|
79 |
673d29c0
|
Renato Botelho
|
return;
|
80 |
603d3c16
|
Phil Davis
|
}
|
81 |
673d29c0
|
Renato Botelho
|
|
82 |
00c82782
|
Renato Botelho
|
$a_nat = &$config['nat']['rule'];
|
83 |
|
|
|
84 |
603d3c16
|
Phil Davis
|
foreach ($a_nat as &$natent) {
|
85 |
|
|
if ($natent['associated-rule-id'] == $id) {
|
86 |
00c82782
|
Renato Botelho
|
$natent['associated-rule-id'] = '';
|
87 |
603d3c16
|
Phil Davis
|
}
|
88 |
|
|
}
|
89 |
673d29c0
|
Renato Botelho
|
}
|
90 |
|
|
|
91 |
5b237745
|
Scott Ullrich
|
if (!is_array($config['filter']['rule'])) {
|
92 |
|
|
$config['filter']['rule'] = array();
|
93 |
|
|
}
|
94 |
c821a6cd
|
Stephen Beaver
|
|
95 |
5b237745
|
Scott Ullrich
|
filter_rules_sort();
|
96 |
|
|
$a_filter = &$config['filter']['rule'];
|
97 |
|
|
|
98 |
07bd3f83
|
Scott Ullrich
|
$if = $_GET['if'];
|
99 |
824329d2
|
Stephen Beaver
|
|
100 |
603d3c16
|
Phil Davis
|
if ($_POST['if']) {
|
101 |
07bd3f83
|
Scott Ullrich
|
$if = $_POST['if'];
|
102 |
603d3c16
|
Phil Davis
|
}
|
103 |
b2ffe419
|
Scott Ullrich
|
|
104 |
cbe3ea96
|
Ermal Luçi
|
$ifdescs = get_configured_interface_with_descr();
|
105 |
07bd3f83
|
Scott Ullrich
|
|
106 |
90ba56ad
|
Scott Ullrich
|
/* add group interfaces */
|
107 |
603d3c16
|
Phil Davis
|
if (is_array($config['ifgroups']['ifgroupentry'])) {
|
108 |
|
|
foreach ($config['ifgroups']['ifgroupentry'] as $ifgen) {
|
109 |
|
|
if (have_ruleint_access($ifgen['ifname'])) {
|
110 |
90ba56ad
|
Scott Ullrich
|
$iflist[$ifgen['ifname']] = $ifgen['ifname'];
|
111 |
603d3c16
|
Phil Davis
|
}
|
112 |
|
|
}
|
113 |
|
|
}
|
114 |
90ba56ad
|
Scott Ullrich
|
|
115 |
603d3c16
|
Phil Davis
|
foreach ($ifdescs as $ifent => $ifdesc) {
|
116 |
|
|
if (have_ruleint_access($ifent)) {
|
117 |
aef4dc74
|
Ermal Luçi
|
$iflist[$ifent] = $ifdesc;
|
118 |
603d3c16
|
Phil Davis
|
}
|
119 |
|
|
}
|
120 |
88bcd1d2
|
Scott Dale
|
|
121 |
603d3c16
|
Phil Davis
|
if ($config['l2tp']['mode'] == "server") {
|
122 |
|
|
if (have_ruleint_access("l2tp")) {
|
123 |
56dda8e0
|
Renato Botelho
|
$iflist['l2tp'] = "L2TP VPN";
|
124 |
603d3c16
|
Phil Davis
|
}
|
125 |
|
|
}
|
126 |
617f8d25
|
Ermal Lu?i
|
|
127 |
b0899ee4
|
Ermal
|
if (is_array($config['pppoes']['pppoe'])) {
|
128 |
603d3c16
|
Phil Davis
|
foreach ($config['pppoes']['pppoe'] as $pppoes) {
|
129 |
|
|
if (($pppoes['mode'] == 'server') && have_ruleint_access("pppoe")) {
|
130 |
b0899ee4
|
Ermal
|
$iflist['pppoe'] = "PPPoE Server";
|
131 |
603d3c16
|
Phil Davis
|
}
|
132 |
|
|
}
|
133 |
b0899ee4
|
Ermal
|
}
|
134 |
0c554ff6
|
Scott Ullrich
|
|
135 |
88bcd1d2
|
Scott Dale
|
/* add ipsec interfaces */
|
136 |
67c2baf1
|
Phil Davis
|
if (ipsec_enabled() && have_ruleint_access("enc0")) {
|
137 |
179ab6b3
|
Luiz Otavio O Souza
|
$iflist["enc0"] = "IPsec";
|
138 |
67c2baf1
|
Phil Davis
|
}
|
139 |
07bd3f83
|
Scott Ullrich
|
|
140 |
bfb60ac8
|
Ermal Luçi
|
/* add openvpn/tun interfaces */
|
141 |
6c07db48
|
Phil Davis
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
|
142 |
56dda8e0
|
Renato Botelho
|
$iflist["openvpn"] = "OpenVPN";
|
143 |
603d3c16
|
Phil Davis
|
}
|
144 |
bfb60ac8
|
Ermal Luçi
|
|
145 |
92125c97
|
Ermal Luçi
|
if (!$if || !isset($iflist[$if])) {
|
146 |
603d3c16
|
Phil Davis
|
if ("any" == $if) {
|
147 |
56dda8e0
|
Renato Botelho
|
$if = "FloatingRules";
|
148 |
603d3c16
|
Phil Davis
|
} else if ("FloatingRules" != $if) {
|
149 |
|
|
if (isset($iflist['wan'])) {
|
150 |
0416d9a0
|
Darren Embry
|
$if = "wan";
|
151 |
603d3c16
|
Phil Davis
|
} else {
|
152 |
0416d9a0
|
Darren Embry
|
$if = "FloatingRules";
|
153 |
603d3c16
|
Phil Davis
|
}
|
154 |
0416d9a0
|
Darren Embry
|
}
|
155 |
92125c97
|
Ermal Luçi
|
}
|
156 |
07bd3f83
|
Scott Ullrich
|
|
157 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
158 |
|
|
$pconfig = $_POST;
|
159 |
|
|
|
160 |
|
|
if ($_POST['apply']) {
|
161 |
37e2071c
|
Scott Ullrich
|
$retval = 0;
|
162 |
9a7e416c
|
Scott Ullrich
|
$retval = filter_configure();
|
163 |
|
|
|
164 |
a368a026
|
Ermal Lu?i
|
clear_subsystem_dirty('filter');
|
165 |
a985eac2
|
Scott Ullrich
|
|
166 |
824329d2
|
Stephen Beaver
|
$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"),
|
167 |
|
|
"<a href='status_filter_reload.php'>", "</a>");
|
168 |
5b237745
|
Scott Ullrich
|
}
|
169 |
|
|
}
|
170 |
|
|
|
171 |
d97c50cd
|
Bill Marquette
|
if ($_GET['act'] == "del") {
|
172 |
673d29c0
|
Renato Botelho
|
if ($a_filter[$_GET['id']]) {
|
173 |
|
|
if (!empty($a_filter[$_GET['id']]['associated-rule-id'])) {
|
174 |
00c82782
|
Renato Botelho
|
delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
|
175 |
673d29c0
|
Renato Botelho
|
}
|
176 |
|
|
unset($a_filter[$_GET['id']]);
|
177 |
603d3c16
|
Phil Davis
|
if (write_config()) {
|
178 |
bec92ab9
|
jim-p
|
mark_subsystem_dirty('filter');
|
179 |
603d3c16
|
Phil Davis
|
}
|
180 |
6cb366de
|
Stephen Beaver
|
|
181 |
e653b6e1
|
jim-p
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
182 |
673d29c0
|
Renato Botelho
|
exit;
|
183 |
|
|
}
|
184 |
d97c50cd
|
Bill Marquette
|
}
|
185 |
|
|
|
186 |
32c58070
|
Scott Ullrich
|
// Handle save msg if defined
|
187 |
603d3c16
|
Phil Davis
|
if ($_REQUEST['savemsg']) {
|
188 |
32c58070
|
Scott Ullrich
|
$savemsg = htmlentities($_REQUEST['savemsg']);
|
189 |
603d3c16
|
Phil Davis
|
}
|
190 |
32c58070
|
Scott Ullrich
|
|
191 |
6cb366de
|
Stephen Beaver
|
if (isset($_POST['del_x'])) {
|
192 |
|
|
/* delete selected rules */
|
193 |
|
|
$deleted = false;
|
194 |
|
|
|
195 |
|
|
if (is_array($_POST['rule']) && count($_POST['rule'])) {
|
196 |
|
|
foreach ($_POST['rule'] as $rulei) {
|
197 |
|
|
delete_nat_association($a_filter[$rulei]['associated-rule-id']);
|
198 |
|
|
unset($a_filter[$rulei]);
|
199 |
|
|
$deleted = true;
|
200 |
|
|
}
|
201 |
|
|
|
202 |
67c2baf1
|
Phil Davis
|
if ($deleted) {
|
203 |
6cb366de
|
Stephen Beaver
|
if (write_config()) {
|
204 |
|
|
mark_subsystem_dirty('filter');
|
205 |
|
|
}
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
209 |
|
|
exit;
|
210 |
|
|
}
|
211 |
|
|
} else if ($_GET['act'] == "toggle") {
|
212 |
07bd3f83
|
Scott Ullrich
|
if ($a_filter[$_GET['id']]) {
|
213 |
603d3c16
|
Phil Davis
|
if (isset($a_filter[$_GET['id']]['disabled'])) {
|
214 |
56dda8e0
|
Renato Botelho
|
unset($a_filter[$_GET['id']]['disabled']);
|
215 |
603d3c16
|
Phil Davis
|
} else {
|
216 |
56dda8e0
|
Renato Botelho
|
$a_filter[$_GET['id']]['disabled'] = true;
|
217 |
603d3c16
|
Phil Davis
|
}
|
218 |
|
|
if (write_config()) {
|
219 |
bec92ab9
|
jim-p
|
mark_subsystem_dirty('filter');
|
220 |
603d3c16
|
Phil Davis
|
}
|
221 |
6cb366de
|
Stephen Beaver
|
|
222 |
e653b6e1
|
jim-p
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
223 |
5b237745
|
Scott Ullrich
|
exit;
|
224 |
|
|
}
|
225 |
67c2baf1
|
Phil Davis
|
} else if ($_POST['order-store']) {
|
226 |
ea5665c7
|
Sjon Hortensius
|
/* update rule order, POST[rule] is an array of ordered IDs */
|
227 |
|
|
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
|
228 |
07bd3f83
|
Scott Ullrich
|
$a_filter_new = array();
|
229 |
b2ffe419
|
Scott Ullrich
|
|
230 |
ea5665c7
|
Sjon Hortensius
|
// if a rule is not in POST[rule], it has been deleted by the user
|
231 |
67c2baf1
|
Phil Davis
|
foreach ($_POST['rule'] as $id) {
|
232 |
ea5665c7
|
Sjon Hortensius
|
$a_filter_new[] = $a_filter[$id];
|
233 |
67c2baf1
|
Phil Davis
|
}
|
234 |
b2ffe419
|
Scott Ullrich
|
|
235 |
07bd3f83
|
Scott Ullrich
|
$a_filter = $a_filter_new;
|
236 |
603d3c16
|
Phil Davis
|
if (write_config()) {
|
237 |
bec92ab9
|
jim-p
|
mark_subsystem_dirty('filter');
|
238 |
603d3c16
|
Phil Davis
|
}
|
239 |
6cb366de
|
Stephen Beaver
|
|
240 |
e653b6e1
|
jim-p
|
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
|
241 |
5b237745
|
Scott Ullrich
|
exit;
|
242 |
|
|
}
|
243 |
|
|
}
|
244 |
|
|
|
245 |
df95836a
|
Stephen Beaver
|
$tab_array = array(array(gettext("Floating"), ("FloatingRules" == $if), "firewall_rules.php?if=FloatingRules"));
|
246 |
|
|
|
247 |
67c2baf1
|
Phil Davis
|
foreach ($iflist as $ifent => $ifname) {
|
248 |
df95836a
|
Stephen Beaver
|
$tab_array[] = array($ifname, ($ifent == $if), "firewall_rules.php?if={$ifent}");
|
249 |
67c2baf1
|
Phil Davis
|
}
|
250 |
df95836a
|
Stephen Beaver
|
|
251 |
|
|
foreach ($tab_array as $dtab) {
|
252 |
67c2baf1
|
Phil Davis
|
if ($dtab[1]) {
|
253 |
df95836a
|
Stephen Beaver
|
$bctab = $dtab[0];
|
254 |
|
|
break;
|
255 |
|
|
}
|
256 |
|
|
}
|
257 |
|
|
|
258 |
|
|
$pgtitle = array(gettext("Firewall"), gettext("Rules"), $bctab);
|
259 |
|
|
$shortcut_section = "firewall";
|
260 |
|
|
|
261 |
9a25487b
|
Scott Ullrich
|
include("head.inc");
|
262 |
3b2c83b8
|
Sjon Hortensius
|
$nrules = 0;
|
263 |
|
|
|
264 |
67c2baf1
|
Phil Davis
|
if ($savemsg) {
|
265 |
42a6bcbd
|
Stephen Beaver
|
print_info_box($savemsg, 'success');
|
266 |
67c2baf1
|
Phil Davis
|
}
|
267 |
42a6bcbd
|
Stephen Beaver
|
|
268 |
67c2baf1
|
Phil Davis
|
if (is_subsystem_dirty('filter')) {
|
269 |
ea5665c7
|
Sjon Hortensius
|
print_info_box_np(gettext("The firewall rule configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."), "apply", "", true);
|
270 |
67c2baf1
|
Phil Davis
|
}
|
271 |
3b2c83b8
|
Sjon Hortensius
|
|
272 |
|
|
display_top_tabs($tab_array);
|
273 |
ea5665c7
|
Sjon Hortensius
|
|
274 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
275 |
c821a6cd
|
Stephen Beaver
|
<form method="post">
|
276 |
|
|
<div class="panel panel-default">
|
277 |
|
|
<div class="panel-heading"><?=gettext("Rules (Drag to change order)")?></div>
|
278 |
|
|
<div id="mainarea" class="table-responsive panel-body">
|
279 |
b5ef3ee9
|
Jared Dillard
|
<table name="ruletable" class="table table-hover table-striped table-condensed">
|
280 |
c821a6cd
|
Stephen Beaver
|
<thead>
|
281 |
|
|
<tr>
|
282 |
6cb366de
|
Stephen Beaver
|
<th><!-- checkbox --></th>
|
283 |
c821a6cd
|
Stephen Beaver
|
<th><!-- status icons --></th>
|
284 |
f25dac2d
|
Stephen Beaver
|
<th><?=gettext("Proto")?></th>
|
285 |
|
|
<th><?=gettext("Source")?></th>
|
286 |
|
|
<th><?=gettext("Port")?></th>
|
287 |
|
|
<th><?=gettext("Destination")?></th>
|
288 |
|
|
<th><?=gettext("Port")?></th>
|
289 |
|
|
<th><?=gettext("Gateway")?></th>
|
290 |
|
|
<th><?=gettext("Queue")?></th>
|
291 |
|
|
<th><?=gettext("Schedule")?></th>
|
292 |
|
|
<th><?=gettext("Description")?></th>
|
293 |
|
|
<th><?=gettext("Actions")?></th>
|
294 |
c821a6cd
|
Stephen Beaver
|
</tr>
|
295 |
|
|
</thead>
|
296 |
|
|
<tbody>
|
297 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
298 |
ea5665c7
|
Sjon Hortensius
|
// 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.
|
299 |
|
|
if (!isset($config['system']['webgui']['noantilockout']) &&
|
300 |
67c2baf1
|
Phil Davis
|
(((count($config['interfaces']) > 1) && ($if == 'lan')) ||
|
301 |
|
|
((count($config['interfaces']) == 1) && ($if == 'wan')))):
|
302 |
ea5665c7
|
Sjon Hortensius
|
$alports = implode('<br />', filter_get_antilockout_ports(true));
|
303 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
304 |
45e849c1
|
Jared Dillard
|
<tr id="antilockout" class="hover-success">
|
305 |
6cb366de
|
Stephen Beaver
|
<td></td>
|
306 |
29620ab5
|
Jared Dillard
|
<td title="<?=gettext("traffic is passed")?>"><i class="fa fa-check text-success"></i></td>
|
307 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
308 |
|
|
<td>*</td>
|
309 |
|
|
<td>*</td>
|
310 |
|
|
<td><?=$iflist[$if];?> Address</td>
|
311 |
|
|
<td><?=$alports?></td>
|
312 |
|
|
<td>*</td>
|
313 |
|
|
<td>*</td>
|
314 |
|
|
<td></td>
|
315 |
45e849c1
|
Jared Dillard
|
<td class="bg-info"><?=gettext("Anti-Lockout Rule");?></td>
|
316 |
c821a6cd
|
Stephen Beaver
|
<td>
|
317 |
45e849c1
|
Jared Dillard
|
<a href="system_advanced_admin.php" title="<?=gettext("Settings");?>"><i class="fa fa-cog"></i></a>
|
318 |
c821a6cd
|
Stephen Beaver
|
</td>
|
319 |
|
|
</tr>
|
320 |
3b2c83b8
|
Sjon Hortensius
|
<?php endif;?>
|
321 |
f1f60c92
|
Ermal Luçi
|
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
|
322 |
45e849c1
|
Jared Dillard
|
<tr id="frrfc1918" class="hover-danger">
|
323 |
6cb366de
|
Stephen Beaver
|
<td></td>
|
324 |
29620ab5
|
Jared Dillard
|
<td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times text-danger"></i></td>
|
325 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
326 |
|
|
<td><?=gettext("RFC 1918 networks");?></td>
|
327 |
|
|
<td>*</td>
|
328 |
|
|
<td>*</td>
|
329 |
|
|
<td>*</td>
|
330 |
|
|
<td>*</td>
|
331 |
|
|
<td>*</td>
|
332 |
|
|
<td></td>
|
333 |
45e849c1
|
Jared Dillard
|
<td class="bg-info"><?=gettext("Block private networks");?></td>
|
334 |
c821a6cd
|
Stephen Beaver
|
<td>
|
335 |
45e849c1
|
Jared Dillard
|
<a href="interfaces.php?if=<?=htmlspecialchars($if)?>" title="<?=gettext("Settings");?>"><i class="fa fa-cog"></i></a>
|
336 |
c821a6cd
|
Stephen Beaver
|
</td>
|
337 |
|
|
</tr>
|
338 |
3b2c83b8
|
Sjon Hortensius
|
<?php endif;?>
|
339 |
f1f60c92
|
Ermal Luçi
|
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
|
340 |
45e849c1
|
Jared Dillard
|
<tr id="frrfc1918" class="hover-danger">
|
341 |
6cb366de
|
Stephen Beaver
|
<td></td>
|
342 |
29620ab5
|
Jared Dillard
|
<td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times text-danger"></i></td>
|
343 |
c821a6cd
|
Stephen Beaver
|
<td>*</td>
|
344 |
|
|
<td><?=gettext("Reserved/not assigned by IANA");?></td>
|
345 |
|
|
<td>*</td>
|
346 |
|
|
<td>*</td>
|
347 |
|
|
<td>*</td>
|
348 |
|
|
<td>*</td>
|
349 |
|
|
<td>*</td>
|
350 |
ea548271
|
Phil Davis
|
<td></td>
|
351 |
45e849c1
|
Jared Dillard
|
<td class="bg-info"><?=gettext("Block bogon networks");?></td>
|
352 |
c821a6cd
|
Stephen Beaver
|
<td>
|
353 |
45e849c1
|
Jared Dillard
|
<a href="interfaces.php?if=<?=htmlspecialchars($if)?>" title="<?=gettext("Settings");?>"><i class="fa fa-cog"></i></a>
|
354 |
c821a6cd
|
Stephen Beaver
|
</td>
|
355 |
|
|
</tr>
|
356 |
3b2c83b8
|
Sjon Hortensius
|
<?php endif;?>
|
357 |
c821a6cd
|
Stephen Beaver
|
</tbody>
|
358 |
3b2c83b8
|
Sjon Hortensius
|
|
359 |
c821a6cd
|
Stephen Beaver
|
<tbody class="user-entries">
|
360 |
6cb366de
|
Stephen Beaver
|
<?php
|
361 |
|
|
$nrules = 0;
|
362 |
|
|
for ($i = 0; isset($a_filter[$i]); $i++):
|
363 |
56dda8e0
|
Renato Botelho
|
$filterent = $a_filter[$i];
|
364 |
6cb366de
|
Stephen Beaver
|
|
365 |
67c2baf1
|
Phil Davis
|
if (($filterent['interface'] != $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" != $if)) {
|
366 |
04fd7017
|
Stephen Beaver
|
$display = 'style="display: none;"';
|
367 |
824329d2
|
Stephen Beaver
|
} else {
|
368 |
|
|
$display = "";
|
369 |
04fd7017
|
Stephen Beaver
|
}
|
370 |
56dda8e0
|
Renato Botelho
|
?>
|
371 |
04fd7017
|
Stephen Beaver
|
<tr id="fr<?=$nrules;?>" <?=$display?> onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" <?=(isset($filterent['disabled']) ? ' class="disabled"' : '')?>>
|
372 |
6cb366de
|
Stephen Beaver
|
<td >
|
373 |
|
|
<input type="checkbox" id="frc<?=$nrules;?>" onClick="fr_toggle(<?=$nrules;?>)" name="rule[]" value="<?=$i;?>"/>
|
374 |
|
|
</td>
|
375 |
|
|
|
376 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
377 |
d08aeac1
|
Phil Davis
|
if ($filterent['type'] == "block") {
|
378 |
29620ab5
|
Jared Dillard
|
$iconfn = "times text-danger";
|
379 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is blocked");
|
380 |
|
|
} else if ($filterent['type'] == "reject") {
|
381 |
29620ab5
|
Jared Dillard
|
$iconfn = "hand-stop-o text-warning";
|
382 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is rejected");
|
383 |
|
|
} else if ($filterent['type'] == "match") {
|
384 |
3b2c83b8
|
Sjon Hortensius
|
$iconfn = "filter";
|
385 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is matched");
|
386 |
|
|
} else {
|
387 |
29620ab5
|
Jared Dillard
|
$iconfn = "check text-success";
|
388 |
d08aeac1
|
Phil Davis
|
$title_text = gettext("traffic is passed");
|
389 |
|
|
}
|
390 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
391 |
d08aeac1
|
Phil Davis
|
<td title="<?=$title_text?>">
|
392 |
|
|
|
393 |
1b7379f9
|
Jared Dillard
|
<i class="fa fa-<?=$iconfn?>"></i>
|
394 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
395 |
|
|
$isadvset = firewall_check_for_advanced_options($filterent);
|
396 |
67c2baf1
|
Phil Davis
|
if ($isadvset) {
|
397 |
7ea65674
|
Jared Dillard
|
print '<i class="fa fa-cog" title="'. gettext("advanced setting") .': '. $isadvset .'"></i>';
|
398 |
67c2baf1
|
Phil Davis
|
}
|
399 |
3b2c83b8
|
Sjon Hortensius
|
|
400 |
67c2baf1
|
Phil Davis
|
if (isset($filterent['log'])) {
|
401 |
1b7379f9
|
Jared Dillard
|
print '<i class="fa fa-tasks" title="'. gettext("traffic is logged") .'"></i>';
|
402 |
67c2baf1
|
Phil Davis
|
}
|
403 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
404 |
d08aeac1
|
Phil Davis
|
</td>
|
405 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
406 |
|
|
$alias = rule_columns_with_alias(
|
407 |
|
|
$filterent['source']['address'],
|
408 |
|
|
pprint_port($filterent['source']['port']),
|
409 |
|
|
$filterent['destination']['address'],
|
410 |
|
|
pprint_port($filterent['destination']['port'])
|
411 |
|
|
);
|
412 |
|
|
|
413 |
|
|
//build Schedule popup box
|
414 |
|
|
$a_schedules = &$config['schedules']['schedule'];
|
415 |
|
|
$schedule_span_begin = "";
|
416 |
|
|
$schedule_span_end = "";
|
417 |
|
|
$sched_caption_escaped = "";
|
418 |
|
|
$sched_content = "";
|
419 |
|
|
$schedstatus = false;
|
420 |
e6f34d22
|
Phil Davis
|
$dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
|
421 |
|
|
$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'));
|
422 |
ea5665c7
|
Sjon Hortensius
|
if ($config['schedules']['schedule'] != "" && is_array($config['schedules']['schedule'])) {
|
423 |
bdfea2e7
|
Stephen Beaver
|
$idx = 0;
|
424 |
67c2baf1
|
Phil Davis
|
foreach ($a_schedules as $schedule) {
|
425 |
e6f34d22
|
Phil Davis
|
if ($schedule['name'] == $filterent['sched']) {
|
426 |
3b2c83b8
|
Sjon Hortensius
|
$schedstatus = filter_get_time_based_rule_status($schedule);
|
427 |
|
|
|
428 |
e6f34d22
|
Phil Davis
|
foreach ($schedule['timerange'] as $timerange) {
|
429 |
3b2c83b8
|
Sjon Hortensius
|
$tempFriendlyTime = "";
|
430 |
|
|
$tempID = "";
|
431 |
|
|
$firstprint = false;
|
432 |
e6f34d22
|
Phil Davis
|
if ($timerange) {
|
433 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly = "";
|
434 |
|
|
$tempFriendlyTime = "";
|
435 |
|
|
|
436 |
|
|
//get hours
|
437 |
|
|
$temptimerange = $timerange['hour'];
|
438 |
|
|
$temptimeseparator = strrpos($temptimerange, "-");
|
439 |
|
|
|
440 |
|
|
$starttime = substr ($temptimerange, 0, $temptimeseparator);
|
441 |
|
|
$stoptime = substr ($temptimerange, $temptimeseparator+1);
|
442 |
|
|
|
443 |
e6f34d22
|
Phil Davis
|
if ($timerange['month']) {
|
444 |
3b2c83b8
|
Sjon Hortensius
|
$tempmontharray = explode(",", $timerange['month']);
|
445 |
e6f34d22
|
Phil Davis
|
$tempdayarray = explode(",", $timerange['day']);
|
446 |
3b2c83b8
|
Sjon Hortensius
|
$arraycounter = 0;
|
447 |
|
|
$firstDayFound = false;
|
448 |
|
|
$firstPrint = false;
|
449 |
e6f34d22
|
Phil Davis
|
foreach ($tempmontharray as $monthtmp) {
|
450 |
3b2c83b8
|
Sjon Hortensius
|
$month = $tempmontharray[$arraycounter];
|
451 |
|
|
$day = $tempdayarray[$arraycounter];
|
452 |
|
|
|
453 |
67c2baf1
|
Phil Davis
|
if (!$firstDayFound) {
|
454 |
3b2c83b8
|
Sjon Hortensius
|
$firstDay = $day;
|
455 |
|
|
$firstmonth = $month;
|
456 |
|
|
$firstDayFound = true;
|
457 |
|
|
}
|
458 |
|
|
|
459 |
|
|
$currentDay = $day;
|
460 |
|
|
$nextDay = $tempdayarray[$arraycounter+1];
|
461 |
|
|
$currentDay++;
|
462 |
e6f34d22
|
Phil Davis
|
if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
|
463 |
67c2baf1
|
Phil Davis
|
if ($firstPrint) {
|
464 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= ", ";
|
465 |
67c2baf1
|
Phil Davis
|
}
|
466 |
3b2c83b8
|
Sjon Hortensius
|
$currentDay--;
|
467 |
67c2baf1
|
Phil Davis
|
if ($currentDay != $firstDay) {
|
468 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
|
469 |
67c2baf1
|
Phil Davis
|
} else {
|
470 |
c821a6cd
|
Stephen Beaver
|
$dayFriendly .= $monthArray[$month-1] . " " . $day;
|
471 |
67c2baf1
|
Phil Davis
|
}
|
472 |
8ce97a08
|
Scott Dale
|
$firstDayFound = false;
|
473 |
3b2c83b8
|
Sjon Hortensius
|
$firstPrint = true;
|
474 |
|
|
}
|
475 |
|
|
$arraycounter++;
|
476 |
|
|
}
|
477 |
67c2baf1
|
Phil Davis
|
} else {
|
478 |
3b2c83b8
|
Sjon Hortensius
|
$tempdayFriendly = $timerange['position'];
|
479 |
|
|
$firstDayFound = false;
|
480 |
|
|
$tempFriendlyDayArray = explode(",", $tempdayFriendly);
|
481 |
|
|
$currentDay = "";
|
482 |
|
|
$firstDay = "";
|
483 |
|
|
$nextDay = "";
|
484 |
|
|
$counter = 0;
|
485 |
e6f34d22
|
Phil Davis
|
foreach ($tempFriendlyDayArray as $day) {
|
486 |
|
|
if ($day != "") {
|
487 |
67c2baf1
|
Phil Davis
|
if (!$firstDayFound) {
|
488 |
3b2c83b8
|
Sjon Hortensius
|
$firstDay = $tempFriendlyDayArray[$counter];
|
489 |
|
|
$firstDayFound = true;
|
490 |
8ce97a08
|
Scott Dale
|
}
|
491 |
3b2c83b8
|
Sjon Hortensius
|
$currentDay =$tempFriendlyDayArray[$counter];
|
492 |
|
|
//get next day
|
493 |
|
|
$nextDay = $tempFriendlyDayArray[$counter+1];
|
494 |
|
|
$currentDay++;
|
495 |
e6f34d22
|
Phil Davis
|
if ($currentDay != $nextDay) {
|
496 |
67c2baf1
|
Phil Davis
|
if ($firstprint) {
|
497 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= ", ";
|
498 |
67c2baf1
|
Phil Davis
|
}
|
499 |
3b2c83b8
|
Sjon Hortensius
|
$currentDay--;
|
500 |
67c2baf1
|
Phil Davis
|
if ($currentDay != $firstDay) {
|
501 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
|
502 |
67c2baf1
|
Phil Davis
|
} else {
|
503 |
3b2c83b8
|
Sjon Hortensius
|
$dayFriendly .= $dayArray[$firstDay-1];
|
504 |
67c2baf1
|
Phil Davis
|
}
|
505 |
3b2c83b8
|
Sjon Hortensius
|
$firstDayFound = false;
|
506 |
|
|
$firstprint = true;
|
507 |
|
|
}
|
508 |
|
|
$counter++;
|
509 |
56dda8e0
|
Renato Botelho
|
}
|
510 |
8ce97a08
|
Scott Dale
|
}
|
511 |
2a113ca9
|
Scott Dale
|
}
|
512 |
3b2c83b8
|
Sjon Hortensius
|
$timeFriendly = $starttime . " - " . $stoptime;
|
513 |
|
|
$description = $timerange['rangedescr'];
|
514 |
|
|
$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br />";
|
515 |
56dda8e0
|
Renato Botelho
|
}
|
516 |
|
|
}
|
517 |
ea5665c7
|
Sjon Hortensius
|
#FIXME
|
518 |
3b2c83b8
|
Sjon Hortensius
|
$sched_caption_escaped = str_replace("'", "\'", $schedule['descr']);
|
519 |
bdfea2e7
|
Stephen Beaver
|
$schedule_span_begin = '<a href="/firewall_schedule_edit.php?id=' . $idx . '" data-toggle="popover" data-trigger="hover focus" title="' . $schedule['name'] . '" data-content="' .
|
520 |
|
|
$sched_caption_escaped . '" data-html="true">';
|
521 |
|
|
$schedule_span_end = "";
|
522 |
616dd997
|
Scott Dale
|
}
|
523 |
3b2c83b8
|
Sjon Hortensius
|
}
|
524 |
bdfea2e7
|
Stephen Beaver
|
$idx++;
|
525 |
3b2c83b8
|
Sjon Hortensius
|
}
|
526 |
|
|
$printicon = false;
|
527 |
|
|
$alttext = "";
|
528 |
|
|
$image = "";
|
529 |
|
|
if (!isset($filterent['disabled'])) {
|
530 |
|
|
if ($schedstatus) {
|
531 |
|
|
if ($iconfn == "block" || $iconfn == "reject") {
|
532 |
7ea65674
|
Jared Dillard
|
$image = "times-circle";
|
533 |
bdfea2e7
|
Stephen Beaver
|
$dispcolor = "text-danger";
|
534 |
3b2c83b8
|
Sjon Hortensius
|
$alttext = gettext("Traffic matching this rule is currently being denied");
|
535 |
56dda8e0
|
Renato Botelho
|
} else {
|
536 |
7ea65674
|
Jared Dillard
|
$image = "play-circle";
|
537 |
bdfea2e7
|
Stephen Beaver
|
$dispcolor = "text-success";
|
538 |
3b2c83b8
|
Sjon Hortensius
|
$alttext = gettext("Traffic matching this rule is currently being allowed");
|
539 |
be81b340
|
Erik Fonnesbeck
|
}
|
540 |
3b2c83b8
|
Sjon Hortensius
|
$printicon = true;
|
541 |
|
|
} else if ($filterent['sched']) {
|
542 |
67c2baf1
|
Phil Davis
|
if ($iconfn == "block" || $iconfn == "reject") {
|
543 |
7ea65674
|
Jared Dillard
|
$image = "times-circle";
|
544 |
67c2baf1
|
Phil Davis
|
} else {
|
545 |
7ea65674
|
Jared Dillard
|
$image = "times-circle";
|
546 |
67c2baf1
|
Phil Davis
|
}
|
547 |
3b2c83b8
|
Sjon Hortensius
|
$alttext = gettext("This rule is not currently active because its period has expired");
|
548 |
bdfea2e7
|
Stephen Beaver
|
$dispcolor = "text-danger";
|
549 |
3b2c83b8
|
Sjon Hortensius
|
$printicon = true;
|
550 |
|
|
}
|
551 |
|
|
}
|
552 |
|
|
?>
|
553 |
ea5665c7
|
Sjon Hortensius
|
<td>
|
554 |
3b2c83b8
|
Sjon Hortensius
|
<?php
|
555 |
|
|
if (isset($filterent['ipprotocol'])) {
|
556 |
e6f34d22
|
Phil Davis
|
switch ($filterent['ipprotocol']) {
|
557 |
3b2c83b8
|
Sjon Hortensius
|
case "inet":
|
558 |
|
|
echo "IPv4 ";
|
559 |
|
|
break;
|
560 |
|
|
case "inet6":
|
561 |
|
|
echo "IPv6 ";
|
562 |
|
|
break;
|
563 |
|
|
case "inet46":
|
564 |
|
|
echo "IPv4+6 ";
|
565 |
|
|
break;
|
566 |
|
|
}
|
567 |
|
|
} else {
|
568 |
|
|
echo "IPv4 ";
|
569 |
|
|
}
|
570 |
|
|
|
571 |
|
|
if (isset($filterent['protocol'])) {
|
572 |
|
|
echo strtoupper($filterent['protocol']);
|
573 |
|
|
|
574 |
|
|
if (strtoupper($filterent['protocol']) == "ICMP" && !empty($filterent['icmptype'])) {
|
575 |
|
|
echo ' <span style="cursor: help;" title="ICMP type: ' .
|
576 |
e6f34d22
|
Phil Davis
|
($filterent['ipprotocol'] == "inet6" ? $icmp6types[$filterent['icmptype']] : $icmptypes[$filterent['icmptype']]) .
|
577 |
3b2c83b8
|
Sjon Hortensius
|
'"><u>';
|
578 |
|
|
echo $filterent['icmptype'];
|
579 |
|
|
echo '</u></span>';
|
580 |
|
|
}
|
581 |
|
|
} else echo "*";
|
582 |
e83aaa50
|
Stephen Beaver
|
|
583 |
3b2c83b8
|
Sjon Hortensius
|
?>
|
584 |
c821a6cd
|
Stephen Beaver
|
</td>
|
585 |
|
|
<td>
|
586 |
|
|
<?php if (isset($alias['src'])): ?>
|
587 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['src']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['src'])?>" data-html="true">
|
588 |
|
|
<?php endif; ?>
|
589 |
|
|
<?=htmlspecialchars(pprint_address($filterent['source']))?>
|
590 |
|
|
</td>
|
591 |
|
|
<td>
|
592 |
|
|
<?php if (isset($alias['srcport'])): ?>
|
593 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['srcport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['srcport'])?>" data-html="true">
|
594 |
|
|
<?php endif; ?>
|
595 |
|
|
<?=htmlspecialchars(pprint_port($filterent['source']['port']))?>
|
596 |
|
|
</td>
|
597 |
|
|
<td>
|
598 |
|
|
<?php if (isset($alias['dst'])): ?>
|
599 |
e83aaa50
|
Stephen Beaver
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['dst']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['dst'])?>" data-html="true">
|
600 |
c821a6cd
|
Stephen Beaver
|
<?php endif; ?>
|
601 |
2754e7e6
|
Stephen Beaver
|
<?=htmlspecialchars(pprint_address($filterent['destination']))?>
|
602 |
c821a6cd
|
Stephen Beaver
|
</td>
|
603 |
|
|
<td>
|
604 |
|
|
<?php if (isset($alias['dstport'])): ?>
|
605 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true">
|
606 |
|
|
<?php endif; ?>
|
607 |
|
|
<?=htmlspecialchars(pprint_port($filterent['destination']['port']))?>
|
608 |
|
|
</td>
|
609 |
|
|
<td>
|
610 |
|
|
<?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])):?>
|
611 |
|
|
<?=htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr'])?>
|
612 |
|
|
<?php else: ?>
|
613 |
|
|
<?=htmlspecialchars(pprint_port($filterent['gateway']))?>
|
614 |
|
|
<?php endif; ?>
|
615 |
|
|
</td>
|
616 |
|
|
<td>
|
617 |
|
|
<?php
|
618 |
|
|
if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
|
619 |
|
|
$desc = $filterent['ackqueue'] ;
|
620 |
|
|
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>";
|
621 |
|
|
$desc = $filterent['defaultqueue'];
|
622 |
|
|
echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
|
623 |
|
|
} else if (isset($filterent['defaultqueue'])) {
|
624 |
|
|
$desc = $filterent['defaultqueue'];
|
625 |
|
|
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
|
626 |
67c2baf1
|
Phil Davis
|
} else {
|
627 |
c821a6cd
|
Stephen Beaver
|
echo gettext("none");
|
628 |
67c2baf1
|
Phil Davis
|
}
|
629 |
c821a6cd
|
Stephen Beaver
|
?>
|
630 |
|
|
</td>
|
631 |
|
|
<td>
|
632 |
995df6c3
|
Stephen Beaver
|
<?php if ($printicon) { ?>
|
633 |
bdfea2e7
|
Stephen Beaver
|
<i class="fa fa-<?=$image?> <?=$dispcolor?>" title="<?=$alttext;?>" alt="icon"></i>
|
634 |
995df6c3
|
Stephen Beaver
|
<?php } ?>
|
635 |
c821a6cd
|
Stephen Beaver
|
<?=$schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?> <?=$schedule_span_end;?>
|
636 |
|
|
</td>
|
637 |
45e849c1
|
Jared Dillard
|
<td class="bg-info">
|
638 |
c821a6cd
|
Stephen Beaver
|
<?=htmlspecialchars($filterent['descr']);?>
|
639 |
|
|
</td>
|
640 |
45e849c1
|
Jared Dillard
|
<td class="action-icons">
|
641 |
f25dac2d
|
Stephen Beaver
|
<!-- <?=(isset($filterent['disabled']) ? 'enable' : 'disable')?> -->
|
642 |
3193d853
|
Phil Davis
|
<a href="firewall_rules_edit.php?id=<?=$i;?>" class="fa fa-pencil" title="<?=gettext('Edit')?>"></a>
|
643 |
f25dac2d
|
Stephen Beaver
|
<a href="firewall_rules_edit.php?dup=<?=$i;?>" class="fa fa-clone" title="<?=gettext('Copy')?>"></a>
|
644 |
|
|
<?php if (isset($filterent['disabled'])) {
|
645 |
|
|
?>
|
646 |
|
|
<a href="?act=toggle&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>" class="fa fa-check-square-o" title="<?=gettext('Enable')?>"></a>
|
647 |
|
|
<?php } else {
|
648 |
|
|
?>
|
649 |
|
|
<a href="?act=toggle&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>" class="fa fa-ban" title="<?=gettext('Disable')?>"></a>
|
650 |
|
|
<?php }
|
651 |
|
|
?>
|
652 |
33f0b0d5
|
Stephen Beaver
|
<a href="?act=del&if=<?=htmlspecialchars($if);?>&id=<?=$i;?>" class="fa fa-trash" title="<?=gettext('Delete')?>"></a>
|
653 |
c821a6cd
|
Stephen Beaver
|
</td>
|
654 |
|
|
</tr>
|
655 |
|
|
<?php
|
656 |
6cb366de
|
Stephen Beaver
|
$nrules++;
|
657 |
c821a6cd
|
Stephen Beaver
|
endfor;
|
658 |
|
|
?>
|
659 |
|
|
</tbody>
|
660 |
|
|
</table>
|
661 |
|
|
</div>
|
662 |
|
|
</div>
|
663 |
3b2c83b8
|
Sjon Hortensius
|
|
664 |
|
|
<?php if ($nrules == 0): ?>
|
665 |
|
|
<div class="alert alert-warning" role="alert">
|
666 |
06966500
|
Sander van Leeuwen
|
<p>
|
667 |
3b2c83b8
|
Sjon Hortensius
|
<?php if ($_REQUEST['if'] == "FloatingRules"): ?>
|
668 |
|
|
<?=gettext("No floating rules are currently defined.");?>
|
669 |
|
|
<?php else: ?>
|
670 |
|
|
<?=gettext("No rules are currently defined for this interface");?><br />
|
671 |
|
|
<?=gettext("All incoming connections on this interface will be blocked until you add pass rules.");?>
|
672 |
|
|
<?php endif;?>
|
673 |
06966500
|
Sander van Leeuwen
|
<?=gettext("Click the button to add a new rule.");?>
|
674 |
|
|
</p>
|
675 |
3b2c83b8
|
Sjon Hortensius
|
</div>
|
676 |
|
|
<?php endif;?>
|
677 |
|
|
|
678 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
679 |
270de3df
|
Stephen Beaver
|
<a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>&after=-1" role="button" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the top of the list')?>">
|
680 |
|
|
<i class="fa fa-level-up icon-embed-btn"></i>
|
681 |
09415b9e
|
Stephen Beaver
|
<?=gettext("Add");?>
|
682 |
c821a6cd
|
Stephen Beaver
|
</a>
|
683 |
270de3df
|
Stephen Beaver
|
<a href="firewall_rules_edit.php?if=<?=htmlspecialchars($if);?>" role="button" class="btn btn-sm btn-success" title="<?=gettext('Add rule to the end of the list')?>">
|
684 |
|
|
<i class="fa fa-level-down icon-embed-btn"></i>
|
685 |
|
|
<?=gettext("Add");?>
|
686 |
|
|
</a>
|
687 |
|
|
<button name="del_x" type="submit" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected rules"); ?>" title="<?=gettext('Delete selected rules')?>">
|
688 |
9d5a20cf
|
heper
|
<i class="fa fa-trash icon-embed-btn"></i>
|
689 |
09415b9e
|
Stephen Beaver
|
<?=gettext("Delete"); ?>
|
690 |
|
|
</button>
|
691 |
c4b60a9a
|
Colin Fleming
|
<button type="submit" id="order-store" name="order-store" class="btn btn-sm btn-primary" value="store changes" disabled title="<?=gettext('Save rule order')?>">
|
692 |
9d5a20cf
|
heper
|
<i class="fa fa-save icon-embed-btn"></i>
|
693 |
09415b9e
|
Stephen Beaver
|
<?=gettext("Save")?>
|
694 |
|
|
</button>
|
695 |
c821a6cd
|
Stephen Beaver
|
</nav>
|
696 |
|
|
</form>
|
697 |
|
|
|
698 |
09415b9e
|
Stephen Beaver
|
<div id="infoblock">
|
699 |
270de3df
|
Stephen Beaver
|
<div class="alert alert-info clearfix" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><div class="pull-left">
|
700 |
|
|
<dl class="dl-horizontal responsive">
|
701 |
|
|
<!-- Legend -->
|
702 |
|
|
<dt><?=gettext('Legend')?></dt> <dd></dd>
|
703 |
29620ab5
|
Jared Dillard
|
<dt><i class="fa fa-check text-success"></i></dt> <dd><?=gettext("Pass");?></dd>
|
704 |
1b7379f9
|
Jared Dillard
|
<dt><i class="fa fa-filter"></i></dt> <dd><?=gettext("Match");?></dd>
|
705 |
29620ab5
|
Jared Dillard
|
<dt><i class="fa fa-times text-danger"></i></dt> <dd><?=gettext("Block");?></dd>
|
706 |
|
|
<dt><i class="fa fa-hand-stop-o text-warning"></i></dt> <dd><?=gettext("Reject");?></dd>
|
707 |
1b7379f9
|
Jared Dillard
|
<dt><i class="fa fa-tasks"></i></dt> <dd> <?=gettext("Log");?></dd>
|
708 |
7ea65674
|
Jared Dillard
|
<dt><i class="fa fa-cog"></i></dt> <dd> <?=gettext("Advanced filter");?></dd>
|
709 |
270de3df
|
Stephen Beaver
|
</dl>
|
710 |
|
|
|
711 |
824329d2
|
Stephen Beaver
|
<?php
|
712 |
67c2baf1
|
Phil Davis
|
if ("FloatingRules" != $if) {
|
713 |
270de3df
|
Stephen Beaver
|
print(gettext("Rules are evaluated on a first-match basis (i.e. " .
|
714 |
09415b9e
|
Stephen Beaver
|
"the action of the first rule to match a packet will be executed). ") . '<br />' .
|
715 |
|
|
gettext("This means that if you use block rules, you'll have to pay attention " .
|
716 |
|
|
"to the rule order. Everything that isn't explicitly passed is blocked " .
|
717 |
270de3df
|
Stephen Beaver
|
"by default. "));
|
718 |
67c2baf1
|
Phil Davis
|
} else {
|
719 |
270de3df
|
Stephen Beaver
|
print(gettext("Floating rules are evaluated on a first-match basis (i.e. " .
|
720 |
09415b9e
|
Stephen Beaver
|
"the action of the first rule to match a packet will be executed) only " .
|
721 |
04fd7017
|
Stephen Beaver
|
"if the 'quick' option is checked on a rule. Otherwise they will only match if no " .
|
722 |
09415b9e
|
Stephen Beaver
|
"other rules match. Pay close attention to the rule order and options " .
|
723 |
270de3df
|
Stephen Beaver
|
"chosen. If no rule here matches, the per-interface or default rules are used. "));
|
724 |
67c2baf1
|
Phil Davis
|
}
|
725 |
824329d2
|
Stephen Beaver
|
?>
|
726 |
270de3df
|
Stephen Beaver
|
</div>
|
727 |
09415b9e
|
Stephen Beaver
|
</div>
|
728 |
2f4323b5
|
Stephen Beaver
|
|
729 |
8fd9052f
|
Colin Fleming
|
<script type="text/javascript">
|
730 |
|
|
//<![CDATA[
|
731 |
ea5665c7
|
Sjon Hortensius
|
events.push(function() {
|
732 |
2f4323b5
|
Stephen Beaver
|
|
733 |
ea5665c7
|
Sjon Hortensius
|
// Make rules sortable
|
734 |
|
|
$('table tbody.user-entries').sortable({
|
735 |
|
|
cursor: 'grabbing',
|
736 |
|
|
update: function(event, ui) {
|
737 |
|
|
$('#order-store').removeAttr('disabled');
|
738 |
|
|
}
|
739 |
|
|
});
|
740 |
|
|
|
741 |
6cb366de
|
Stephen Beaver
|
// Check all of the rule checkboxes so that their values are posted
|
742 |
|
|
$('#order-store').click(function () {
|
743 |
|
|
$('[id^=frc]').prop('checked', true);
|
744 |
|
|
});
|
745 |
65a0e193
|
Stephen Beaver
|
});
|
746 |
8fd9052f
|
Colin Fleming
|
//]]>
|
747 |
ea5665c7
|
Sjon Hortensius
|
</script>
|
748 |
824329d2
|
Stephen Beaver
|
|
749 |
c9d46a8e
|
Renato Botelho
|
<?php include("foot.inc");?>
|