1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
5ba18897
|
Scott Ullrich
|
<?php
|
3 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
4 |
5b237745
|
Scott Ullrich
|
/*
|
5 |
bdb7d6e7
|
Scott Ullrich
|
firewall_rules_edit.php
|
6 |
e4cabb75
|
Scott Ullrich
|
part of pfSense (http://www.pfsense.com)
|
7 |
|
|
Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
|
8 |
5ba18897
|
Scott Ullrich
|
|
9 |
e4cabb75
|
Scott Ullrich
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
10 |
bdb7d6e7
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
All rights reserved.
|
12 |
5ba18897
|
Scott Ullrich
|
|
13 |
bdb7d6e7
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
14 |
|
|
modification, are permitted provided that the following conditions are met:
|
15 |
5ba18897
|
Scott Ullrich
|
|
16 |
bdb7d6e7
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
17 |
|
|
this list of conditions and the following disclaimer.
|
18 |
5ba18897
|
Scott Ullrich
|
|
19 |
bdb7d6e7
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
20 |
|
|
notice, this list of conditions and the following disclaimer in the
|
21 |
|
|
documentation and/or other materials provided with the distribution.
|
22 |
5ba18897
|
Scott Ullrich
|
|
23 |
bdb7d6e7
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
33 |
5b237745
|
Scott Ullrich
|
*/
|
34 |
|
|
|
35 |
|
|
require("guiconfig.inc");
|
36 |
|
|
|
37 |
35126a79
|
Scott Ullrich
|
$specialsrcdst = explode(" ", "any lan pptp pppoe");
|
38 |
5b237745
|
Scott Ullrich
|
|
39 |
|
|
if (!is_array($config['filter']['rule'])) {
|
40 |
|
|
$config['filter']['rule'] = array();
|
41 |
|
|
}
|
42 |
|
|
filter_rules_sort();
|
43 |
|
|
$a_filter = &$config['filter']['rule'];
|
44 |
|
|
|
45 |
|
|
$id = $_GET['id'];
|
46 |
|
|
if (is_numeric($_POST['id']))
|
47 |
|
|
$id = $_POST['id'];
|
48 |
5ba18897
|
Scott Ullrich
|
|
49 |
5b237745
|
Scott Ullrich
|
$after = $_GET['after'];
|
50 |
|
|
|
51 |
|
|
if (isset($_POST['after']))
|
52 |
|
|
$after = $_POST['after'];
|
53 |
|
|
|
54 |
|
|
if (isset($_GET['dup'])) {
|
55 |
|
|
$id = $_GET['dup'];
|
56 |
|
|
$after = $_GET['dup'];
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
if (isset($id) && $a_filter[$id]) {
|
60 |
|
|
$pconfig['interface'] = $a_filter[$id]['interface'];
|
61 |
5ba18897
|
Scott Ullrich
|
|
62 |
5b237745
|
Scott Ullrich
|
if (!isset($a_filter[$id]['type']))
|
63 |
|
|
$pconfig['type'] = "pass";
|
64 |
|
|
else
|
65 |
|
|
$pconfig['type'] = $a_filter[$id]['type'];
|
66 |
5ba18897
|
Scott Ullrich
|
|
67 |
5b237745
|
Scott Ullrich
|
if (isset($a_filter[$id]['protocol']))
|
68 |
|
|
$pconfig['proto'] = $a_filter[$id]['protocol'];
|
69 |
|
|
else
|
70 |
|
|
$pconfig['proto'] = "any";
|
71 |
5ba18897
|
Scott Ullrich
|
|
72 |
5b237745
|
Scott Ullrich
|
if ($a_filter[$id]['protocol'] == "icmp")
|
73 |
|
|
$pconfig['icmptype'] = $a_filter[$id]['icmptype'];
|
74 |
5ba18897
|
Scott Ullrich
|
|
75 |
5b237745
|
Scott Ullrich
|
address_to_pconfig($a_filter[$id]['source'], $pconfig['src'],
|
76 |
|
|
$pconfig['srcmask'], $pconfig['srcnot'],
|
77 |
|
|
$pconfig['srcbeginport'], $pconfig['srcendport']);
|
78 |
5ba18897
|
Scott Ullrich
|
|
79 |
8be60f21
|
Scott Ullrich
|
if($a_filter[$id]['os'] <> "")
|
80 |
|
|
$pconfig['os'] = $a_filter[$id]['os'];
|
81 |
e33c8694
|
Bill Marquette
|
|
82 |
5b237745
|
Scott Ullrich
|
address_to_pconfig($a_filter[$id]['destination'], $pconfig['dst'],
|
83 |
|
|
$pconfig['dstmask'], $pconfig['dstnot'],
|
84 |
|
|
$pconfig['dstbeginport'], $pconfig['dstendport']);
|
85 |
|
|
|
86 |
|
|
$pconfig['disabled'] = isset($a_filter[$id]['disabled']);
|
87 |
|
|
$pconfig['log'] = isset($a_filter[$id]['log']);
|
88 |
|
|
$pconfig['descr'] = $a_filter[$id]['descr'];
|
89 |
ed08ef3e
|
Scott Ullrich
|
|
90 |
|
|
/* advanced */
|
91 |
fa9af164
|
Scott Ullrich
|
$pconfig['max-src-nodes'] = $a_filter[$id]['max-src-nodes'];
|
92 |
|
|
$pconfig['max-src-states'] = $a_filter[$id]['max-src-states'];
|
93 |
|
|
$pconfig['statetype'] = $a_filter[$id]['statetype'];
|
94 |
5ba18897
|
Scott Ullrich
|
$pconfig['statetimeout'] = $a_filter[$id]['statetimeout'];
|
95 |
ed08ef3e
|
Scott Ullrich
|
|
96 |
|
|
/* advanced - new connection per second banning*/
|
97 |
|
|
$pconfig['max-src-conn-rate'] = $a_filter[$id]['max-src-conn-rate'];
|
98 |
|
|
$pconfig['max-src-conn-rates'] = $a_filter[$id]['max-src-conn-rates'];
|
99 |
5ba18897
|
Scott Ullrich
|
|
100 |
e5980370
|
Scott Ullrich
|
/* Multi-WAN next-hop support */
|
101 |
c98ddde2
|
Bill Marquette
|
$pconfig['gateway'] = $a_filter[$id]['gateway'];
|
102 |
|
|
|
103 |
5b237745
|
Scott Ullrich
|
} else {
|
104 |
|
|
/* defaults */
|
105 |
a23d7248
|
Scott Ullrich
|
if ($_GET['if'])
|
106 |
|
|
$pconfig['interface'] = $_GET['if'];
|
107 |
5b237745
|
Scott Ullrich
|
$pconfig['type'] = "pass";
|
108 |
|
|
$pconfig['src'] = "any";
|
109 |
|
|
$pconfig['dst'] = "any";
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
if (isset($_GET['dup']))
|
113 |
|
|
unset($id);
|
114 |
|
|
|
115 |
|
|
if ($_POST) {
|
116 |
|
|
|
117 |
|
|
if (($_POST['proto'] != "tcp") && ($_POST['proto'] != "udp") && ($_POST['proto'] != "tcp/udp")) {
|
118 |
|
|
$_POST['srcbeginport'] = 0;
|
119 |
|
|
$_POST['srcendport'] = 0;
|
120 |
|
|
$_POST['dstbeginport'] = 0;
|
121 |
|
|
$_POST['dstendport'] = 0;
|
122 |
|
|
} else {
|
123 |
5ba18897
|
Scott Ullrich
|
|
124 |
5b237745
|
Scott Ullrich
|
if ($_POST['srcbeginport_cust'] && !$_POST['srcbeginport'])
|
125 |
|
|
$_POST['srcbeginport'] = $_POST['srcbeginport_cust'];
|
126 |
|
|
if ($_POST['srcendport_cust'] && !$_POST['srcendport'])
|
127 |
|
|
$_POST['srcendport'] = $_POST['srcendport_cust'];
|
128 |
5ba18897
|
Scott Ullrich
|
|
129 |
5b237745
|
Scott Ullrich
|
if ($_POST['srcbeginport'] == "any") {
|
130 |
|
|
$_POST['srcbeginport'] = 0;
|
131 |
|
|
$_POST['srcendport'] = 0;
|
132 |
5ba18897
|
Scott Ullrich
|
} else {
|
133 |
5b237745
|
Scott Ullrich
|
if (!$_POST['srcendport'])
|
134 |
|
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
135 |
|
|
}
|
136 |
|
|
if ($_POST['srcendport'] == "any")
|
137 |
|
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
138 |
5ba18897
|
Scott Ullrich
|
|
139 |
5b237745
|
Scott Ullrich
|
if ($_POST['dstbeginport_cust'] && !$_POST['dstbeginport'])
|
140 |
|
|
$_POST['dstbeginport'] = $_POST['dstbeginport_cust'];
|
141 |
|
|
if ($_POST['dstendport_cust'] && !$_POST['dstendport'])
|
142 |
|
|
$_POST['dstendport'] = $_POST['dstendport_cust'];
|
143 |
5ba18897
|
Scott Ullrich
|
|
144 |
5b237745
|
Scott Ullrich
|
if ($_POST['dstbeginport'] == "any") {
|
145 |
|
|
$_POST['dstbeginport'] = 0;
|
146 |
|
|
$_POST['dstendport'] = 0;
|
147 |
5ba18897
|
Scott Ullrich
|
} else {
|
148 |
5b237745
|
Scott Ullrich
|
if (!$_POST['dstendport'])
|
149 |
|
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
150 |
|
|
}
|
151 |
|
|
if ($_POST['dstendport'] == "any")
|
152 |
5ba18897
|
Scott Ullrich
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
153 |
5b237745
|
Scott Ullrich
|
}
|
154 |
5ba18897
|
Scott Ullrich
|
|
155 |
5b237745
|
Scott Ullrich
|
if (is_specialnet($_POST['srctype'])) {
|
156 |
|
|
$_POST['src'] = $_POST['srctype'];
|
157 |
|
|
$_POST['srcmask'] = 0;
|
158 |
|
|
} else if ($_POST['srctype'] == "single") {
|
159 |
|
|
$_POST['srcmask'] = 32;
|
160 |
|
|
}
|
161 |
|
|
if (is_specialnet($_POST['dsttype'])) {
|
162 |
|
|
$_POST['dst'] = $_POST['dsttype'];
|
163 |
|
|
$_POST['dstmask'] = 0;
|
164 |
|
|
} else if ($_POST['dsttype'] == "single") {
|
165 |
|
|
$_POST['dstmask'] = 32;
|
166 |
|
|
}
|
167 |
5ba18897
|
Scott Ullrich
|
|
168 |
5b237745
|
Scott Ullrich
|
unset($input_errors);
|
169 |
|
|
$pconfig = $_POST;
|
170 |
|
|
|
171 |
|
|
/* input validation */
|
172 |
|
|
$reqdfields = explode(" ", "type interface proto src dst");
|
173 |
|
|
$reqdfieldsn = explode(",", "Type,Interface,Protocol,Source,Destination");
|
174 |
|
|
|
175 |
bdb7d6e7
|
Scott Ullrich
|
|
176 |
|
|
if($_POST['statetype'] == "modulate state" or $_POST['statetype'] == "synproxy state")
|
177 |
c22767b1
|
Bill Marquette
|
if( $_POST['proto'] != "tcp" )
|
178 |
|
|
$input_errors[] = "{$_POST['statetype']} is only valid with protocol tcp.";
|
179 |
bdb7d6e7
|
Scott Ullrich
|
|
180 |
5ba18897
|
Scott Ullrich
|
|
181 |
5b237745
|
Scott Ullrich
|
if (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single"))) {
|
182 |
|
|
$reqdfields[] = "srcmask";
|
183 |
|
|
$reqdfieldsn[] = "Source bit count";
|
184 |
|
|
}
|
185 |
|
|
if (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single"))) {
|
186 |
|
|
$reqdfields[] = "dstmask";
|
187 |
|
|
$reqdfieldsn[] = "Destination bit count";
|
188 |
|
|
}
|
189 |
5ba18897
|
Scott Ullrich
|
|
190 |
5b237745
|
Scott Ullrich
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
191 |
5ba18897
|
Scott Ullrich
|
|
192 |
5b237745
|
Scott Ullrich
|
if (!$_POST['srcbeginport']) {
|
193 |
|
|
$_POST['srcbeginport'] = 0;
|
194 |
|
|
$_POST['srcendport'] = 0;
|
195 |
|
|
}
|
196 |
|
|
if (!$_POST['dstbeginport']) {
|
197 |
|
|
$_POST['dstbeginport'] = 0;
|
198 |
|
|
$_POST['dstendport'] = 0;
|
199 |
|
|
}
|
200 |
5ba18897
|
Scott Ullrich
|
|
201 |
19757279
|
Scott Ullrich
|
if (($_POST['srcbeginport'] && !alias_expand($_POST['srcbeginport']) && !is_port($_POST['srcbeginport']))) {
|
202 |
aba8aace
|
Scott Ullrich
|
$input_errors[] = "The start source port must be an alias or integer between 1 and 65535.";
|
203 |
bdb7d6e7
|
Scott Ullrich
|
}
|
204 |
19757279
|
Scott Ullrich
|
if (($_POST['srcendport'] && !alias_expand($_POST['srcendport']) && !is_port($_POST['srcendport']))) {
|
205 |
aba8aace
|
Scott Ullrich
|
$input_errors[] = "The end source port must be an alias or integer between 1 and 65535.";
|
206 |
bdb7d6e7
|
Scott Ullrich
|
}
|
207 |
19757279
|
Scott Ullrich
|
if (($_POST['dstbeginport'] && !alias_expand($_POST['dstbeginport']) && !is_port($_POST['dstbeginport']))) {
|
208 |
aba8aace
|
Scott Ullrich
|
$input_errors[] = "The start destination port must be an alias or integer between 1 and 65535.";
|
209 |
bdb7d6e7
|
Scott Ullrich
|
}
|
210 |
19757279
|
Scott Ullrich
|
if (($_POST['dstendport'] && !alias_expand($_POST['dstbeginport']) && !is_port($_POST['dstendport']))) {
|
211 |
aba8aace
|
Scott Ullrich
|
$input_errors[] = "The end destination port must be an alias or integer between 1 and 65535.";
|
212 |
bdb7d6e7
|
Scott Ullrich
|
}
|
213 |
5ba18897
|
Scott Ullrich
|
|
214 |
5b237745
|
Scott Ullrich
|
if (!is_specialnet($_POST['srctype'])) {
|
215 |
|
|
if (($_POST['src'] && !is_ipaddroranyalias($_POST['src']))) {
|
216 |
|
|
$input_errors[] = "A valid source IP address or alias must be specified.";
|
217 |
|
|
}
|
218 |
|
|
if (($_POST['srcmask'] && !is_numericint($_POST['srcmask']))) {
|
219 |
|
|
$input_errors[] = "A valid source bit count must be specified.";
|
220 |
|
|
}
|
221 |
|
|
}
|
222 |
|
|
if (!is_specialnet($_POST['dsttype'])) {
|
223 |
|
|
if (($_POST['dst'] && !is_ipaddroranyalias($_POST['dst']))) {
|
224 |
|
|
$input_errors[] = "A valid destination IP address or alias must be specified.";
|
225 |
|
|
}
|
226 |
|
|
if (($_POST['dstmask'] && !is_numericint($_POST['dstmask']))) {
|
227 |
|
|
$input_errors[] = "A valid destination bit count must be specified.";
|
228 |
|
|
}
|
229 |
|
|
}
|
230 |
5ba18897
|
Scott Ullrich
|
|
231 |
5b237745
|
Scott Ullrich
|
if ($_POST['srcbeginport'] > $_POST['srcendport']) {
|
232 |
|
|
/* swap */
|
233 |
|
|
$tmp = $_POST['srcendport'];
|
234 |
|
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
235 |
|
|
$_POST['srcbeginport'] = $tmp;
|
236 |
|
|
}
|
237 |
|
|
if ($_POST['dstbeginport'] > $_POST['dstendport']) {
|
238 |
|
|
/* swap */
|
239 |
|
|
$tmp = $_POST['dstendport'];
|
240 |
|
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
241 |
|
|
$_POST['dstbeginport'] = $tmp;
|
242 |
|
|
}
|
243 |
e33c8694
|
Bill Marquette
|
if ($_POST['os'])
|
244 |
|
|
if( $_POST['proto'] != "tcp" )
|
245 |
|
|
$input_errors[] = "OS detection is only valid with protocol tcp.";
|
246 |
5b237745
|
Scott Ullrich
|
|
247 |
|
|
if (!$input_errors) {
|
248 |
|
|
$filterent = array();
|
249 |
|
|
$filterent['type'] = $_POST['type'];
|
250 |
|
|
$filterent['interface'] = $_POST['interface'];
|
251 |
d59874c1
|
Scott Ullrich
|
|
252 |
bdb7d6e7
|
Scott Ullrich
|
/* Advanced options */
|
253 |
|
|
$filterent['max-src-nodes'] = $_POST['max-src-nodes'];
|
254 |
|
|
$filterent['max-src-states'] = $_POST['max-src-states'];
|
255 |
5ba18897
|
Scott Ullrich
|
$filterent['statetimeout'] = $_POST['statetimeout'];
|
256 |
fa9af164
|
Scott Ullrich
|
$filterent['statetype'] = $_POST['statetype'];
|
257 |
e33c8694
|
Bill Marquette
|
$filterent['os'] = $_POST['os'];
|
258 |
f87f85c3
|
Bill Marquette
|
$filterent['max-src-conn-rate'] = $_POST['max-src-conn-rate'];
|
259 |
|
|
$filterent['max-src-conn-rates'] = $_POST['max-src-conn-rates'];
|
260 |
5ba18897
|
Scott Ullrich
|
|
261 |
5b237745
|
Scott Ullrich
|
if ($_POST['proto'] != "any")
|
262 |
|
|
$filterent['protocol'] = $_POST['proto'];
|
263 |
|
|
else
|
264 |
|
|
unset($filterent['protocol']);
|
265 |
5ba18897
|
Scott Ullrich
|
|
266 |
5b237745
|
Scott Ullrich
|
if ($_POST['proto'] == "icmp" && $_POST['icmptype'])
|
267 |
|
|
$filterent['icmptype'] = $_POST['icmptype'];
|
268 |
|
|
else
|
269 |
|
|
unset($filterent['icmptype']);
|
270 |
5ba18897
|
Scott Ullrich
|
|
271 |
5b237745
|
Scott Ullrich
|
pconfig_to_address($filterent['source'], $_POST['src'],
|
272 |
|
|
$_POST['srcmask'], $_POST['srcnot'],
|
273 |
|
|
$_POST['srcbeginport'], $_POST['srcendport']);
|
274 |
5ba18897
|
Scott Ullrich
|
|
275 |
5b237745
|
Scott Ullrich
|
pconfig_to_address($filterent['destination'], $_POST['dst'],
|
276 |
|
|
$_POST['dstmask'], $_POST['dstnot'],
|
277 |
|
|
$_POST['dstbeginport'], $_POST['dstendport']);
|
278 |
5ba18897
|
Scott Ullrich
|
|
279 |
f87f85c3
|
Bill Marquette
|
if ($_POST['disabled'])
|
280 |
|
|
$filterent['disabled'] = true;
|
281 |
|
|
else
|
282 |
|
|
unset($filterent['disabled']);
|
283 |
|
|
if ($_POST['log'])
|
284 |
|
|
$filterent['log'] = true;
|
285 |
|
|
else
|
286 |
|
|
unset($filterent['log']);
|
287 |
c68fc1e7
|
Bill Marquette
|
strncpy($filterent['descr'], $_POST['descr'], 52);
|
288 |
5ba18897
|
Scott Ullrich
|
|
289 |
c98ddde2
|
Bill Marquette
|
if ($_POST['gateway'] != "") {
|
290 |
|
|
$filterent['gateway'] = $_POST['gateway'];
|
291 |
|
|
}
|
292 |
|
|
|
293 |
5b237745
|
Scott Ullrich
|
if (isset($id) && $a_filter[$id])
|
294 |
|
|
$a_filter[$id] = $filterent;
|
295 |
|
|
else {
|
296 |
|
|
if (is_numeric($after))
|
297 |
|
|
array_splice($a_filter, $after+1, 0, array($filterent));
|
298 |
|
|
else
|
299 |
|
|
$a_filter[] = $filterent;
|
300 |
|
|
}
|
301 |
f4e2a352
|
Scott Ullrich
|
|
302 |
5b237745
|
Scott Ullrich
|
write_config();
|
303 |
|
|
touch($d_filterconfdirty_path);
|
304 |
5ba18897
|
Scott Ullrich
|
|
305 |
a23d7248
|
Scott Ullrich
|
header("Location: firewall_rules.php?if=" . $_POST['interface']);
|
306 |
5b237745
|
Scott Ullrich
|
exit;
|
307 |
|
|
}
|
308 |
c60824d2
|
Scott Ullrich
|
}
|
309 |
|
|
|
310 |
da7ae7ef
|
Bill Marquette
|
$pgtitle = "Firewall: Rules: Edit";
|
311 |
a1357fe0
|
Bill Marquette
|
$closehead = false;
|
312 |
8ab3e9ed
|
Erik Kristensen
|
|
313 |
|
|
$page_filename = "firewall_rules_edit.php";
|
314 |
da7ae7ef
|
Bill Marquette
|
include("head.inc");
|
315 |
c60824d2
|
Scott Ullrich
|
|
316 |
5b237745
|
Scott Ullrich
|
?>
|
317 |
da7ae7ef
|
Bill Marquette
|
|
318 |
5b237745
|
Scott Ullrich
|
</head>
|
319 |
|
|
|
320 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
321 |
|
|
<?php include("fbegin.inc"); ?>
|
322 |
da7ae7ef
|
Bill Marquette
|
<p class="pgtitle"><?=$pgtitle?></p>
|
323 |
5b237745
|
Scott Ullrich
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
324 |
8ab3e9ed
|
Erik Kristensen
|
|
325 |
|
|
<form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
|
326 |
|
|
<? display_topbar() ?>
|
327 |
|
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
328 |
|
|
<tr>
|
329 |
|
|
<td width="22%" valign="top" class="vncellreq">Action</td>
|
330 |
|
|
<td width="78%" class="vtable">
|
331 |
|
|
<select name="type" class="formfld">
|
332 |
|
|
<?php $types = explode(" ", "Pass Block Reject"); foreach ($types as $type): ?>
|
333 |
|
|
<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['type'])) echo "selected"; ?>>
|
334 |
|
|
<?=htmlspecialchars($type);?>
|
335 |
|
|
</option>
|
336 |
|
|
<?php endforeach; ?>
|
337 |
|
|
</select>
|
338 |
|
|
<br/>
|
339 |
|
|
<span class="vexpl">
|
340 |
|
|
Choose what to do with packets that match the criteria specified below. <br/>
|
341 |
|
|
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. Reject only works when the protocol is set to either TCP or UDP (but not "TCP/UDP") below.
|
342 |
|
|
</span>
|
343 |
|
|
</td>
|
344 |
|
|
</tr>
|
345 |
|
|
<tr>
|
346 |
|
|
<td width="22%" valign="top" class="vncellreq">Disabled</td>
|
347 |
|
|
<td width="78%" class="vtable">
|
348 |
|
|
<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked"; ?>>
|
349 |
|
|
<strong>Disable this rule</strong><br />
|
350 |
|
|
<span class="vexpl">Set this option to disable this rule without removing it from the list.</span>
|
351 |
|
|
</td>
|
352 |
|
|
</tr>
|
353 |
|
|
<tr>
|
354 |
|
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
355 |
|
|
<td width="78%" class="vtable">
|
356 |
|
|
<select name="interface" class="formfld">
|
357 |
|
|
<?php
|
358 |
|
|
$interfaces = array('wan' => 'WAN', 'lan' => 'LAN', 'pptp' => 'PPTP', 'pppoe' => 'PPPOE');
|
359 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
360 |
|
|
$interfaces['opt' . $i] = $config['interfaces']['opt' . $i]['descr'];
|
361 |
|
|
}
|
362 |
|
|
foreach ($interfaces as $iface => $ifacename): ?>
|
363 |
|
|
<option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>><?=htmlspecialchars($ifacename);?></option>
|
364 |
|
|
<?php endforeach; ?>
|
365 |
|
|
</select>
|
366 |
|
|
<br />
|
367 |
|
|
<span class="vexpl">Choose on which interface packets must come in to match this rule.</span>
|
368 |
|
|
</td>
|
369 |
|
|
</tr>
|
370 |
|
|
<tr>
|
371 |
|
|
<td width="22%" valign="top" class="vncellreq">Protocol</td>
|
372 |
|
|
<td width="78%" class="vtable">
|
373 |
|
|
<select name="proto" class="formfld" onchange="proto_change()">
|
374 |
|
|
<?php
|
375 |
|
|
$protocols = explode(" ", "TCP UDP TCP/UDP ICMP ICMP6 ESP AH GRE IPv6 IGMP any carp pfsync");
|
376 |
|
|
foreach ($protocols as $proto): ?>
|
377 |
|
|
<option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>><?=htmlspecialchars($proto);?></option>
|
378 |
|
|
<?php endforeach; ?>
|
379 |
|
|
</select>
|
380 |
|
|
<br />
|
381 |
|
|
<span class="vexpl">Choose which IP protocol this rule should match. <br /> Hint: in most cases, you should specify <em>TCP</em> here.</span>
|
382 |
|
|
</td>
|
383 |
|
|
</tr>
|
384 |
|
|
<tr>
|
385 |
|
|
<td valign="top" class="vncell">ICMP type</td>
|
386 |
|
|
<td class="vtable">
|
387 |
|
|
<select name="icmptype" class="formfld">
|
388 |
|
|
<?php
|
389 |
|
|
$icmptypes = array(
|
390 |
|
|
"" => "any",
|
391 |
|
|
"echorep" => "Echo reply",
|
392 |
|
|
"unreach" => "Destination unreachable",
|
393 |
|
|
"squench" => "Source quench",
|
394 |
|
|
"redir" => "Redirect",
|
395 |
|
|
"althost" => "Alternate Host",
|
396 |
|
|
"echoreq" => "Echo",
|
397 |
|
|
"routeradv" => "Router advertisement",
|
398 |
|
|
"routersol" => "Router solicitation",
|
399 |
|
|
"timex" => "Time exceeded",
|
400 |
|
|
"paramprob" => "Invalid IP header",
|
401 |
|
|
"timereq" => "Timestamp",
|
402 |
|
|
"timerep" => "Timestamp reply",
|
403 |
|
|
"inforeq" => "Information request",
|
404 |
|
|
"inforep" => "Information reply",
|
405 |
|
|
"maskreq" => "Address mask request",
|
406 |
|
|
"maskrep" => "Address mask reply"
|
407 |
|
|
);
|
408 |
|
|
|
409 |
|
|
foreach ($icmptypes as $icmptype => $descr): ?>
|
410 |
|
|
<option value="<?=$icmptype;?>" <?php if ($icmptype == $pconfig['icmptype']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
|
411 |
|
|
<?php endforeach; ?>
|
412 |
|
|
</select>
|
413 |
|
|
<br />
|
414 |
|
|
<span class="vexpl">If you selected ICMP for the protocol above, you may specify an ICMP type here.</span>
|
415 |
|
|
</td>
|
416 |
|
|
</tr>
|
417 |
|
|
<tr>
|
418 |
|
|
<td width="22%" valign="top" class="vncellreq">Source</td>
|
419 |
|
|
<td width="78%" class="vtable">
|
420 |
|
|
<input name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>>
|
421 |
|
|
<strong>not</strong>
|
422 |
|
|
<br />
|
423 |
|
|
Use this option to invert the sense of the match.
|
424 |
|
|
<br />
|
425 |
|
|
<br />
|
426 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
427 |
|
|
<tr>
|
428 |
|
|
<td>Type: </td>
|
429 |
|
|
<td>
|
430 |
|
|
<select name="srctype" class="formfld" onChange="typesel_change()">
|
431 |
|
|
<?php
|
432 |
|
|
$sel = is_specialnet($pconfig['src']); ?>
|
433 |
|
|
<option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>>any</option>
|
434 |
|
|
<option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
|
435 |
|
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
|
436 |
|
|
<option value="lan" <?php if ($pconfig['src'] == "lan") { echo "selected"; } ?>>LAN subnet</option>
|
437 |
|
|
<option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
|
438 |
|
|
<option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
|
439 |
|
|
<?php
|
440 |
|
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): ?>
|
441 |
|
|
<option value="opt<?=$i;?>" <?php if ($pconfig['src'] == "opt" . $i) { echo "selected"; } ?>><?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> subnet</option>
|
442 |
|
|
<?php endfor; ?>
|
443 |
|
|
</select>
|
444 |
|
|
</td>
|
445 |
|
|
</tr>
|
446 |
|
|
<tr>
|
447 |
|
|
<td>Address: </td>
|
448 |
|
|
<td>
|
449 |
|
|
<input autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> /
|
450 |
|
|
<select name="srcmask" class="formfld" id="srcmask">
|
451 |
|
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
452 |
|
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
|
453 |
|
|
<?php endfor; ?>
|
454 |
|
|
</select>
|
455 |
bdb7d6e7
|
Scott Ullrich
|
</td>
|
456 |
8ab3e9ed
|
Erik Kristensen
|
</tr>
|
457 |
|
|
</table>
|
458 |
|
|
</td>
|
459 |
e33c8694
|
Bill Marquette
|
</tr>
|
460 |
5ba18897
|
Scott Ullrich
|
<tr>
|
461 |
8ab3e9ed
|
Erik Kristensen
|
<td width="22%" valign="top" class="vncellreq">Source port range</td>
|
462 |
|
|
<td width="78%" class="vtable">
|
463 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
464 |
|
|
<tr>
|
465 |
|
|
<td>from: </td>
|
466 |
|
|
<td>
|
467 |
|
|
<select name="srcbeginport" class="formfld" onchange="src_rep_change();ext_change()">
|
468 |
|
|
<option value="">(other)</option>
|
469 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
470 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
471 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
472 |
|
|
<?php endforeach; ?>
|
473 |
|
|
</select>
|
474 |
|
|
<input autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo $pconfig['srcbeginport']; ?>">
|
475 |
|
|
</td>
|
476 |
|
|
</tr>
|
477 |
|
|
<tr>
|
478 |
|
|
<td>to:</td>
|
479 |
|
|
<td>
|
480 |
|
|
<select name="srcendport" class="formfld" onchange="ext_change()">
|
481 |
|
|
<option value="">(other)</option>
|
482 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['srcendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
483 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
484 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
485 |
|
|
<?php endforeach; ?>
|
486 |
|
|
</select>
|
487 |
|
|
<input autocomplete='off' class="formfldalias" name="srcendport_cust" id="srcendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcendport']) echo $pconfig['srcendport']; ?>">
|
488 |
|
|
</td>
|
489 |
|
|
</tr>
|
490 |
|
|
</table>
|
491 |
|
|
<br />
|
492 |
|
|
<span class="vexpl">Specify the port or port range for the source of the packet for this rule. This is usually not equal to the destination port range (and is often "any"). <br /> Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port</span>
|
493 |
|
|
</td>
|
494 |
|
|
</tr>
|
495 |
|
|
<tr>
|
496 |
|
|
<td width="22%" valign="top" class="vncellreq">Source OS</td>
|
497 |
|
|
<td width="78%" class="vtable">OS Type:
|
498 |
|
|
<select name="os" id="os" class="formfld">
|
499 |
|
|
<?php
|
500 |
|
|
$ostypes = array(
|
501 |
|
|
"" => "any",
|
502 |
|
|
"AIX" => "AIX",
|
503 |
|
|
"Linux" => "Linux",
|
504 |
|
|
"FreeBSD" => "FreeBSD",
|
505 |
|
|
"NetBSD" => "NetBSD",
|
506 |
|
|
"OpenBSD" => "OpenBSD",
|
507 |
|
|
"Solaris" => "Solaris",
|
508 |
|
|
"MacOS" => "MacOS",
|
509 |
|
|
"Windows" => "Windows",
|
510 |
|
|
"Novell" => "Novell"
|
511 |
|
|
);
|
512 |
|
|
|
513 |
|
|
foreach ($ostypes as $ostype => $descr): ?>
|
514 |
|
|
<option value="<?=$ostype;?>" <?php if ($ostype == $pconfig['os']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
|
515 |
|
|
<?php endforeach; ?>
|
516 |
|
|
</select>
|
517 |
|
|
<br />
|
518 |
|
|
Note: this only works for TCP rules
|
519 |
|
|
</td>
|
520 |
5ba18897
|
Scott Ullrich
|
</tr>
|
521 |
8ab3e9ed
|
Erik Kristensen
|
<tr>
|
522 |
|
|
<td width="22%" valign="top" class="vncellreq">Destination</td>
|
523 |
|
|
<td width="78%" class="vtable">
|
524 |
|
|
<input name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked"; ?>>
|
525 |
|
|
<strong>not</strong>
|
526 |
|
|
<br />
|
527 |
|
|
Use this option to invert the sense of the match.
|
528 |
|
|
<br />
|
529 |
|
|
<br />
|
530 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
531 |
|
|
<tr>
|
532 |
|
|
<td>Type: </td>
|
533 |
|
|
<td>
|
534 |
|
|
<select name="dsttype" class="formfld" onChange="typesel_change()">
|
535 |
|
|
<?php
|
536 |
|
|
$sel = is_specialnet($pconfig['dst']); ?>
|
537 |
|
|
<option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>>any</option>
|
538 |
|
|
<option value="single" <?php if (($pconfig['dstmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
|
539 |
|
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
|
540 |
|
|
<option value="lan" <?php if ($pconfig['dst'] == "lan") { echo "selected"; } ?>>LAN subnet</option>
|
541 |
|
|
<option value="pptp" <?php if ($pconfig['dst'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
|
542 |
|
|
<option value="pppoe" <?php if ($pconfig['dst'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
|
543 |
|
|
<?php for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): ?>
|
544 |
|
|
<option value="opt<?=$i;?>" <?php if ($pconfig['dst'] == "opt" . $i) { echo "selected"; } ?>><?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?> subnet</option>
|
545 |
|
|
<?php endfor; ?>
|
546 |
|
|
</select>
|
547 |
|
|
</td>
|
548 |
|
|
</tr>
|
549 |
|
|
<tr>
|
550 |
|
|
<td>Address: </td>
|
551 |
|
|
<td>
|
552 |
|
|
<input name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
|
553 |
|
|
/
|
554 |
|
|
<select name="dstmask" class="formfld" id="dstmask">
|
555 |
|
|
<?php
|
556 |
|
|
for ($i = 31; $i > 0; $i--): ?>
|
557 |
|
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option>
|
558 |
|
|
<?php endfor; ?>
|
559 |
|
|
</select>
|
560 |
|
|
</td>
|
561 |
|
|
</tr>
|
562 |
|
|
</table>
|
563 |
5ba18897
|
Scott Ullrich
|
|
564 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
565 |
|
|
</tr>
|
566 |
|
|
<tr>
|
567 |
|
|
<td width="22%" valign="top" class="vncellreq">Destination port range </td>
|
568 |
|
|
<td width="78%" class="vtable">
|
569 |
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
570 |
|
|
<tr>
|
571 |
|
|
<td>from: </td>
|
572 |
|
|
<td>
|
573 |
|
|
<select name="dstbeginport" class="formfld" onchange="dst_rep_change();ext_change()">
|
574 |
|
|
<option value="">(other)</option>
|
575 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['dstbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
576 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
577 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected"; $bfound = 1; }?>><?=htmlspecialchars($wkportdesc);?></option>
|
578 |
|
|
<?php endforeach; ?>
|
579 |
|
|
</select>
|
580 |
|
|
<input autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo $pconfig['dstbeginport']; ?>">
|
581 |
|
|
</td>
|
582 |
|
|
</tr>
|
583 |
|
|
<tr>
|
584 |
|
|
<td>to:</td>
|
585 |
|
|
<td>
|
586 |
|
|
<select name="dstendport" class="formfld" onchange="ext_change()">
|
587 |
|
|
<option value="">(other)</option>
|
588 |
|
|
<option value="any" <?php $bfound = 0; if ($pconfig['dstendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
589 |
|
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
590 |
|
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
591 |
|
|
<?php endforeach; ?>
|
592 |
|
|
</select>
|
593 |
|
|
<input autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo $pconfig['dstendport']; ?>">
|
594 |
|
|
</td>
|
595 |
|
|
</tr>
|
596 |
|
|
</table>
|
597 |
|
|
<br />
|
598 |
|
|
<span class="vexpl">
|
599 |
|
|
Specify the port or port range for the destination of the packet for this rule.
|
600 |
|
|
<br />
|
601 |
|
|
Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port
|
602 |
|
|
</span>
|
603 |
|
|
</td>
|
604 |
|
|
</tr>
|
605 |
|
|
<tr>
|
606 |
|
|
<td width="22%" valign="top" class="vncellreq">Log</td>
|
607 |
|
|
<td width="78%" class="vtable">
|
608 |
|
|
<input name="log" type="checkbox" id="log" value="yes" <?php if ($pconfig['log']) echo "checked"; ?>>
|
609 |
|
|
<strong>Log packets that are handled by this rule</strong>
|
610 |
|
|
<br />
|
611 |
|
|
<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>
|
612 |
|
|
</td>
|
613 |
|
|
</tr>
|
614 |
|
|
<tr>
|
615 |
|
|
<td width="22%" valign="top" class="vncell">Description</td>
|
616 |
|
|
<td width="78%" class="vtable">
|
617 |
|
|
<input name="descr" type="text" class="formfld" id="descr" size="52" maxlength="52" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
618 |
|
|
<br />
|
619 |
|
|
<span class="vexpl">You may enter a description here for your reference (not parsed).</span>
|
620 |
|
|
</td>
|
621 |
|
|
</tr>
|
622 |
|
|
<tr>
|
623 |
|
|
<td width="22%" valign="top" class="vncell">Advanced Options</td>
|
624 |
|
|
<td width="78%" class="vtable">
|
625 |
|
|
<input name="max-src-nodes" id="max-src-nodes" value="<?php echo $pconfig['max-src-nodes'] ?>"><br> Simultaneous client connection limit<p>
|
626 |
|
|
<input name="max-src-states" id="max-src-states" value="<?php echo $pconfig['max-src-states'] ?>"><br> Maximum state entries per host<p>
|
627 |
|
|
<input name="max-src-conn-rate" id="max-src-conn-rate" value="<?php echo $pconfig['max-src-conn-rate'] ?>"> /
|
628 |
|
|
<select name="max-src-conn-rates" id="max-src-conn-rates">
|
629 |
|
|
<option value=""<?php if(intval($pconfig['max-src-conn-rates']) < 1) echo " selected"; ?>></option>
|
630 |
|
|
<?php for($x=1; $x<255; $x++) {
|
631 |
|
|
if($x == $pconfig['max-src-conn-rates']) $selected = " selected"; else $selected = "";
|
632 |
|
|
echo "<option value=\"{$x}\"{$selected}>{$x}</option>\n";
|
633 |
|
|
} ?>
|
634 |
|
|
</select>
|
635 |
|
|
<br />
|
636 |
|
|
Maximum new connections / per second
|
637 |
|
|
<p><strong>NOTE: Leave these fields blank to disable this feature.</strong>
|
638 |
|
|
</td>
|
639 |
|
|
</tr>
|
640 |
|
|
<tr>
|
641 |
|
|
<td width="22%" valign="top" class="vncell">State Type</td>
|
642 |
|
|
<td width="78%" class="vtable">
|
643 |
|
|
<select name="statetype">
|
644 |
|
|
<option value="keep state" <?php if(!isset($pconfig['statetype']) or $pconfig['statetype'] == "keep state") echo "selected"; ?>>keep state</option>
|
645 |
|
|
<option value="modulate state" <?php if($pconfig['statetype'] == "modulate state") echo "selected"; ?>>modulate state</option>
|
646 |
|
|
<option value="synproxy state"<?php if($pconfig['statetype'] == "synproxy state") echo "selected"; ?>>synproxy state</option>
|
647 |
|
|
<option value="none"<?php if($pconfig['statetype'] == "none") echo "selected"; ?>>none</option>
|
648 |
|
|
</select><br>HINT: Select which type of state tracking mechanism you would like to use. If in doubt, use keep state.
|
649 |
|
|
<p><strong>
|
650 |
|
|
<table>
|
651 |
|
|
<tr><td width="25%"><li>keep state</li></td><td>works with TCP, UDP, and ICMP.</td></tr>
|
652 |
|
|
<tr><td width="25%"><li>modulate state</li></td><td>works only with TCP. pfSense will generate strong Initial Sequence Numbers (ISNs) for packets matching this rule.</li></td></tr>
|
653 |
|
|
<tr><td width="25%"><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.</td></tr>
|
654 |
|
|
<tr><td width="25%"><li>none</li></td><td>do not use state mechanisms to keep track. this is only useful if your doing advanced queueing in certain situations. please check the faq.</td></tr>
|
655 |
|
|
</table>
|
656 |
|
|
</strong></p>
|
657 |
|
|
</td>
|
658 |
|
|
</tr>
|
659 |
|
|
<tr>
|
660 |
|
|
<td width="22%" valign="top" class="vncell">State Timeout</td>
|
661 |
|
|
<td width="78%" class="vtable">
|
662 |
|
|
<input name="statetimeout" value="<?php echo $pconfig['frags'] ?>">
|
663 |
|
|
<p><strong>Leave blank for default. Amount is in seconds.</strong></p>
|
664 |
|
|
</td>
|
665 |
|
|
</tr>
|
666 |
|
|
<?php
|
667 |
82628210
|
Scott Ullrich
|
/* build a list of gateways */
|
668 |
|
|
$gateways = array();
|
669 |
c98ddde2
|
Bill Marquette
|
$gateways[] = "default"; // default to don't use this feature :)
|
670 |
82628210
|
Scott Ullrich
|
foreach($config['interfaces'] as $int) {
|
671 |
|
|
if($int['gateway'] <> "")
|
672 |
|
|
$gateways[]=$int['gateway'];
|
673 |
|
|
}
|
674 |
8ab3e9ed
|
Erik Kristensen
|
?>
|
675 |
82628210
|
Scott Ullrich
|
<tr>
|
676 |
8ab3e9ed
|
Erik Kristensen
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
677 |
|
|
<td width="78%" class="vtable">
|
678 |
|
|
<select name='gateway'>
|
679 |
|
|
<?php
|
680 |
82628210
|
Scott Ullrich
|
foreach($gateways as $gw) {
|
681 |
e6c0da7c
|
Scott Ullrich
|
if($gw == $pconfig['gateway']) {
|
682 |
82628210
|
Scott Ullrich
|
$selected = " SELECTED";
|
683 |
e6c0da7c
|
Scott Ullrich
|
} else {
|
684 |
82628210
|
Scott Ullrich
|
$selected = "";
|
685 |
e6c0da7c
|
Scott Ullrich
|
}
|
686 |
|
|
if ($gw == "default") {
|
687 |
|
|
echo "<option value=\"\" {$selected}>{$gw}</option>\n";
|
688 |
|
|
} else {
|
689 |
bd8d9d92
|
Bill Marquette
|
echo "<option value=\"{$gw}\" {$selected}>{$gw}</option>\n";
|
690 |
e6c0da7c
|
Scott Ullrich
|
}
|
691 |
|
|
}
|
692 |
088da57b
|
Scott Ullrich
|
foreach($config['load_balancer']['lbpool'] as $lb) {
|
693 |
947ad59e
|
Bill Marquette
|
if($pconfig['gateway'] == $lb['name']) {
|
694 |
e6c0da7c
|
Scott Ullrich
|
echo "<option value=\"{$lb['name']}\" SELECTED>{$lb['name']}</option>\n";
|
695 |
|
|
} else {
|
696 |
|
|
echo "<option value=\"{$lb['name']}\">{$lb['name']}</option>\n";
|
697 |
|
|
}
|
698 |
82628210
|
Scott Ullrich
|
}
|
699 |
1fda0968
|
Scott Ullrich
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
700 |
|
|
if($config['interfaces']['opt' . $i]['ipaddr'] == "dhcp") {
|
701 |
|
|
$descr = $config['interfaces']['opt' . $i]['descr'];
|
702 |
|
|
if ($pconfig['gateway'] == $config['interfaces']['opt' . $i]) {
|
703 |
|
|
$selected = " SELECTED";
|
704 |
|
|
} else {
|
705 |
|
|
$selected = "";
|
706 |
|
|
}
|
707 |
|
|
echo "<option value=\"opt{$i}\" {$selected}>OPT{$i} - {$descr}</option>\n";
|
708 |
|
|
}
|
709 |
|
|
}
|
710 |
8ab3e9ed
|
Erik Kristensen
|
?>
|
711 |
|
|
</select>
|
712 |
58a4eecd
|
Bill Marquette
|
<p><strong>Leave as 'default' to use the system routing table. Or choose a gateway to utilize policy based routing.</strong></p>
|
713 |
8ab3e9ed
|
Erik Kristensen
|
</td>
|
714 |
|
|
</tr>
|
715 |
|
|
<tr>
|
716 |
|
|
<td width="22%" valign="top"> </td>
|
717 |
|
|
<td width="78%">
|
718 |
|
|
<input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
719 |
|
|
<?php if (isset($id) && $a_filter[$id]): ?>
|
720 |
|
|
<input name="id" type="hidden" value="<?=$id;?>">
|
721 |
|
|
<?php endif; ?>
|
722 |
|
|
<input name="after" type="hidden" value="<?=$after;?>">
|
723 |
|
|
</td>
|
724 |
82628210
|
Scott Ullrich
|
</tr>
|
725 |
8ab3e9ed
|
Erik Kristensen
|
</table>
|
726 |
5b237745
|
Scott Ullrich
|
</form>
|
727 |
|
|
<script language="JavaScript">
|
728 |
|
|
<!--
|
729 |
8ab3e9ed
|
Erik Kristensen
|
ext_change();
|
730 |
|
|
typesel_change();
|
731 |
|
|
proto_change();
|
732 |
19757279
|
Scott Ullrich
|
|
733 |
|
|
<?php
|
734 |
8ab3e9ed
|
Erik Kristensen
|
$isfirst = 0;
|
735 |
|
|
$aliases = "";
|
736 |
|
|
$addrisfirst = 0;
|
737 |
|
|
$aliasesaddr = "";
|
738 |
|
|
if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
|
739 |
|
|
foreach($config['aliases']['alias'] as $alias_name) {
|
740 |
|
|
if(!stristr($alias_name['address'], ".")) {
|
741 |
|
|
if($isfirst == 1) $aliases .= ",";
|
742 |
|
|
$aliases .= "'" . $alias_name['name'] . "'";
|
743 |
|
|
$isfirst = 1;
|
744 |
|
|
} else {
|
745 |
|
|
if($addrisfirst == 1) $aliasesaddr .= ",";
|
746 |
|
|
$aliasesaddr .= "'" . $alias_name['name'] . "'";
|
747 |
|
|
$addrisfirst = 1;
|
748 |
|
|
}
|
749 |
092ac49d
|
Scott Ullrich
|
}
|
750 |
19757279
|
Scott Ullrich
|
?>
|
751 |
|
|
|
752 |
8ab3e9ed
|
Erik Kristensen
|
var addressarray=new Array(<?php echo $aliasesaddr; ?>);
|
753 |
|
|
var customarray=new Array(<?php echo $aliases; ?>);
|
754 |
19757279
|
Scott Ullrich
|
|
755 |
5b237745
|
Scott Ullrich
|
//-->
|
756 |
|
|
</script>
|
757 |
8ab3e9ed
|
Erik Kristensen
|
|
758 |
|
|
|
759 |
5b237745
|
Scott Ullrich
|
<?php include("fend.inc"); ?>
|
760 |
|
|
</body>
|
761 |
|
|
</html>
|