1 |
5ba18897
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
bdb7d6e7
|
Scott Ullrich
|
firewall_rules_edit.php
|
5 |
e4cabb75
|
Scott Ullrich
|
part of pfSense (http://www.pfsense.com)
|
6 |
|
|
Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
|
7 |
5ba18897
|
Scott Ullrich
|
|
8 |
e4cabb75
|
Scott Ullrich
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
9 |
bdb7d6e7
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10 |
|
|
All rights reserved.
|
11 |
5ba18897
|
Scott Ullrich
|
|
12 |
bdb7d6e7
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
13 |
|
|
modification, are permitted provided that the following conditions are met:
|
14 |
5ba18897
|
Scott Ullrich
|
|
15 |
bdb7d6e7
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
this list of conditions and the following disclaimer.
|
17 |
5ba18897
|
Scott Ullrich
|
|
18 |
bdb7d6e7
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
19 |
|
|
notice, this list of conditions and the following disclaimer in the
|
20 |
|
|
documentation and/or other materials provided with the distribution.
|
21 |
5ba18897
|
Scott Ullrich
|
|
22 |
bdb7d6e7
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
32 |
5b237745
|
Scott Ullrich
|
*/
|
33 |
7ac5a4cb
|
Scott Ullrich
|
/*
|
34 |
|
|
pfSense_MODULE: filter
|
35 |
|
|
*/
|
36 |
5b237745
|
Scott Ullrich
|
|
37 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
38 |
|
|
##|*IDENT=page-firewall-rules-edit
|
39 |
|
|
##|*NAME=Firewall: Rules: Edit page
|
40 |
|
|
##|*DESCR=Allow access to the 'Firewall: Rules: Edit' page.
|
41 |
|
|
##|*MATCH=firewall_rules_edit.php*
|
42 |
|
|
##|-PRIV
|
43 |
|
|
|
44 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
45 |
1a03cf69
|
Scott Ullrich
|
require("filter.inc");
|
46 |
|
|
require("shaper.inc");
|
47 |
5b237745
|
Scott Ullrich
|
|
48 |
1e578a7f
|
Ermal Lu?i
|
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
|
49 |
3331a640
|
Ermal Lu?i
|
$ifdisp = get_configured_interface_with_descr();
|
50 |
679d21bb
|
Ermal Lu?i
|
foreach ($ifdisp as $kif => $kdescr) {
|
51 |
3331a640
|
Ermal Lu?i
|
$specialsrcdst[] = "{$kif}";
|
52 |
|
|
$specialsrcdst[] = "{$kif}ip";
|
53 |
679d21bb
|
Ermal Lu?i
|
}
|
54 |
5b237745
|
Scott Ullrich
|
|
55 |
|
|
if (!is_array($config['filter']['rule'])) {
|
56 |
|
|
$config['filter']['rule'] = array();
|
57 |
|
|
}
|
58 |
|
|
filter_rules_sort();
|
59 |
|
|
$a_filter = &$config['filter']['rule'];
|
60 |
|
|
|
61 |
|
|
$id = $_GET['id'];
|
62 |
|
|
if (is_numeric($_POST['id']))
|
63 |
|
|
$id = $_POST['id'];
|
64 |
5ba18897
|
Scott Ullrich
|
|
65 |
5b237745
|
Scott Ullrich
|
$after = $_GET['after'];
|
66 |
|
|
|
67 |
|
|
if (isset($_POST['after']))
|
68 |
|
|
$after = $_POST['after'];
|
69 |
|
|
|
70 |
|
|
if (isset($_GET['dup'])) {
|
71 |
|
|
$id = $_GET['dup'];
|
72 |
|
|
$after = $_GET['dup'];
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
if (isset($id) && $a_filter[$id]) {
|
76 |
|
|
$pconfig['interface'] = $a_filter[$id]['interface'];
|
77 |
5ba18897
|
Scott Ullrich
|
|
78 |
b9e28d57
|
unknown
|
if (isset($a_filter[$id]['id']))
|
79 |
|
|
$pconfig['ruleid'] = $a_filter[$id]['id'];
|
80 |
|
|
|
81 |
5b237745
|
Scott Ullrich
|
if (!isset($a_filter[$id]['type']))
|
82 |
|
|
$pconfig['type'] = "pass";
|
83 |
|
|
else
|
84 |
|
|
$pconfig['type'] = $a_filter[$id]['type'];
|
85 |
5ba18897
|
Scott Ullrich
|
|
86 |
4633edc2
|
Ermal Luçi
|
if (isset($a_filter[$id]['floating']) || $if == "FloatingRules") {
|
87 |
661aed33
|
Ermal Luçi
|
$pconfig['floating'] = $a_filter[$id]['floating'];
|
88 |
|
|
if (isset($a_filter[$id]['interface']) && $a_filter[$id]['interface'] <> "")
|
89 |
|
|
$pconfig['interface'] = $a_filter[$id]['interface'];
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
if (isset($a_filter['floating']))
|
93 |
|
|
$pconfig['floating'] = "yes";
|
94 |
|
|
|
95 |
|
|
if (isset($a_filter[$id]['direction']))
|
96 |
|
|
$pconfig['direction'] = $a_filter[$id]['direction'];
|
97 |
|
|
|
98 |
5b237745
|
Scott Ullrich
|
if (isset($a_filter[$id]['protocol']))
|
99 |
|
|
$pconfig['proto'] = $a_filter[$id]['protocol'];
|
100 |
|
|
else
|
101 |
|
|
$pconfig['proto'] = "any";
|
102 |
5ba18897
|
Scott Ullrich
|
|
103 |
5b237745
|
Scott Ullrich
|
if ($a_filter[$id]['protocol'] == "icmp")
|
104 |
|
|
$pconfig['icmptype'] = $a_filter[$id]['icmptype'];
|
105 |
5ba18897
|
Scott Ullrich
|
|
106 |
5b237745
|
Scott Ullrich
|
address_to_pconfig($a_filter[$id]['source'], $pconfig['src'],
|
107 |
|
|
$pconfig['srcmask'], $pconfig['srcnot'],
|
108 |
|
|
$pconfig['srcbeginport'], $pconfig['srcendport']);
|
109 |
5ba18897
|
Scott Ullrich
|
|
110 |
8be60f21
|
Scott Ullrich
|
if($a_filter[$id]['os'] <> "")
|
111 |
|
|
$pconfig['os'] = $a_filter[$id]['os'];
|
112 |
e33c8694
|
Bill Marquette
|
|
113 |
5b237745
|
Scott Ullrich
|
address_to_pconfig($a_filter[$id]['destination'], $pconfig['dst'],
|
114 |
|
|
$pconfig['dstmask'], $pconfig['dstnot'],
|
115 |
|
|
$pconfig['dstbeginport'], $pconfig['dstendport']);
|
116 |
|
|
|
117 |
c5fc1b2e
|
Ermal Luçi
|
if ($a_filter[$id]['dscp'] <> "")
|
118 |
|
|
$pconfig['dscp'] = $a_filter[$id]['dscp'];
|
119 |
|
|
|
120 |
5b237745
|
Scott Ullrich
|
$pconfig['disabled'] = isset($a_filter[$id]['disabled']);
|
121 |
|
|
$pconfig['log'] = isset($a_filter[$id]['log']);
|
122 |
|
|
$pconfig['descr'] = $a_filter[$id]['descr'];
|
123 |
8c84fe43
|
Scott Ullrich
|
|
124 |
5c1f5584
|
Ermal Luçi
|
if (isset($a_filter[$id]['tag']) && $a_filter[$id]['tag'] <> "")
|
125 |
661aed33
|
Ermal Luçi
|
$pconfig['tag'] = $a_filter[$id]['tag'];
|
126 |
b6494651
|
Ermal Lu?i
|
if (isset($a_filter[$id]['tagged']) && $a_filter[$id]['tagged'] <> "")
|
127 |
661aed33
|
Ermal Luçi
|
$pconfig['tagged'] = $a_filter[$id]['tagged'];
|
128 |
|
|
if (isset($a_filter[$id]['quick']) && $a_filter[$id]['quick'])
|
129 |
|
|
$pconfig['quick'] = $a_filter[$id]['quick'];
|
130 |
775ccea3
|
Ermal Luci
|
if (isset($a_filter[$id]['allowopts']))
|
131 |
|
|
$pconfig['allowopts'] = true;
|
132 |
19757916
|
Ermal Lu?i
|
if (isset($a_filter[$id]['disablereplyto']))
|
133 |
|
|
$pconfig['disablereplyto'] = true;
|
134 |
661aed33
|
Ermal Luçi
|
|
135 |
ed08ef3e
|
Scott Ullrich
|
/* advanced */
|
136 |
a56b2fa0
|
pierrepomes
|
$pconfig['max'] = $a_filter[$id]['max'];
|
137 |
f1c49ff4
|
Scott Ullrich
|
$pconfig['max-src-nodes'] = $a_filter[$id]['max-src-nodes'];
|
138 |
26dd6a54
|
pierrepomes
|
$pconfig['max-src-conn'] = $a_filter[$id]['max-src-conn'];
|
139 |
f1c49ff4
|
Scott Ullrich
|
$pconfig['max-src-states'] = $a_filter[$id]['max-src-states'];
|
140 |
|
|
$pconfig['statetype'] = $a_filter[$id]['statetype'];
|
141 |
5ba18897
|
Scott Ullrich
|
$pconfig['statetimeout'] = $a_filter[$id]['statetimeout'];
|
142 |
8c84fe43
|
Scott Ullrich
|
|
143 |
f1c49ff4
|
Scott Ullrich
|
/* advanced - nosync */
|
144 |
8c84fe43
|
Scott Ullrich
|
$pconfig['nosync'] = isset($a_filter[$id]['nosync']);
|
145 |
10f21e70
|
Scott Ullrich
|
|
146 |
ed08ef3e
|
Scott Ullrich
|
/* advanced - new connection per second banning*/
|
147 |
|
|
$pconfig['max-src-conn-rate'] = $a_filter[$id]['max-src-conn-rate'];
|
148 |
|
|
$pconfig['max-src-conn-rates'] = $a_filter[$id]['max-src-conn-rates'];
|
149 |
5ba18897
|
Scott Ullrich
|
|
150 |
e5980370
|
Scott Ullrich
|
/* Multi-WAN next-hop support */
|
151 |
c98ddde2
|
Bill Marquette
|
$pconfig['gateway'] = $a_filter[$id]['gateway'];
|
152 |
615b27bc
|
Scott Dale
|
|
153 |
197bfe96
|
Ermal Luçi
|
/* Shaper support */
|
154 |
|
|
$pconfig['defaultqueue'] = $a_filter[$id]['defaultqueue'];
|
155 |
|
|
$pconfig['ackqueue'] = $a_filter[$id]['ackqueue'];
|
156 |
a5fd67e1
|
Ermal Luçi
|
$pconfig['dnpipe'] = $a_filter[$id]['dnpipe'];
|
157 |
|
|
$pconfig['pdnpipe'] = $a_filter[$id]['pdnpipe'];
|
158 |
7e50413c
|
Ermal Luçi
|
$pconfig['l7container'] = $a_filter[$id]['l7container'];
|
159 |
197bfe96
|
Ermal Luçi
|
|
160 |
615b27bc
|
Scott Dale
|
//schedule support
|
161 |
|
|
$pconfig['sched'] = $a_filter[$id]['sched'];
|
162 |
9b16b834
|
Ermal Lu?i
|
$pconfig['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
|
163 |
c98ddde2
|
Bill Marquette
|
|
164 |
5b237745
|
Scott Ullrich
|
} else {
|
165 |
|
|
/* defaults */
|
166 |
a23d7248
|
Scott Ullrich
|
if ($_GET['if'])
|
167 |
|
|
$pconfig['interface'] = $_GET['if'];
|
168 |
5b237745
|
Scott Ullrich
|
$pconfig['type'] = "pass";
|
169 |
|
|
$pconfig['src'] = "any";
|
170 |
|
|
$pconfig['dst'] = "any";
|
171 |
|
|
}
|
172 |
72320b88
|
Ermal Luçi
|
/* Allow the FlotingRules to work */
|
173 |
|
|
$if = $pconfig['interface'];
|
174 |
5b237745
|
Scott Ullrich
|
|
175 |
|
|
if (isset($_GET['dup']))
|
176 |
|
|
unset($id);
|
177 |
|
|
|
178 |
|
|
if ($_POST) {
|
179 |
87f0be87
|
Chris Buechler
|
|
180 |
|
|
if ($_POST['type'] == "reject" && $_POST['proto'] <> "tcp")
|
181 |
|
|
$input_errors[] = "Reject type rules only works when the protocol is set to TCP.";
|
182 |
28f9e493
|
Scott Ullrich
|
|
183 |
5b237745
|
Scott Ullrich
|
if (($_POST['proto'] != "tcp") && ($_POST['proto'] != "udp") && ($_POST['proto'] != "tcp/udp")) {
|
184 |
|
|
$_POST['srcbeginport'] = 0;
|
185 |
|
|
$_POST['srcendport'] = 0;
|
186 |
|
|
$_POST['dstbeginport'] = 0;
|
187 |
|
|
$_POST['dstendport'] = 0;
|
188 |
|
|
} else {
|
189 |
5ba18897
|
Scott Ullrich
|
|
190 |
5b237745
|
Scott Ullrich
|
if ($_POST['srcbeginport_cust'] && !$_POST['srcbeginport'])
|
191 |
|
|
$_POST['srcbeginport'] = $_POST['srcbeginport_cust'];
|
192 |
|
|
if ($_POST['srcendport_cust'] && !$_POST['srcendport'])
|
193 |
|
|
$_POST['srcendport'] = $_POST['srcendport_cust'];
|
194 |
5ba18897
|
Scott Ullrich
|
|
195 |
5b237745
|
Scott Ullrich
|
if ($_POST['srcbeginport'] == "any") {
|
196 |
|
|
$_POST['srcbeginport'] = 0;
|
197 |
|
|
$_POST['srcendport'] = 0;
|
198 |
5ba18897
|
Scott Ullrich
|
} else {
|
199 |
5b237745
|
Scott Ullrich
|
if (!$_POST['srcendport'])
|
200 |
|
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
201 |
|
|
}
|
202 |
|
|
if ($_POST['srcendport'] == "any")
|
203 |
|
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
204 |
5ba18897
|
Scott Ullrich
|
|
205 |
5b237745
|
Scott Ullrich
|
if ($_POST['dstbeginport_cust'] && !$_POST['dstbeginport'])
|
206 |
|
|
$_POST['dstbeginport'] = $_POST['dstbeginport_cust'];
|
207 |
|
|
if ($_POST['dstendport_cust'] && !$_POST['dstendport'])
|
208 |
|
|
$_POST['dstendport'] = $_POST['dstendport_cust'];
|
209 |
5ba18897
|
Scott Ullrich
|
|
210 |
5b237745
|
Scott Ullrich
|
if ($_POST['dstbeginport'] == "any") {
|
211 |
|
|
$_POST['dstbeginport'] = 0;
|
212 |
|
|
$_POST['dstendport'] = 0;
|
213 |
5ba18897
|
Scott Ullrich
|
} else {
|
214 |
5b237745
|
Scott Ullrich
|
if (!$_POST['dstendport'])
|
215 |
|
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
216 |
|
|
}
|
217 |
|
|
if ($_POST['dstendport'] == "any")
|
218 |
5ba18897
|
Scott Ullrich
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
219 |
5b237745
|
Scott Ullrich
|
}
|
220 |
5ba18897
|
Scott Ullrich
|
|
221 |
5b237745
|
Scott Ullrich
|
if (is_specialnet($_POST['srctype'])) {
|
222 |
|
|
$_POST['src'] = $_POST['srctype'];
|
223 |
|
|
$_POST['srcmask'] = 0;
|
224 |
|
|
} else if ($_POST['srctype'] == "single") {
|
225 |
|
|
$_POST['srcmask'] = 32;
|
226 |
|
|
}
|
227 |
|
|
if (is_specialnet($_POST['dsttype'])) {
|
228 |
|
|
$_POST['dst'] = $_POST['dsttype'];
|
229 |
|
|
$_POST['dstmask'] = 0;
|
230 |
|
|
} else if ($_POST['dsttype'] == "single") {
|
231 |
|
|
$_POST['dstmask'] = 32;
|
232 |
|
|
}
|
233 |
5ba18897
|
Scott Ullrich
|
|
234 |
5b237745
|
Scott Ullrich
|
unset($input_errors);
|
235 |
|
|
$pconfig = $_POST;
|
236 |
|
|
|
237 |
ef2a753c
|
Scott Ullrich
|
/* run through $_POST items encoding HTML entties so that the user
|
238 |
|
|
* cannot think he is slick and perform a XSS attack on the unwilling
|
239 |
|
|
*/
|
240 |
21eff66f
|
Scott Ullrich
|
foreach ($_POST as $key => $value) {
|
241 |
|
|
$temp = $value;
|
242 |
661aed33
|
Ermal Luçi
|
if (isset($_POST['floating']) && $key == "interface")
|
243 |
|
|
continue;
|
244 |
21eff66f
|
Scott Ullrich
|
$newpost = htmlentities($temp);
|
245 |
5157927f
|
Scott Ullrich
|
if($newpost <> $temp)
|
246 |
|
|
$input_errors[] = "Invalid characters detected ($temp). Please remove invalid characters and save again.";
|
247 |
ef2a753c
|
Scott Ullrich
|
}
|
248 |
|
|
|
249 |
5b237745
|
Scott Ullrich
|
/* input validation */
|
250 |
473d0ff0
|
pierrepomes
|
$reqdfields = explode(" ", "type proto src");
|
251 |
9b16b834
|
Ermal Lu?i
|
if ( isset($a_filter[$id]['associated-rule-id'])===false )
|
252 |
473d0ff0
|
pierrepomes
|
$redqfields[] = "dst";
|
253 |
|
|
$reqdfieldsn = explode(",", "Type,Protocol,Source");
|
254 |
9b16b834
|
Ermal Lu?i
|
if ( isset($a_filter[$id]['associated-rule-id'])===false )
|
255 |
473d0ff0
|
pierrepomes
|
$reqdfieldsn[] = "Destination";
|
256 |
5b237745
|
Scott Ullrich
|
|
257 |
452ade89
|
Bill Marquette
|
if($_POST['statetype'] == "modulate state" or $_POST['statetype'] == "synproxy state") {
|
258 |
c22767b1
|
Bill Marquette
|
if( $_POST['proto'] != "tcp" )
|
259 |
|
|
$input_errors[] = "{$_POST['statetype']} is only valid with protocol tcp.";
|
260 |
452ade89
|
Bill Marquette
|
if(($_POST['statetype'] == "synproxy state") && ($_POST['gateway'] != ""))
|
261 |
|
|
$input_errors[] = "{$_POST['statetype']} is only valid if the gateway is set to 'default'.";
|
262 |
|
|
}
|
263 |
10f7933f
|
Chris Buechler
|
|
264 |
5b237745
|
Scott Ullrich
|
if (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single"))) {
|
265 |
|
|
$reqdfields[] = "srcmask";
|
266 |
|
|
$reqdfieldsn[] = "Source bit count";
|
267 |
|
|
}
|
268 |
9b16b834
|
Ermal Lu?i
|
if ( isset($a_filter[$id]['associated-rule-id'])===false &&
|
269 |
473d0ff0
|
pierrepomes
|
(!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single"))) ) {
|
270 |
5b237745
|
Scott Ullrich
|
$reqdfields[] = "dstmask";
|
271 |
|
|
$reqdfieldsn[] = "Destination bit count";
|
272 |
|
|
}
|
273 |
5ba18897
|
Scott Ullrich
|
|
274 |
5b237745
|
Scott Ullrich
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
275 |
5ba18897
|
Scott Ullrich
|
|
276 |
5b237745
|
Scott Ullrich
|
if (!$_POST['srcbeginport']) {
|
277 |
|
|
$_POST['srcbeginport'] = 0;
|
278 |
|
|
$_POST['srcendport'] = 0;
|
279 |
|
|
}
|
280 |
|
|
if (!$_POST['dstbeginport']) {
|
281 |
|
|
$_POST['dstbeginport'] = 0;
|
282 |
|
|
$_POST['dstendport'] = 0;
|
283 |
|
|
}
|
284 |
5ba18897
|
Scott Ullrich
|
|
285 |
9b45f821
|
Ermal Lu?i
|
if ($_POST['srcbeginport'] && !is_portoralias($_POST['srcbeginport']))
|
286 |
|
|
$input_errors[] = "{$_POST['srcbeginport']} is not a valid start source port. It must be a port alias or integer between 1 and 65535.";
|
287 |
|
|
if ($_POST['srcendport'] && !is_portoralias($_POST['srcendport']))
|
288 |
|
|
$input_errors[] = "{$_POST['srcendport']} is not a valid end source port. It must be a port alias or integer between 1 and 65535.";
|
289 |
|
|
if ($_POST['dstbeginport'] && !is_portoralias($_POST['dstbeginport']))
|
290 |
|
|
$input_errors[] = "{$_POST['dstbeginport']} is not a valid start destination port. It must be a port alias or integer between 1 and 65535.";
|
291 |
|
|
if ($_POST['dstendport'] && !is_portoralias($_POST['dstendport']))
|
292 |
|
|
$input_errors[] = "{$_POST['dstendport']} is not a valid end destination port. It must be a port alias or integer between 1 and 65535.";
|
293 |
5ba18897
|
Scott Ullrich
|
|
294 |
0e5ddcd9
|
Scott Ullrich
|
/* if user enters an alias and selects "network" then disallow. */
|
295 |
|
|
if($_POST['srctype'] == "network") {
|
296 |
|
|
if(is_alias($_POST['src']))
|
297 |
|
|
$input_errors[] = "You must specify single host or alias for alias entries.";
|
298 |
|
|
}
|
299 |
|
|
if($_POST['dsttype'] == "network") {
|
300 |
|
|
if(is_alias($_POST['dst']))
|
301 |
|
|
$input_errors[] = "You must specify single host or alias for alias entries.";
|
302 |
|
|
}
|
303 |
|
|
|
304 |
5b237745
|
Scott Ullrich
|
if (!is_specialnet($_POST['srctype'])) {
|
305 |
1e578a7f
|
Ermal Lu?i
|
if (($_POST['src'] && !is_ipaddroralias($_POST['src']))) {
|
306 |
9b45f821
|
Ermal Lu?i
|
$input_errors[] = "{$_POST['src']} is not a valid source IP address or alias.";
|
307 |
5b237745
|
Scott Ullrich
|
}
|
308 |
|
|
if (($_POST['srcmask'] && !is_numericint($_POST['srcmask']))) {
|
309 |
|
|
$input_errors[] = "A valid source bit count must be specified.";
|
310 |
|
|
}
|
311 |
|
|
}
|
312 |
|
|
if (!is_specialnet($_POST['dsttype'])) {
|
313 |
1e578a7f
|
Ermal Lu?i
|
if (($_POST['dst'] && !is_ipaddroralias($_POST['dst']))) {
|
314 |
9b45f821
|
Ermal Lu?i
|
$input_errors[] = "{$_POST['dst']} is not a valid destination IP address or alias.";
|
315 |
5b237745
|
Scott Ullrich
|
}
|
316 |
|
|
if (($_POST['dstmask'] && !is_numericint($_POST['dstmask']))) {
|
317 |
|
|
$input_errors[] = "A valid destination bit count must be specified.";
|
318 |
|
|
}
|
319 |
|
|
}
|
320 |
5ba18897
|
Scott Ullrich
|
|
321 |
5b237745
|
Scott Ullrich
|
if ($_POST['srcbeginport'] > $_POST['srcendport']) {
|
322 |
|
|
/* swap */
|
323 |
|
|
$tmp = $_POST['srcendport'];
|
324 |
|
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
325 |
|
|
$_POST['srcbeginport'] = $tmp;
|
326 |
|
|
}
|
327 |
|
|
if ($_POST['dstbeginport'] > $_POST['dstendport']) {
|
328 |
|
|
/* swap */
|
329 |
|
|
$tmp = $_POST['dstendport'];
|
330 |
|
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
331 |
|
|
$_POST['dstbeginport'] = $tmp;
|
332 |
|
|
}
|
333 |
e33c8694
|
Bill Marquette
|
if ($_POST['os'])
|
334 |
|
|
if( $_POST['proto'] != "tcp" )
|
335 |
|
|
$input_errors[] = "OS detection is only valid with protocol tcp.";
|
336 |
5b237745
|
Scott Ullrich
|
|
337 |
197bfe96
|
Ermal Luçi
|
if ($_POST['ackqueue'] && $_POST['ackqueue'] != "none") {
|
338 |
|
|
if ($_POST['defaultqueue'] == "none" )
|
339 |
|
|
$input_errors[] = "You have to select a queue when you select an acknowledge queue too.";
|
340 |
|
|
else if ($_POST['ackqueue'] == $_POST['defaultqueue'])
|
341 |
aa8cdf52
|
Scott Ullrich
|
$input_errors[] = "Acknowledge queue and Queue cannot be the same.";
|
342 |
197bfe96
|
Ermal Luçi
|
}
|
343 |
a5fd67e1
|
Ermal Luçi
|
if ($_POST['pdnpipe'] && $_POST['pdnpipe'] != "none") {
|
344 |
|
|
if ($_POST['dnpipe'] == "none" )
|
345 |
|
|
$input_errors[] = "You must select a queue for the In direction before selecting one for Out too.";
|
346 |
|
|
else if ($_POST['pdnpipe'] == $_POST['dnpipe'])
|
347 |
|
|
$input_errors[] = "In and Out Queue cannot be the same.";
|
348 |
|
|
else if ($pdnpipe[0] == "?" && $dnpipe[0] <> "?")
|
349 |
|
|
$input_errors[] = "You cannot select one queue and one virtual interface for IN and Out. both must be from the same type.";
|
350 |
|
|
else if ($dnpipe[0] == "?" && $pdnpipe[0] <> "?")
|
351 |
|
|
$input_errors[] = "You cannot select one queue and one virtual interface for IN and Out. both must be from the same type.";
|
352 |
|
|
}
|
353 |
b9e28d57
|
unknown
|
if( !empty($_POST['ruleid']) && !ctype_digit($_POST['ruleid']))
|
354 |
|
|
$input_errors[] = 'ID must be an integer';
|
355 |
7e50413c
|
Ermal Luçi
|
if($_POST['l7container'] && $_POST['l7container'] != "none") {
|
356 |
|
|
if(!($_POST['proto'] == "tcp" || $_POST['proto'] == "udp" || $_POST['proto'] == "tcp/udp"))
|
357 |
8b69a3e1
|
Chris Buechler
|
$input_errors[] = "You can only select a layer7 container for TCP and/or UDP protocols";
|
358 |
3b184ca5
|
Ermal Lu?i
|
if ($_POST['type'] <> "pass")
|
359 |
|
|
$input_errors[] = "You can only select a layer7 container for Pass type rules.";
|
360 |
7e50413c
|
Ermal Luçi
|
}
|
361 |
197bfe96
|
Ermal Luçi
|
|
362 |
5b237745
|
Scott Ullrich
|
if (!$input_errors) {
|
363 |
|
|
$filterent = array();
|
364 |
b9e28d57
|
unknown
|
$filterent['id'] = $_POST['ruleid']>0?$_POST['ruleid']:'';
|
365 |
5b237745
|
Scott Ullrich
|
$filterent['type'] = $_POST['type'];
|
366 |
661aed33
|
Ermal Luçi
|
if (isset($_POST['interface'] ))
|
367 |
|
|
$filterent['interface'] = $_POST['interface'];
|
368 |
|
|
|
369 |
|
|
if ($if == "FloatingRules" || isset($_POST['floating'])) {
|
370 |
|
|
if (isset($_POST['tag']))
|
371 |
|
|
$filterent['tag'] = $_POST['tag'];
|
372 |
|
|
if (isset($_POST['tagged']))
|
373 |
f1602cc4
|
sullrich
|
$filterent['tagged'] = $_POST['tagged'];
|
374 |
661aed33
|
Ermal Luçi
|
$filterent['direction'] = $_POST['direction'];
|
375 |
|
|
if (isset($_POST['quick']) && $_POST['quick'] <> "")
|
376 |
|
|
$filterent['quick'] = $_POST['quick'];
|
377 |
|
|
$filterent['floating'] = "yes";
|
378 |
|
|
if (isset($_POST['interface']) && count($_POST['interface']) > 0) {
|
379 |
f1602cc4
|
sullrich
|
$filterent['interface'] = implode(",", $_POST['interface']);
|
380 |
661aed33
|
Ermal Luçi
|
}
|
381 |
|
|
}
|
382 |
d59874c1
|
Scott Ullrich
|
|
383 |
bdb7d6e7
|
Scott Ullrich
|
/* Advanced options */
|
384 |
775ccea3
|
Ermal Luci
|
if ($_POST['allowopts'] == "yes")
|
385 |
|
|
$filterent['allowopts'] = true;
|
386 |
|
|
else
|
387 |
|
|
unset($filterent['allowopts']);
|
388 |
19757916
|
Ermal Lu?i
|
if ($_POST['disablereplyto'] == "yes")
|
389 |
|
|
$filterent['disablereplyto'] = true;
|
390 |
|
|
else
|
391 |
|
|
unset($filterent['disablereplyto']);
|
392 |
a56b2fa0
|
pierrepomes
|
$filterent['max'] = $_POST['max'];
|
393 |
bdb7d6e7
|
Scott Ullrich
|
$filterent['max-src-nodes'] = $_POST['max-src-nodes'];
|
394 |
26dd6a54
|
pierrepomes
|
$filterent['max-src-conn'] = $_POST['max-src-conn'];
|
395 |
bdb7d6e7
|
Scott Ullrich
|
$filterent['max-src-states'] = $_POST['max-src-states'];
|
396 |
5ba18897
|
Scott Ullrich
|
$filterent['statetimeout'] = $_POST['statetimeout'];
|
397 |
fa9af164
|
Scott Ullrich
|
$filterent['statetype'] = $_POST['statetype'];
|
398 |
e33c8694
|
Bill Marquette
|
$filterent['os'] = $_POST['os'];
|
399 |
10f21e70
|
Scott Ullrich
|
|
400 |
|
|
/* Nosync directive - do not xmlrpc sync this item */
|
401 |
8c84fe43
|
Scott Ullrich
|
if($_POST['nosync'] <> "")
|
402 |
10f21e70
|
Scott Ullrich
|
$filterent['nosync'] = true;
|
403 |
|
|
else
|
404 |
|
|
unset($filterent['nosync']);
|
405 |
|
|
|
406 |
3f00c1dc
|
Scott Ullrich
|
/* unless both values are provided, unset the values - ticket #650 */
|
407 |
|
|
if($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] <> "") {
|
408 |
|
|
$filterent['max-src-conn-rate'] = $_POST['max-src-conn-rate'];
|
409 |
|
|
$filterent['max-src-conn-rates'] = $_POST['max-src-conn-rates'];
|
410 |
|
|
} else {
|
411 |
|
|
unset($filterent['max-src-conn-rate']);
|
412 |
|
|
unset($filterent['max-src-conn-rates']);
|
413 |
|
|
}
|
414 |
5ba18897
|
Scott Ullrich
|
|
415 |
5b237745
|
Scott Ullrich
|
if ($_POST['proto'] != "any")
|
416 |
|
|
$filterent['protocol'] = $_POST['proto'];
|
417 |
|
|
else
|
418 |
|
|
unset($filterent['protocol']);
|
419 |
5ba18897
|
Scott Ullrich
|
|
420 |
5b237745
|
Scott Ullrich
|
if ($_POST['proto'] == "icmp" && $_POST['icmptype'])
|
421 |
|
|
$filterent['icmptype'] = $_POST['icmptype'];
|
422 |
|
|
else
|
423 |
|
|
unset($filterent['icmptype']);
|
424 |
5ba18897
|
Scott Ullrich
|
|
425 |
5b237745
|
Scott Ullrich
|
pconfig_to_address($filterent['source'], $_POST['src'],
|
426 |
|
|
$_POST['srcmask'], $_POST['srcnot'],
|
427 |
|
|
$_POST['srcbeginport'], $_POST['srcendport']);
|
428 |
5ba18897
|
Scott Ullrich
|
|
429 |
5b237745
|
Scott Ullrich
|
pconfig_to_address($filterent['destination'], $_POST['dst'],
|
430 |
|
|
$_POST['dstmask'], $_POST['dstnot'],
|
431 |
|
|
$_POST['dstbeginport'], $_POST['dstendport']);
|
432 |
5ba18897
|
Scott Ullrich
|
|
433 |
f1602cc4
|
sullrich
|
if ($_POST['disabled'])
|
434 |
|
|
$filterent['disabled'] = true;
|
435 |
|
|
else
|
436 |
|
|
unset($filterent['disabled']);
|
437 |
|
|
|
438 |
c5fc1b2e
|
Ermal Luçi
|
if ($_POST['dscp'])
|
439 |
|
|
$filterent['dscp'] = $_POST['dscp'];
|
440 |
|
|
|
441 |
f1602cc4
|
sullrich
|
if ($_POST['log'])
|
442 |
|
|
$filterent['log'] = true;
|
443 |
|
|
else
|
444 |
|
|
unset($filterent['log']);
|
445 |
c68fc1e7
|
Bill Marquette
|
strncpy($filterent['descr'], $_POST['descr'], 52);
|
446 |
5ba18897
|
Scott Ullrich
|
|
447 |
c98ddde2
|
Bill Marquette
|
if ($_POST['gateway'] != "") {
|
448 |
|
|
$filterent['gateway'] = $_POST['gateway'];
|
449 |
|
|
}
|
450 |
197bfe96
|
Ermal Luçi
|
|
451 |
|
|
if (isset($_POST['defaultqueue']) && $_POST['defaultqueue'] != "none") {
|
452 |
|
|
$filterent['defaultqueue'] = $_POST['defaultqueue'];
|
453 |
|
|
if (isset($_POST['ackqueue']) && $_POST['ackqueue'] != "none")
|
454 |
|
|
$filterent['ackqueue'] = $_POST['ackqueue'];
|
455 |
|
|
}
|
456 |
c98ddde2
|
Bill Marquette
|
|
457 |
a5fd67e1
|
Ermal Luçi
|
if (isset($_POST['dnpipe']) && $_POST['dnpipe'] != "none") {
|
458 |
|
|
$filterent['dnpipe'] = $_POST['dnpipe'];
|
459 |
|
|
if (isset($_POST['pdnpipe']) && $_POST['pdnpipe'] != "none")
|
460 |
|
|
$filterent['pdnpipe'] = $_POST['pdnpipe'];
|
461 |
|
|
}
|
462 |
|
|
|
463 |
7e50413c
|
Ermal Luçi
|
if (isset($_POST['l7container']) && $_POST['l7container'] != "none") {
|
464 |
|
|
$filterent['l7container'] = $_POST['l7container'];
|
465 |
|
|
}
|
466 |
|
|
|
467 |
615b27bc
|
Scott Dale
|
if ($_POST['sched'] != "") {
|
468 |
|
|
$filterent['sched'] = $_POST['sched'];
|
469 |
|
|
}
|
470 |
|
|
|
471 |
473d0ff0
|
pierrepomes
|
// If we have an associated nat rule, make sure the destination doesn't change
|
472 |
9b16b834
|
Ermal Lu?i
|
if( isset($a_filter[$id]['associated-rule-id']) ) {
|
473 |
473d0ff0
|
pierrepomes
|
$filterent['destination'] = $a_filter[$id]['destination'];
|
474 |
9b16b834
|
Ermal Lu?i
|
$filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
|
475 |
473d0ff0
|
pierrepomes
|
}
|
476 |
|
|
|
477 |
5b237745
|
Scott Ullrich
|
if (isset($id) && $a_filter[$id])
|
478 |
|
|
$a_filter[$id] = $filterent;
|
479 |
|
|
else {
|
480 |
|
|
if (is_numeric($after))
|
481 |
|
|
array_splice($a_filter, $after+1, 0, array($filterent));
|
482 |
|
|
else
|
483 |
|
|
$a_filter[] = $filterent;
|
484 |
|
|
}
|
485 |
f4e2a352
|
Scott Ullrich
|
|
486 |
5b237745
|
Scott Ullrich
|
write_config();
|
487 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('filter');
|
488 |
5ba18897
|
Scott Ullrich
|
|
489 |
661aed33
|
Ermal Luçi
|
if (isset($_POST['floating']))
|
490 |
|
|
header("Location: firewall_rules.php?if=FloatingRules");
|
491 |
|
|
else
|
492 |
|
|
header("Location: firewall_rules.php?if=" . $_POST['interface']);
|
493 |
5b237745
|
Scott Ullrich
|
exit;
|
494 |
|
|
}
|
495 |
c60824d2
|
Scott Ullrich
|
}
|
496 |
|
|
|
497 |
37c53a0d
|
Ermal Lu?i
|
read_altq_config(); /* XXX: */
|
498 |
|
|
$qlist =& get_unique_queue_list();
|
499 |
|
|
read_dummynet_config(); /* XXX: */
|
500 |
|
|
$dnqlist =& get_unique_dnqueue_list();
|
501 |
|
|
read_layer7_config();
|
502 |
|
|
$l7clist =& get_l7_unique_list();
|
503 |
|
|
|
504 |
d88c6a9f
|
Scott Ullrich
|
$pgtitle = array("Firewall","Rules","Edit");
|
505 |
a1357fe0
|
Bill Marquette
|
$closehead = false;
|
506 |
8ab3e9ed
|
Erik Kristensen
|
|
507 |
|
|
$page_filename = "firewall_rules_edit.php";
|
508 |
da7ae7ef
|
Bill Marquette
|
include("head.inc");
|
509 |
c60824d2
|
Scott Ullrich
|
|
510 |
5b237745
|
Scott Ullrich
|
?>
|
511 |
da7ae7ef
|
Bill Marquette
|
|
512 |
5b237745
|
Scott Ullrich
|
</head>
|
513 |
|
|
|
514 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
515 |
|
|
<?php include("fbegin.inc"); ?>
|
516 |
|
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
517 |
8ab3e9ed
|
Erik Kristensen
|
|
518 |
|
|
<form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
|
519 |
6eac9b90
|
Scott Ullrich
|
<input type='hidden' name="ruleid" value="<?=(isset($pconfig['ruleid'])&&$pconfig['ruleid']>0)?htmlspecialchars($pconfig['ruleid']):''?>">
|
520 |
|
|
|
521 |
8ab3e9ed
|
Erik Kristensen
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
522 |
e091cb45
|
Scott Ullrich
|
<tr>
|
523 |
|
|
<td colspan="2" valign="top" class="listtopic">Edit Firewall rule</td>
|
524 |
|
|
</tr>
|
525 |
8ab3e9ed
|
Erik Kristensen
|
<tr>
|
526 |
|
|
<td width="22%" valign="top" class="vncellreq">Action</td>
|
527 |
|
|
<td width="78%" class="vtable">
|
528 |
b5c78501
|
Seth Mos
|
<select name="type" class="formselect">
|
529 |
8ab3e9ed
|
Erik Kristensen
|
<?php $types = explode(" ", "Pass Block Reject"); foreach ($types as $type): ?>
|
530 |
|
|
<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['type'])) echo "selected"; ?>>
|
531 |
|
|
<?=htmlspecialchars($type);?>
|
532 |
|
|
</option>
|
533 |
|
|
<?php endforeach; ?>
|
534 |
8c84fe43
|
Scott Ullrich
|
</select>
|
535 |
8ab3e9ed
|
Erik Kristensen
|
<br/>
|
536 |
|
|
<span class="vexpl">
|
537 |
|
|
Choose what to do with packets that match the criteria specified below. <br/>
|
538 |
e91baab8
|
Chris Buechler
|
Hint: the difference between block and reject is that with reject, a packet (TCP RST or ICMP port unreachable for UDP) is returned to the sender, whereas with block the packet is dropped silently. In either case, the original packet is discarded.
|
539 |
8ab3e9ed
|
Erik Kristensen
|
</span>
|
540 |
|
|
</td>
|
541 |
|
|
</tr>
|
542 |
|
|
<tr>
|
543 |
|
|
<td width="22%" valign="top" class="vncellreq">Disabled</td>
|
544 |
|
|
<td width="78%" class="vtable">
|
545 |
|
|
<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked"; ?>>
|
546 |
|
|
<strong>Disable this rule</strong><br />
|
547 |
|
|
<span class="vexpl">Set this option to disable this rule without removing it from the list.</span>
|
548 |
|
|
</td>
|
549 |
|
|
</tr>
|
550 |
661aed33
|
Ermal Luçi
|
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
|
551 |
|
|
<tr>
|
552 |
f1602cc4
|
sullrich
|
<td width="22%" valign="top" class="vncellreq">
|
553 |
|
|
<?=gettext("Quick");?>
|
554 |
|
|
</td>
|
555 |
|
|
<td width="78%" class="vtable">
|
556 |
|
|
<input name="quick" type="checkbox" id="quick" value="yes" <?php if ($pconfig['quick']) echo "checked=\"checked\""; ?> />
|
557 |
|
|
<strong><?=gettext("Apply the action immediately on match.");?></strong><br />
|
558 |
|
|
<span class="vexpl"><?=gettext("Set this option if you need to apply this action to traffic that matches this rule immediately.");?></span>
|
559 |
|
|
</td>
|
560 |
|
|
</tr>
|
561 |
661aed33
|
Ermal Luçi
|
<? endif; ?>
|
562 |
8ab3e9ed
|
Erik Kristensen
|
<tr>
|
563 |
|
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
564 |
|
|
<td width="78%" class="vtable">
|
565 |
4633edc2
|
Ermal Luçi
|
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
|
566 |
8e6ac824
|
Ermal Luçi
|
<select name="interface[]" multiple="true" class="formselect" size="3">
|
567 |
661aed33
|
Ermal Luçi
|
<? else: ?>
|
568 |
b5c78501
|
Seth Mos
|
<select name="interface" class="formselect">
|
569 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
570 |
661aed33
|
Ermal Luçi
|
endif;
|
571 |
a7782099
|
Ermal Lu?i
|
/* add group interfaces */
|
572 |
f1602cc4
|
sullrich
|
if (is_array($config['ifgroups']['ifgroupentry']))
|
573 |
a7782099
|
Ermal Lu?i
|
foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
|
574 |
|
|
if (have_ruleint_access($ifgen['ifname']))
|
575 |
|
|
$interfaces[$ifgen['ifname']] = $ifgen['ifname'];
|
576 |
b7391125
|
Ermal Luçi
|
$ifdescs = get_configured_interface_with_descr();
|
577 |
5335811d
|
Ermal Luçi
|
foreach ($ifdescs as $ifent => $ifdesc)
|
578 |
|
|
if(have_ruleint_access($ifent))
|
579 |
f1602cc4
|
sullrich
|
$interfaces[$ifent] = $ifdesc;
|
580 |
617f8d25
|
Ermal Lu?i
|
if ($config['l2tp']['mode'] == "server")
|
581 |
f1602cc4
|
sullrich
|
if(have_ruleint_access("l2tp"))
|
582 |
|
|
$interfaces['l2tp'] = "L2TP VPN";
|
583 |
b6742927
|
Scott Ullrich
|
if ($config['pptpd']['mode'] == "server")
|
584 |
|
|
if(have_ruleint_access("pptp"))
|
585 |
|
|
$interfaces['pptp'] = "PPTP VPN";
|
586 |
|
|
|
587 |
|
|
if ($config['pppoe']['mode'] == "server")
|
588 |
|
|
if(have_ruleint_access("pppoe"))
|
589 |
|
|
$interfaces['pppoe'] = "PPPoE VPN";
|
590 |
|
|
/* add ipsec interfaces */
|
591 |
|
|
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable']))
|
592 |
|
|
if(have_ruleint_access("enc0"))
|
593 |
0f266b2e
|
Chris Buechler
|
$interfaces["enc0"] = "IPsec";
|
594 |
bfb60ac8
|
Ermal Luçi
|
/* add openvpn/tun interfaces */
|
595 |
d799787e
|
Matthew Grooms
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
|
596 |
|
|
$interfaces["openvpn"] = "OpenVPN";
|
597 |
8ab3e9ed
|
Erik Kristensen
|
foreach ($interfaces as $iface => $ifacename): ?>
|
598 |
661aed33
|
Ermal Luçi
|
<option value="<?=$iface;?>" <?php if ($pconfig['interface'] <> "" && stristr($pconfig['interface'], $iface)) echo "selected"; ?>><?=gettext($ifacename);?></option>
|
599 |
8ab3e9ed
|
Erik Kristensen
|
<?php endforeach; ?>
|
600 |
8c84fe43
|
Scott Ullrich
|
</select>
|
601 |
8ab3e9ed
|
Erik Kristensen
|
<br />
|
602 |
|
|
<span class="vexpl">Choose on which interface packets must come in to match this rule.</span>
|
603 |
|
|
</td>
|
604 |
|
|
</tr>
|
605 |
661aed33
|
Ermal Luçi
|
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
|
606 |
f1602cc4
|
sullrich
|
<tr>
|
607 |
|
|
<td width="22%" valign="top" class="vncellreq">
|
608 |
|
|
<?=gettext("Direction");?>
|
609 |
|
|
</td>
|
610 |
|
|
<td width="78%" class="vtable">
|
611 |
|
|
<select name="direction" class="formselect">
|
612 |
|
|
<?php $directions = array('any', 'in', 'out');
|
613 |
|
|
foreach ($directions as $direction): ?>
|
614 |
|
|
<option value="<?=$direction;?>"
|
615 |
|
|
<?php if ($direction == $pconfig['direction']): ?>
|
616 |
|
|
selected="selected"
|
617 |
|
|
<?php endif; ?>
|
618 |
|
|
><?=$direction;?></option>
|
619 |
|
|
<?php endforeach; ?>
|
620 |
|
|
</select>
|
621 |
|
|
<input type="hidden" id="floating" name="floating" value="floating">
|
622 |
|
|
</td>
|
623 |
|
|
<tr>
|
624 |
661aed33
|
Ermal Luçi
|
<?php endif; ?>
|
625 |
8ab3e9ed
|
Erik Kristensen
|
<tr>
|
626 |
|
|
<td width="22%" valign="top" class="vncellreq">Protocol</td>
|
627 |
|
|
<td width="78%" class="vtable">
|
628 |
b5c78501
|
Seth Mos
|
<select name="proto" class="formselect" onchange="proto_change()">
|
629 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
630 |
87f0be87
|
Chris Buechler
|
$protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IGMP any carp pfsync");
|
631 |
8ab3e9ed
|
Erik Kristensen
|
foreach ($protocols as $proto): ?>
|
632 |
|
|
<option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>><?=htmlspecialchars($proto);?></option>
|
633 |
|
|
<?php endforeach; ?>
|
634 |
|
|
</select>
|
635 |
|
|
<br />
|
636 |
|
|
<span class="vexpl">Choose which IP protocol this rule should match. <br /> Hint: in most cases, you should specify <em>TCP</em> here.</span>
|
637 |
|
|
</td>
|
638 |
|
|
</tr>
|
639 |
3de8af0e
|
Scott Ullrich
|
<tr id="icmpbox" name="icmpbox">
|
640 |
8ab3e9ed
|
Erik Kristensen
|
<td valign="top" class="vncell">ICMP type</td>
|
641 |
|
|
<td class="vtable">
|
642 |
b5c78501
|
Seth Mos
|
<select name="icmptype" class="formselect">
|
643 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
644 |
|
|
$icmptypes = array(
|
645 |
|
|
"" => "any",
|
646 |
|
|
"echorep" => "Echo reply",
|
647 |
|
|
"unreach" => "Destination unreachable",
|
648 |
|
|
"squench" => "Source quench",
|
649 |
|
|
"redir" => "Redirect",
|
650 |
|
|
"althost" => "Alternate Host",
|
651 |
|
|
"echoreq" => "Echo",
|
652 |
|
|
"routeradv" => "Router advertisement",
|
653 |
|
|
"routersol" => "Router solicitation",
|
654 |
|
|
"timex" => "Time exceeded",
|
655 |
|
|
"paramprob" => "Invalid IP header",
|
656 |
|
|
"timereq" => "Timestamp",
|
657 |
|
|
"timerep" => "Timestamp reply",
|
658 |
|
|
"inforeq" => "Information request",
|
659 |
|
|
"inforep" => "Information reply",
|
660 |
|
|
"maskreq" => "Address mask request",
|
661 |
|
|
"maskrep" => "Address mask reply"
|
662 |
|
|
);
|
663 |
|
|
|
664 |
|
|
foreach ($icmptypes as $icmptype => $descr): ?>
|
665 |
|
|
<option value="<?=$icmptype;?>" <?php if ($icmptype == $pconfig['icmptype']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
|
666 |
|
|
<?php endforeach; ?>
|
667 |
|
|
</select>
|
668 |
|
|
<br />
|
669 |
|
|
<span class="vexpl">If you selected ICMP for the protocol above, you may specify an ICMP type here.</span>
|
670 |
|
|
</td>
|
671 |
|
|
</tr>
|
672 |
|
|
<tr>
|
673 |
|
|
<td width="22%" valign="top" class="vncellreq">Source</td>
|
674 |
|
|
<td width="78%" class="vtable">
|
675 |
383654fc
|
Vinicius Coque
|
<?php $edit_disabled=false; ?>
|
676 |
|
|
<?php if( isset($pconfig['associated-rule-id']) ): ?>
|
677 |
|
|
<span class="red"><strong>NOTE: </strong></span> This is associated to a NAT rule.<br />
|
678 |
|
|
You cannot edit the source and destination of associated filter rules.<br />
|
679 |
|
|
<br />
|
680 |
|
|
<?php
|
681 |
|
|
$edit_disabled=true;
|
682 |
|
|
if (is_array($config['nat']['rule'])) {
|
683 |
|
|
foreach( $config['nat']['rule'] as $index => $nat_rule ) {
|
684 |
|
|
if( $nat_rule['associated-rule-id']==$pconfig['associated-rule-id']) {
|
685 |
|
|
echo "<a href=\"firewall_nat_edit.php?id={$nat_rule[$index]}\">View the NAT rule</a><br>";
|
686 |
|
|
break;
|
687 |
|
|
}
|
688 |
|
|
}
|
689 |
|
|
}
|
690 |
|
|
?>
|
691 |
|
|
<br />
|
692 |
|
|
<script type="text/javascript">
|
693 |
|
|
editenabled = 0;
|
694 |
|
|
</script>
|
695 |
|
|
<?php endif; ?>
|
696 |
|
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>>
|
697 |
8ab3e9ed
|
Erik Kristensen
|
<strong>not</strong>
|
698 |
|
|
<br />
|
699 |
|
|
Use this option to invert the sense of the match.
|
700 |
|
|
<br />
|
701 |
|
|
<br />
|
702 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
703 |
|
|
<tr>
|
704 |
|
|
<td>Type: </td>
|
705 |
|
|
<td>
|
706 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srctype" class="formselect" onChange="typesel_change()">
|
707 |
87f0be87
|
Chris Buechler
|
<?php
|
708 |
|
|
$sel = is_specialnet($pconfig['src']); ?>
|
709 |
8ab3e9ed
|
Erik Kristensen
|
<option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>>any</option>
|
710 |
87f0be87
|
Chris Buechler
|
<option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
|
711 |
|
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
|
712 |
99ea4439
|
Scott Ullrich
|
<?php if(have_ruleint_access("pptp")): ?>
|
713 |
8ab3e9ed
|
Erik Kristensen
|
<option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
|
714 |
99ea4439
|
Scott Ullrich
|
<?php endif; ?>
|
715 |
|
|
<?php if(have_ruleint_access("pppoe")): ?>
|
716 |
8c84fe43
|
Scott Ullrich
|
<option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
|
717 |
99ea4439
|
Scott Ullrich
|
<?php endif; ?>
|
718 |
8a6bc505
|
Ermal Lu?i
|
<?php if(have_ruleint_access("l2tp")): ?>
|
719 |
|
|
<option value="l2tp" <?php if ($pconfig['src'] == "l2tp") { echo "selected"; } ?>>L2TP clients</option>
|
720 |
|
|
<?php endif; ?>
|
721 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
722 |
5335811d
|
Ermal Luçi
|
foreach ($ifdisp as $ifent => $ifdesc): ?>
|
723 |
|
|
<?php if(have_ruleint_access($ifent)): ?>
|
724 |
|
|
<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option>
|
725 |
|
|
<option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected"; } ?>>
|
726 |
b7391125
|
Ermal Luçi
|
<?=$ifdesc?> address
|
727 |
e30a5970
|
Scott Ullrich
|
</option>
|
728 |
99ea4439
|
Scott Ullrich
|
<?php endif; ?>
|
729 |
b7391125
|
Ermal Luçi
|
<?php endforeach; ?>
|
730 |
8ab3e9ed
|
Erik Kristensen
|
</select>
|
731 |
|
|
</td>
|
732 |
|
|
</tr>
|
733 |
|
|
<tr>
|
734 |
|
|
<td>Address: </td>
|
735 |
|
|
<td>
|
736 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> /
|
737 |
|
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcmask" class="formselect" id="srcmask">
|
738 |
8ab3e9ed
|
Erik Kristensen
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
739 |
|
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
|
740 |
|
|
<?php endfor; ?>
|
741 |
|
|
</select>
|
742 |
bdb7d6e7
|
Scott Ullrich
|
</td>
|
743 |
8ab3e9ed
|
Erik Kristensen
|
</tr>
|
744 |
|
|
</table>
|
745 |
22abf2ef
|
Scott Ullrich
|
<div id="showadvancedboxspr">
|
746 |
|
|
<p>
|
747 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> type="button" onClick="show_source_port_range()" value="Advanced"></input> - Show source port range</a>
|
748 |
22abf2ef
|
Scott Ullrich
|
</div>
|
749 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
750 |
e33c8694
|
Bill Marquette
|
</tr>
|
751 |
3de8af0e
|
Scott Ullrich
|
<tr style="display:none" id="sprtable" name="sprtable">
|
752 |
8ab3e9ed
|
Erik Kristensen
|
<td width="22%" valign="top" class="vncellreq">Source port range</td>
|
753 |
|
|
<td width="78%" class="vtable">
|
754 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
755 |
|
|
<tr>
|
756 |
|
|
<td>from: </td>
|
757 |
|
|
<td>
|
758 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()">
|
759 |
8ab3e9ed
|
Erik Kristensen
|
<option value="">(other)</option>
|
760 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
761 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
762 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
763 |
|
|
<?php endforeach; ?>
|
764 |
8c84fe43
|
Scott Ullrich
|
</select>
|
765 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo $pconfig['srcbeginport']; ?>">
|
766 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
767 |
|
|
</tr>
|
768 |
|
|
<tr>
|
769 |
|
|
<td>to:</td>
|
770 |
|
|
<td>
|
771 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="srcendport" class="formselect" onchange="ext_change()">
|
772 |
8ab3e9ed
|
Erik Kristensen
|
<option value="">(other)</option>
|
773 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['srcendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
774 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
775 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
776 |
|
|
<?php endforeach; ?>
|
777 |
8c84fe43
|
Scott Ullrich
|
</select>
|
778 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="srcendport_cust" id="srcendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcendport']) echo $pconfig['srcendport']; ?>">
|
779 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
780 |
|
|
</tr>
|
781 |
|
|
</table>
|
782 |
|
|
<br />
|
783 |
a29dc11b
|
Chris Buechler
|
<span class="vexpl">Specify the source port or port range for this rule. <b>This is almost never equal to the destination port range (and is usually "any")</b>. <br /> Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port</span><br/>
|
784 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
785 |
8c84fe43
|
Scott Ullrich
|
</tr>
|
786 |
8ab3e9ed
|
Erik Kristensen
|
<tr>
|
787 |
|
|
<td width="22%" valign="top" class="vncellreq">Destination</td>
|
788 |
|
|
<td width="78%" class="vtable">
|
789 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked"; ?>>
|
790 |
8ab3e9ed
|
Erik Kristensen
|
<strong>not</strong>
|
791 |
|
|
<br />
|
792 |
|
|
Use this option to invert the sense of the match.
|
793 |
|
|
<br />
|
794 |
|
|
<br />
|
795 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
796 |
|
|
<tr>
|
797 |
|
|
<td>Type: </td>
|
798 |
|
|
<td>
|
799 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dsttype" class="formselect" onChange="typesel_change()">
|
800 |
87f0be87
|
Chris Buechler
|
<?php
|
801 |
|
|
$sel = is_specialnet($pconfig['dst']); ?>
|
802 |
8ab3e9ed
|
Erik Kristensen
|
<option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>>any</option>
|
803 |
87f0be87
|
Chris Buechler
|
<option value="single" <?php if (($pconfig['dstmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
|
804 |
|
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
|
805 |
99ea4439
|
Scott Ullrich
|
<?php if(have_ruleint_access("pptp")): ?>
|
806 |
8ab3e9ed
|
Erik Kristensen
|
<option value="pptp" <?php if ($pconfig['dst'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
|
807 |
99ea4439
|
Scott Ullrich
|
<?php endif; ?>
|
808 |
|
|
<?php if(have_ruleint_access("pppoe")): ?>
|
809 |
8ab3e9ed
|
Erik Kristensen
|
<option value="pppoe" <?php if ($pconfig['dst'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
|
810 |
99ea4439
|
Scott Ullrich
|
<?php endif; ?>
|
811 |
3331a640
|
Ermal Lu?i
|
<?php if(have_ruleint_access("l2tp")): ?>
|
812 |
|
|
<option value="l2tp" <?php if ($pconfig['dst'] == "l2tp") { echo "selected"; } ?>>L2TP clients</option>
|
813 |
|
|
<?php endif; ?>
|
814 |
b7391125
|
Ermal Luçi
|
|
815 |
|
|
<?php foreach ($ifdisp as $if => $ifdesc): ?>
|
816 |
|
|
<?php if(have_ruleint_access($if)): ?>
|
817 |
|
|
<option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option>
|
818 |
|
|
<option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo "selected"; } ?>>
|
819 |
|
|
<?=$ifdesc;?> address
|
820 |
cbff71a1
|
Scott Ullrich
|
</option>
|
821 |
99ea4439
|
Scott Ullrich
|
<?php endif; ?>
|
822 |
b7391125
|
Ermal Luçi
|
<?php endforeach; ?>
|
823 |
8ab3e9ed
|
Erik Kristensen
|
</select>
|
824 |
|
|
</td>
|
825 |
|
|
</tr>
|
826 |
|
|
<tr>
|
827 |
|
|
<td>Address: </td>
|
828 |
|
|
<td>
|
829 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
|
830 |
8ab3e9ed
|
Erik Kristensen
|
/
|
831 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstmask" class="formselect" id="dstmask">
|
832 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
833 |
|
|
for ($i = 31; $i > 0; $i--): ?>
|
834 |
|
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option>
|
835 |
|
|
<?php endfor; ?>
|
836 |
|
|
</select>
|
837 |
|
|
</td>
|
838 |
|
|
</tr>
|
839 |
|
|
</table>
|
840 |
|
|
</td>
|
841 |
|
|
</tr>
|
842 |
3de8af0e
|
Scott Ullrich
|
<tr id="dprtr" name="dprtr">
|
843 |
8ab3e9ed
|
Erik Kristensen
|
<td width="22%" valign="top" class="vncellreq">Destination port range </td>
|
844 |
|
|
<td width="78%" class="vtable">
|
845 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
846 |
|
|
<tr>
|
847 |
|
|
<td>from: </td>
|
848 |
|
|
<td>
|
849 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()">
|
850 |
8ab3e9ed
|
Erik Kristensen
|
<option value="">(other)</option>
|
851 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['dstbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
852 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
853 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected"; $bfound = 1; }?>><?=htmlspecialchars($wkportdesc);?></option>
|
854 |
|
|
<?php endforeach; ?>
|
855 |
|
|
</select>
|
856 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo $pconfig['dstbeginport']; ?>">
|
857 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
858 |
|
|
</tr>
|
859 |
|
|
<tr>
|
860 |
|
|
<td>to:</td>
|
861 |
|
|
<td>
|
862 |
383654fc
|
Vinicius Coque
|
<select<?php echo ($edit_disabled===true?' DISABLED':''); ?> name="dstendport" class="formselect" onchange="ext_change()">
|
863 |
8ab3e9ed
|
Erik Kristensen
|
<option value="">(other)</option>
|
864 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['dstendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
865 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
866 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
867 |
|
|
<?php endforeach; ?>
|
868 |
8c84fe43
|
Scott Ullrich
|
</select>
|
869 |
383654fc
|
Vinicius Coque
|
<input<?php echo ($edit_disabled===true?' DISABLED':''); ?> autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo $pconfig['dstendport']; ?>">
|
870 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
871 |
|
|
</tr>
|
872 |
|
|
</table>
|
873 |
|
|
<br />
|
874 |
|
|
<span class="vexpl">
|
875 |
|
|
Specify the port or port range for the destination of the packet for this rule.
|
876 |
adb633a0
|
sullrich
|
<br />
|
877 |
8ab3e9ed
|
Erik Kristensen
|
Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port
|
878 |
|
|
</span>
|
879 |
|
|
</td>
|
880 |
|
|
</tr>
|
881 |
|
|
<tr>
|
882 |
|
|
<td width="22%" valign="top" class="vncellreq">Log</td>
|
883 |
|
|
<td width="78%" class="vtable">
|
884 |
|
|
<input name="log" type="checkbox" id="log" value="yes" <?php if ($pconfig['log']) echo "checked"; ?>>
|
885 |
|
|
<strong>Log packets that are handled by this rule</strong>
|
886 |
adb633a0
|
sullrich
|
<br />
|
887 |
8ab3e9ed
|
Erik Kristensen
|
<span class="vexpl">Hint: the firewall has limited local log space. Don't turn on logging for everything. If you want to do a lot of logging, consider using a remote syslog server (see the <a href="diag_logs_settings.php">Diagnostics: System logs: Settings</a> page).</span>
|
888 |
|
|
</td>
|
889 |
|
|
</tr>
|
890 |
151eb2a9
|
sullrich
|
<tr>
|
891 |
|
|
<td width="22%" valign="top" class="vncell">Description</td>
|
892 |
|
|
<td width="78%" class="vtable">
|
893 |
|
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="52" maxlength="52" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
894 |
|
|
<br />
|
895 |
|
|
<span class="vexpl">You may enter a description here for your reference.</span>
|
896 |
|
|
</td>
|
897 |
|
|
</tr>
|
898 |
|
|
<tr>
|
899 |
|
|
<td width="22%" valign="top"> </td>
|
900 |
|
|
<td width="78%">
|
901 |
|
|
<br>
|
902 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
903 |
|
|
<?php if (isset($id) && $a_filter[$id]): ?>
|
904 |
|
|
<input name="id" type="hidden" value="<?=$id;?>">
|
905 |
|
|
<?php endif; ?>
|
906 |
|
|
<input name="after" type="hidden" value="<?=$after;?>">
|
907 |
|
|
</td>
|
908 |
|
|
</tr>
|
909 |
|
|
<tr>
|
910 |
|
|
<td> </td>
|
911 |
|
|
</tr>
|
912 |
|
|
<tr>
|
913 |
|
|
<td colspan="2" valign="top" class="listtopic">Advanced features</td>
|
914 |
|
|
</tr>
|
915 |
f1602cc4
|
sullrich
|
<tr>
|
916 |
|
|
<td width="22%" valign="top" class="vncell">Source OS</td>
|
917 |
e265d9f5
|
sullrich
|
<td width="78%" class="vtable">
|
918 |
adb633a0
|
sullrich
|
<div id="showadvsourceosbox">
|
919 |
|
|
<input type="button" onClick="show_advanced_sourceos()" value="Advanced"></input> - Show advanced option</a>
|
920 |
|
|
</div>
|
921 |
61c0250d
|
sullrich
|
<div id="showsourceosadv" style="display:none">
|
922 |
e265d9f5
|
sullrich
|
OS Type:
|
923 |
adb633a0
|
sullrich
|
<select name="os" id="os" class="formselect">
|
924 |
f1602cc4
|
sullrich
|
<?php
|
925 |
adb633a0
|
sullrich
|
$ostypes = array(
|
926 |
|
|
"" => "any",
|
927 |
|
|
"AIX" => "AIX",
|
928 |
|
|
"Linux" => "Linux",
|
929 |
|
|
"FreeBSD" => "FreeBSD",
|
930 |
|
|
"NetBSD" => "NetBSD",
|
931 |
|
|
"OpenBSD" => "OpenBSD",
|
932 |
|
|
"Solaris" => "Solaris",
|
933 |
|
|
"MacOS" => "MacOS",
|
934 |
|
|
"Windows" => "Windows",
|
935 |
|
|
"Novell" => "Novell",
|
936 |
|
|
"NMAP" => "NMAP"
|
937 |
|
|
);
|
938 |
|
|
foreach ($ostypes as $ostype => $descr): ?>
|
939 |
|
|
<option value="<?=$ostype;?>" <?php if ($ostype == $pconfig['os']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
|
940 |
|
|
<?php
|
941 |
|
|
endforeach;
|
942 |
|
|
?>
|
943 |
|
|
</select>
|
944 |
|
|
<br />
|
945 |
|
|
Note: this only works for TCP rules
|
946 |
|
|
</div>
|
947 |
f1602cc4
|
sullrich
|
</td>
|
948 |
|
|
</tr>
|
949 |
30c4ae8a
|
sullrich
|
<tr>
|
950 |
|
|
<td width="22%" valign="top" class="vncell">Diffserv Code Point</td>
|
951 |
|
|
<td width="78%" class="vtable">
|
952 |
|
|
<div id="dsadv" name="dsadv">
|
953 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_dsdiv();" value="Advanced"> - Show advanced option
|
954 |
30c4ae8a
|
sullrich
|
</div>
|
955 |
|
|
<div id="dsdivmain" name="dsdivmain" style="display:none">
|
956 |
|
|
<select name="dscp" id="dscp">
|
957 |
|
|
<option value=""></option>
|
958 |
|
|
<?php foreach($firewall_rules_dscp_types as $frdt): ?>
|
959 |
|
|
<option value="<?=$frdt?>"<?php if($pconfig['dscp'] == $frdt) echo " SELECTED"; ?>><?=$frdt?></option>
|
960 |
|
|
<?php endforeach; ?>
|
961 |
|
|
</select>
|
962 |
|
|
</div>
|
963 |
|
|
</td>
|
964 |
|
|
</tr>
|
965 |
661aed33
|
Ermal Luçi
|
<tr>
|
966 |
e6db3f58
|
Ermal Luçi
|
<td width="22%" valign="top" class="vncell">Advanced Options</td>
|
967 |
|
|
<td width="78%" class="vtable">
|
968 |
|
|
<div id="aoadv" name="aoadv">
|
969 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_aodiv();" value="Advanced"> - Show advanced option
|
970 |
e6db3f58
|
Ermal Luçi
|
</div>
|
971 |
|
|
<div id="aodivmain" name="aodivmain" style="display:none">
|
972 |
f1602cc4
|
sullrich
|
<input type="checkbox" id="allowopts" value="yes" name="allowopts"<?php if($pconfig['allowopts'] == true) echo " checked"; ?>>
|
973 |
a29dc11b
|
Chris Buechler
|
<br/><span class="vexpl"><?=gettext("This allows packets with IP options to pass. Otherwise they are blocked by default. This is usually only seen with multicast traffic.");?>
|
974 |
f1602cc4
|
sullrich
|
</span><p>
|
975 |
19757916
|
Ermal Lu?i
|
<input type="checkbox" id="disablereplyto" value="yes" name="disablereplyto"<?php if($pconfig['disablereplyto'] == true) echo " checked"; ?>>
|
976 |
|
|
<br/><span class="vexpl"><?=gettext("This will disable auto generated reply-to for this rule.");?>
|
977 |
|
|
</span><p>
|
978 |
f1602cc4
|
sullrich
|
<input name="tag" id="tag" value="<?=htmlspecialchars($pconfig['tag']);?>">
|
979 |
a29dc11b
|
Chris Buechler
|
<br /><span class="vexpl"><?=gettext("You can mark a packet matching this rule and use this mark to match on other NAT/filter rules. It is called <b>Policy filtering</b>");?>
|
980 |
775ccea3
|
Ermal Luci
|
</span><p>
|
981 |
f1602cc4
|
sullrich
|
<input name="tagged" id="tagged" value="<?=htmlspecialchars($pconfig['tagged']);?>">
|
982 |
|
|
<br /><span class="vexpl"><?=gettext("You can match packet on a mark placed before on another rule.")?>
|
983 |
|
|
</span> <p>
|
984 |
a56b2fa0
|
pierrepomes
|
<input name="max" id="max" value="<?php echo $pconfig['max'] ?>"><br> Maximum state entries this rule can create<p>
|
985 |
29adf437
|
Chris Buechler
|
<input name="max-src-nodes" id="max-src-nodes" value="<?php echo $pconfig['max-src-nodes'] ?>"><br> Maximum number of unique source hosts<p>
|
986 |
|
|
<input name="max-src-conn" id="max-src-conn" value="<?php echo $pconfig['max-src-conn'] ?>"><br> Maximum number of established connections per host<p>
|
987 |
8ab3e9ed
|
Erik Kristensen
|
<input name="max-src-states" id="max-src-states" value="<?php echo $pconfig['max-src-states'] ?>"><br> Maximum state entries per host<p>
|
988 |
|
|
<input name="max-src-conn-rate" id="max-src-conn-rate" value="<?php echo $pconfig['max-src-conn-rate'] ?>"> /
|
989 |
|
|
<select name="max-src-conn-rates" id="max-src-conn-rates">
|
990 |
|
|
<option value=""<?php if(intval($pconfig['max-src-conn-rates']) < 1) echo " selected"; ?>></option>
|
991 |
|
|
<?php for($x=1; $x<255; $x++) {
|
992 |
|
|
if($x == $pconfig['max-src-conn-rates']) $selected = " selected"; else $selected = "";
|
993 |
|
|
echo "<option value=\"{$x}\"{$selected}>{$x}</option>\n";
|
994 |
|
|
} ?>
|
995 |
47042140
|
Scott Ullrich
|
</select><br />
|
996 |
29adf437
|
Chris Buechler
|
Maximum new connections / per second(s)
|
997 |
47042140
|
Scott Ullrich
|
<p>
|
998 |
|
|
|
999 |
|
|
<input name="statetimeout" value="<?php echo $pconfig['statetimeout'] ?>"><br>
|
1000 |
3906617b
|
Scott Ullrich
|
State Timeout in seconds
|
1001 |
47042140
|
Scott Ullrich
|
<p />
|
1002 |
|
|
|
1003 |
29adf437
|
Chris Buechler
|
<p><strong>NOTE: Leave fields blank to disable that feature.</strong>
|
1004 |
197b2a47
|
Scott Ullrich
|
</div>
|
1005 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
1006 |
|
|
</tr>
|
1007 |
|
|
<tr>
|
1008 |
|
|
<td width="22%" valign="top" class="vncell">State Type</td>
|
1009 |
|
|
<td width="78%" class="vtable">
|
1010 |
f6970b2f
|
Scott Ullrich
|
<div id="showadvstatebox">
|
1011 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_state()" value="Advanced"></input> - Show advanced option</a>
|
1012 |
f6970b2f
|
Scott Ullrich
|
</div>
|
1013 |
|
|
<div id="showstateadv" style="display:none">
|
1014 |
|
|
<select name="statetype">
|
1015 |
|
|
<option value="keep state" <?php if(!isset($pconfig['statetype']) or $pconfig['statetype'] == "keep state") echo "selected"; ?>>keep state</option>
|
1016 |
|
|
<option value="synproxy state"<?php if($pconfig['statetype'] == "synproxy state") echo "selected"; ?>>synproxy state</option>
|
1017 |
|
|
<option value="none"<?php if($pconfig['statetype'] == "none") echo "selected"; ?>>none</option>
|
1018 |
|
|
</select><br>HINT: Select which type of state tracking mechanism you would like to use. If in doubt, use keep state.
|
1019 |
|
|
<p>
|
1020 |
|
|
<table width="90%">
|
1021 |
c62ff4e7
|
Chris Buechler
|
<tr><td width="25%"><ul><li>keep state</li></td><td>Works with all IP protocols.</ul></td></tr>
|
1022 |
8eb08ba7
|
Chris Buechler
|
<tr><td width="25%"><ul><li>synproxy state</li></td><td>Proxies incoming TCP connections to help protect servers from spoofed TCP SYN floods. This option includes the functionality of keep state and modulate state combined.</ul></td></tr>
|
1023 |
|
|
<tr><td width="25%"><ul><li>none</li></td><td>Do not use state mechanisms to keep track. This is only useful if you're doing advanced queueing in certain situations. Please check the documentation.</ul></td></tr>
|
1024 |
f6970b2f
|
Scott Ullrich
|
</table>
|
1025 |
|
|
</p>
|
1026 |
|
|
</div>
|
1027 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
1028 |
|
|
</tr>
|
1029 |
10f21e70
|
Scott Ullrich
|
<tr>
|
1030 |
|
|
<td width="22%" valign="top" class="vncell">No XMLRPC Sync</td>
|
1031 |
|
|
<td width="78%" class="vtable">
|
1032 |
0239d8ee
|
sullrich
|
<div id="showadvnoxmlrpcsyncbox">
|
1033 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_noxmlrpc()" value="Advanced"></input> - Show advanced option</a>
|
1034 |
0239d8ee
|
sullrich
|
</div>
|
1035 |
|
|
<div id="shownoxmlrpcadv" style="display:none">
|
1036 |
|
|
<input type="checkbox" name="nosync"<?php if($pconfig['nosync']) echo " CHECKED"; ?>><br>
|
1037 |
a29dc11b
|
Chris Buechler
|
HINT: This prevents the rule from automatically syncing to other CARP members.
|
1038 |
0239d8ee
|
sullrich
|
</div>
|
1039 |
10f21e70
|
Scott Ullrich
|
</td>
|
1040 |
8c84fe43
|
Scott Ullrich
|
</tr>
|
1041 |
615b27bc
|
Scott Dale
|
<?php
|
1042 |
|
|
//build list of schedules
|
1043 |
|
|
$schedules = array();
|
1044 |
|
|
$schedules[] = "none";//leave none to leave rule enabled all the time
|
1045 |
a60fd0cb
|
Scott Ullrich
|
if(is_array($config['schedules']['schedule'])) {
|
1046 |
|
|
foreach ($config['schedules']['schedule'] as $schedule) {
|
1047 |
|
|
if ($schedule['name'] <> "")
|
1048 |
|
|
$schedules[] = $schedule['name'];
|
1049 |
|
|
}
|
1050 |
|
|
}
|
1051 |
615b27bc
|
Scott Dale
|
?>
|
1052 |
|
|
<tr>
|
1053 |
|
|
<td width="22%" valign="top" class="vncell">Schedule</td>
|
1054 |
|
|
<td width="78%" class="vtable">
|
1055 |
0239d8ee
|
sullrich
|
<div id="showadvschedulebox">
|
1056 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_schedule()" value="Advanced"></input> - Show advanced option</a>
|
1057 |
0239d8ee
|
sullrich
|
</div>
|
1058 |
|
|
<div id="showscheduleadv" style="display:none">
|
1059 |
|
|
<select name='sched'>
|
1060 |
615b27bc
|
Scott Dale
|
<?php
|
1061 |
0239d8ee
|
sullrich
|
foreach($schedules as $schedule) {
|
1062 |
|
|
if($schedule == $pconfig['sched']) {
|
1063 |
|
|
$selected = " SELECTED";
|
1064 |
|
|
} else {
|
1065 |
|
|
$selected = "";
|
1066 |
|
|
}
|
1067 |
|
|
if ($schedule == "none") {
|
1068 |
|
|
echo "<option value=\"\" {$selected}>{$schedule}</option>\n";
|
1069 |
|
|
} else {
|
1070 |
|
|
echo "<option value=\"{$schedule}\" {$selected}>{$schedule}</option>\n";
|
1071 |
|
|
}
|
1072 |
615b27bc
|
Scott Dale
|
}
|
1073 |
0239d8ee
|
sullrich
|
?>
|
1074 |
|
|
</select>
|
1075 |
|
|
<p>Leave as 'none' to leave the rule enabled all the time.</p>
|
1076 |
|
|
</div>
|
1077 |
615b27bc
|
Scott Dale
|
</td>
|
1078 |
|
|
</tr>
|
1079 |
|
|
|
1080 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
1081 |
82628210
|
Scott Ullrich
|
/* build a list of gateways */
|
1082 |
|
|
$gateways = array();
|
1083 |
615b27bc
|
Scott Dale
|
$gateways[] = "default"; // default to don't use this feature :)
|
1084 |
3d81372f
|
Chris Buechler
|
if (is_array($config['gateways']['gateway_item'])) {
|
1085 |
|
|
foreach($config['gateways']['gateway_item'] as $gw_item) {
|
1086 |
|
|
if($gw_item['gateway'] <> "")
|
1087 |
|
|
$gateways[] = $gw_item['name'];
|
1088 |
|
|
}
|
1089 |
82628210
|
Scott Ullrich
|
}
|
1090 |
3d81372f
|
Chris Buechler
|
|
1091 |
8ab3e9ed
|
Erik Kristensen
|
?>
|
1092 |
82628210
|
Scott Ullrich
|
<tr>
|
1093 |
8ab3e9ed
|
Erik Kristensen
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
1094 |
|
|
<td width="78%" class="vtable">
|
1095 |
0239d8ee
|
sullrich
|
<div id="showadvgatewaybox">
|
1096 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a>
|
1097 |
0239d8ee
|
sullrich
|
</div>
|
1098 |
|
|
<div id="showgatewayadv" style="display:none">
|
1099 |
|
|
<select name='gateway'>
|
1100 |
8ab3e9ed
|
Erik Kristensen
|
<?php
|
1101 |
106804a2
|
Chris Buechler
|
// add statically configured gateways to list
|
1102 |
0239d8ee
|
sullrich
|
foreach($gateways as $gw) {
|
1103 |
|
|
if($gw == "")
|
1104 |
0581660c
|
Scott Ullrich
|
continue;
|
1105 |
0239d8ee
|
sullrich
|
if($gw == $pconfig['gateway']) {
|
1106 |
4443d4d6
|
Scott Ullrich
|
$selected = " SELECTED";
|
1107 |
1fda0968
|
Scott Ullrich
|
} else {
|
1108 |
|
|
$selected = "";
|
1109 |
|
|
}
|
1110 |
0239d8ee
|
sullrich
|
if ($gw == "default") {
|
1111 |
|
|
echo "<option value=\"\" {$selected}>{$gw}</option>\n";
|
1112 |
|
|
} else {
|
1113 |
|
|
$gwip = lookup_gateway_ip_by_name($gw);
|
1114 |
|
|
echo "<option value=\"{$gw}\" {$selected}>{$gw} - {$gwip}</option>\n";
|
1115 |
|
|
}
|
1116 |
|
|
}
|
1117 |
106804a2
|
Chris Buechler
|
// add dynamic gateways to list
|
1118 |
|
|
$iflist = get_configured_interface_with_descr();
|
1119 |
|
|
foreach ($iflist as $ifent => $ifdesc) {
|
1120 |
611ae852
|
Ermal
|
if (in_array($config['interfaces'][$ifent]['ipaddr'], array("dhcp", "pppoe", "pptp", "ppp"))) {
|
1121 |
106804a2
|
Chris Buechler
|
if ($pconfig['gateway'] == $ifent) {
|
1122 |
|
|
$selected = " SELECTED";
|
1123 |
|
|
} else {
|
1124 |
|
|
$selected = "";
|
1125 |
|
|
}
|
1126 |
|
|
if($ifdesc <> "")
|
1127 |
|
|
echo "<option value=\"{$ifent}\" {$selected}>".strtoupper($ifent)." - {$ifdesc}</option>\n";
|
1128 |
|
|
}
|
1129 |
|
|
}
|
1130 |
0239d8ee
|
sullrich
|
/* add gateway groups to the list */
|
1131 |
|
|
if (is_array($config['gateways']['gateway_group'])) {
|
1132 |
|
|
foreach($config['gateways']['gateway_group'] as $gw_group) {
|
1133 |
|
|
if($gw_group['name'] == "")
|
1134 |
|
|
continue;
|
1135 |
|
|
if($pconfig['gateway'] == $gw_group['name']) {
|
1136 |
|
|
echo "<option value=\"{$gw_group['name']}\" SELECTED>{$gw_group['name']}</option>\n";
|
1137 |
|
|
} else {
|
1138 |
|
|
echo "<option value=\"{$gw_group['name']}\">{$gw_group['name']}</option>\n";
|
1139 |
|
|
}
|
1140 |
|
|
}
|
1141 |
|
|
}
|
1142 |
8ab3e9ed
|
Erik Kristensen
|
?>
|
1143 |
0239d8ee
|
sullrich
|
</select>
|
1144 |
|
|
<p><strong>Leave as 'default' to use the system routing table. Or choose a gateway to utilize policy based routing.</strong></p>
|
1145 |
|
|
</div>
|
1146 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
1147 |
|
|
</tr>
|
1148 |
a5fd67e1
|
Ermal Luçi
|
<tr>
|
1149 |
|
|
<td width="22%" valign="top" class="vncell">In/Out</td>
|
1150 |
|
|
<td width="78%" class="vtable">
|
1151 |
4c263f57
|
sullrich
|
<div id="showadvinoutbox">
|
1152 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_inout()" value="Advanced"></input> - Show advanced option</a>
|
1153 |
4c263f57
|
sullrich
|
</div>
|
1154 |
|
|
<div id="showinoutadv" style="display:none">
|
1155 |
|
|
<select name="dnpipe">
|
1156 |
a5fd67e1
|
Ermal Luçi
|
<?php
|
1157 |
|
|
if (!is_array($dnqlist))
|
1158 |
|
|
$dnqlist = array();
|
1159 |
|
|
echo "<option value=\"none\"";
|
1160 |
|
|
if (!$dnqselected) echo " SELECTED";
|
1161 |
|
|
echo " >none</option>";
|
1162 |
|
|
foreach ($dnqlist as $dnq => $dnqkey) {
|
1163 |
|
|
if($dnq == "")
|
1164 |
|
|
continue;
|
1165 |
|
|
echo "<option value=\"$dnqkey\"";
|
1166 |
|
|
if ($dnqkey == $pconfig['dnpipe']) {
|
1167 |
|
|
$dnqselected = 1;
|
1168 |
|
|
echo " SELECTED";
|
1169 |
|
|
}
|
1170 |
|
|
echo ">{$dnq}</option>";
|
1171 |
|
|
}
|
1172 |
|
|
?>
|
1173 |
|
|
</select> /
|
1174 |
|
|
<select name="pdnpipe">
|
1175 |
|
|
<?php
|
1176 |
|
|
$dnqselected = 0;
|
1177 |
|
|
echo "<option value=\"none\"";
|
1178 |
|
|
if (!$dnqselected) echo " SELECTED";
|
1179 |
|
|
echo " >none</option>";
|
1180 |
|
|
foreach ($dnqlist as $dnq => $dnqkey) {
|
1181 |
|
|
if($dnq == "")
|
1182 |
|
|
continue;
|
1183 |
|
|
echo "<option value=\"$dnqkey\"";
|
1184 |
|
|
if ($dnqkey == $pconfig['pdnpipe']) {
|
1185 |
|
|
$dnqselected = 1;
|
1186 |
|
|
echo " SELECTED";
|
1187 |
|
|
}
|
1188 |
|
|
echo ">{$dnq}</option>";
|
1189 |
|
|
}
|
1190 |
|
|
?>
|
1191 |
4c263f57
|
sullrich
|
</select>
|
1192 |
a5fd67e1
|
Ermal Luçi
|
<br />
|
1193 |
|
|
<span class="vexpl">Choose the Out queue/Virtual interface only if you have selected In too. <br/> The Out selection is applied to traffic going out the interface the rule is created, In is the incoming one. <br/> If you are creating a rule on the Floating tab if the direction is In then the same rules apply, if the direction is out the selections are reverted Out is for incoming and In is for outgoing and if you do not select any direction use only the In since the Out selection does not make sense in there to prevent oddities.</span>
|
1194 |
4c263f57
|
sullrich
|
</div>
|
1195 |
a5fd67e1
|
Ermal Luçi
|
</td>
|
1196 |
|
|
</tr>
|
1197 |
|
|
|
1198 |
197bfe96
|
Ermal Luçi
|
<tr>
|
1199 |
|
|
<td width="22%" valign="top" class="vncell">Ackqueue/Queue</td>
|
1200 |
|
|
<td width="78%" class="vtable">
|
1201 |
0239d8ee
|
sullrich
|
<div id="showadvackqueuebox">
|
1202 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_ackqueue()" value="Advanced"></input> - Show advanced option</a>
|
1203 |
0239d8ee
|
sullrich
|
</div>
|
1204 |
|
|
<div id="showackqueueadv" style="display:none">
|
1205 |
|
|
<select name="ackqueue">
|
1206 |
197bfe96
|
Ermal Luçi
|
<?php
|
1207 |
0239d8ee
|
sullrich
|
if (!is_array($qlist))
|
1208 |
|
|
$qlist = array();
|
1209 |
|
|
echo "<option value=\"none\"";
|
1210 |
|
|
if (!$qselected) echo " SELECTED";
|
1211 |
|
|
echo " >none</option>";
|
1212 |
|
|
foreach ($qlist as $q => $qkey) {
|
1213 |
|
|
if($q == "")
|
1214 |
|
|
continue;
|
1215 |
|
|
echo "<option value=\"$q\"";
|
1216 |
|
|
if ($q == $pconfig['ackqueue']) {
|
1217 |
|
|
$qselected = 1;
|
1218 |
|
|
echo " SELECTED";
|
1219 |
|
|
}
|
1220 |
|
|
echo ">{$q}</option>";
|
1221 |
197bfe96
|
Ermal Luçi
|
}
|
1222 |
|
|
?>
|
1223 |
0239d8ee
|
sullrich
|
</select> /
|
1224 |
|
|
<select name="defaultqueue">
|
1225 |
197bfe96
|
Ermal Luçi
|
<?php
|
1226 |
0239d8ee
|
sullrich
|
$qselected = 0;
|
1227 |
|
|
echo "<option value=\"none\"";
|
1228 |
|
|
if (!$qselected) echo " SELECTED";
|
1229 |
|
|
echo " >none</option>";
|
1230 |
|
|
foreach ($qlist as $q => $qkey) {
|
1231 |
|
|
if($q == "")
|
1232 |
|
|
continue;
|
1233 |
|
|
echo "<option value=\"$q\"";
|
1234 |
|
|
if ($q == $pconfig['defaultqueue']) {
|
1235 |
|
|
$qselected = 1;
|
1236 |
|
|
echo " SELECTED";
|
1237 |
|
|
}
|
1238 |
|
|
echo ">{$q}</option>";
|
1239 |
197bfe96
|
Ermal Luçi
|
}
|
1240 |
|
|
?>
|
1241 |
0239d8ee
|
sullrich
|
</select>
|
1242 |
|
|
<br />
|
1243 |
|
|
<span class="vexpl">Choose the Acknowledge Queue only if you have selected Queue.</span>
|
1244 |
|
|
</td>
|
1245 |
|
|
</tr>
|
1246 |
|
|
<tr>
|
1247 |
|
|
<td width="22%" valign="top" class="vncell">Layer7</td>
|
1248 |
|
|
<td width="78%" class="vtable">
|
1249 |
4c263f57
|
sullrich
|
<div id="showadvlayer7box">
|
1250 |
75c34cbb
|
sullrich
|
<input type="button" onClick="show_advanced_layer7()" value="Advanced"></input> - Show advanced option</a>
|
1251 |
4c263f57
|
sullrich
|
</div>
|
1252 |
|
|
<div id="showlayer7adv" style="display:none">
|
1253 |
0239d8ee
|
sullrich
|
<select name="l7container">
|
1254 |
7e50413c
|
Ermal Luçi
|
<?php
|
1255 |
0239d8ee
|
sullrich
|
if (!is_array($l7clist))
|
1256 |
06e2a55d
|
thompsa
|
$l7clist = array();
|
1257 |
0239d8ee
|
sullrich
|
echo "<option value=\"none\"";
|
1258 |
|
|
echo " >none</option>";
|
1259 |
|
|
foreach ($l7clist as $l7ckey) {
|
1260 |
|
|
echo "<option value=\"{$l7ckey}\"";
|
1261 |
|
|
if ($l7ckey == $pconfig['l7container']) {
|
1262 |
|
|
echo " SELECTED";
|
1263 |
|
|
}
|
1264 |
|
|
echo ">{$l7ckey}</option>";
|
1265 |
|
|
}
|
1266 |
7e50413c
|
Ermal Luçi
|
?>
|
1267 |
0239d8ee
|
sullrich
|
</select>
|
1268 |
7e50413c
|
Ermal Luçi
|
<br/>
|
1269 |
0239d8ee
|
sullrich
|
<span class="vexpl">
|
1270 |
|
|
Choose a Layer7 container to apply application protocol inspection rules.
|
1271 |
a29dc11b
|
Chris Buechler
|
These are valid for TCP and UDP protocols only.
|
1272 |
0239d8ee
|
sullrich
|
</span>
|
1273 |
|
|
</div>
|
1274 |
7e50413c
|
Ermal Luçi
|
</td>
|
1275 |
|
|
</tr>
|
1276 |
8ab3e9ed
|
Erik Kristensen
|
<tr>
|
1277 |
|
|
<td width="22%" valign="top"> </td>
|
1278 |
|
|
<td width="78%">
|
1279 |
151eb2a9
|
sullrich
|
<br>
|
1280 |
8ab3e9ed
|
Erik Kristensen
|
<input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
1281 |
|
|
<?php if (isset($id) && $a_filter[$id]): ?>
|
1282 |
|
|
<input name="id" type="hidden" value="<?=$id;?>">
|
1283 |
|
|
<?php endif; ?>
|
1284 |
|
|
<input name="after" type="hidden" value="<?=$after;?>">
|
1285 |
|
|
</td>
|
1286 |
82628210
|
Scott Ullrich
|
</tr>
|
1287 |
8ab3e9ed
|
Erik Kristensen
|
</table>
|
1288 |
5b237745
|
Scott Ullrich
|
</form>
|
1289 |
|
|
<script language="JavaScript">
|
1290 |
|
|
<!--
|
1291 |
8ab3e9ed
|
Erik Kristensen
|
ext_change();
|
1292 |
|
|
typesel_change();
|
1293 |
|
|
proto_change();
|
1294 |
19757279
|
Scott Ullrich
|
|
1295 |
|
|
<?php
|
1296 |
8ab3e9ed
|
Erik Kristensen
|
$isfirst = 0;
|
1297 |
|
|
$aliases = "";
|
1298 |
|
|
$addrisfirst = 0;
|
1299 |
|
|
$aliasesaddr = "";
|
1300 |
|
|
if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
|
1301 |
|
|
foreach($config['aliases']['alias'] as $alias_name) {
|
1302 |
72cb5baf
|
Ermal Lu?i
|
switch ($alias_name['type']) {
|
1303 |
|
|
case "port":
|
1304 |
|
|
if($isfirst == 1) $portaliases .= ",";
|
1305 |
|
|
$portaliases .= "'" . $alias_name['name'] . "'";
|
1306 |
8ab3e9ed
|
Erik Kristensen
|
$isfirst = 1;
|
1307 |
72cb5baf
|
Ermal Lu?i
|
break;
|
1308 |
|
|
case "host":
|
1309 |
|
|
case "network":
|
1310 |
|
|
case "openvpn":
|
1311 |
c7de8be4
|
jim-p
|
case "urltable":
|
1312 |
8ab3e9ed
|
Erik Kristensen
|
if($addrisfirst == 1) $aliasesaddr .= ",";
|
1313 |
|
|
$aliasesaddr .= "'" . $alias_name['name'] . "'";
|
1314 |
|
|
$addrisfirst = 1;
|
1315 |
72cb5baf
|
Ermal Lu?i
|
break;
|
1316 |
|
|
default:
|
1317 |
|
|
break;
|
1318 |
8ab3e9ed
|
Erik Kristensen
|
}
|
1319 |
092ac49d
|
Scott Ullrich
|
}
|
1320 |
19757279
|
Scott Ullrich
|
?>
|
1321 |
|
|
|
1322 |
8ab3e9ed
|
Erik Kristensen
|
var addressarray=new Array(<?php echo $aliasesaddr; ?>);
|
1323 |
72cb5baf
|
Ermal Lu?i
|
var customarray=new Array(<?php echo $portaliases; ?>);
|
1324 |
19757279
|
Scott Ullrich
|
|
1325 |
9eb60dcc
|
Ermal Lu?i
|
var oTextbox1 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
|
1326 |
|
|
var oTextbox2 = new AutoSuggestControl(document.getElementById("srcbeginport_cust"), new StateSuggestions(customarray));
|
1327 |
|
|
var oTextbox3 = new AutoSuggestControl(document.getElementById("srcendport_cust"), new StateSuggestions(customarray));
|
1328 |
|
|
var oTextbox4 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
|
1329 |
|
|
var oTextbox5 = new AutoSuggestControl(document.getElementById("dstbeginport_cust"), new StateSuggestions(customarray));
|
1330 |
|
|
var oTextbox6 = new AutoSuggestControl(document.getElementById("dstendport_cust"), new StateSuggestions(customarray));
|
1331 |
5b237745
|
Scott Ullrich
|
//-->
|
1332 |
|
|
</script>
|
1333 |
|
|
<?php include("fend.inc"); ?>
|
1334 |
|
|
</body>
|
1335 |
9b45f821
|
Ermal Lu?i
|
</html>
|