1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
firewall_rules_edit.php
|
5
|
part of pfSense (http://www.pfsense.com)
|
6
|
Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
|
7
|
|
8
|
originally part of m0n0wall (http://m0n0.ch/wall)
|
9
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10
|
All rights reserved.
|
11
|
|
12
|
Redistribution and use in source and binary forms, with or without
|
13
|
modification, are permitted provided that the following conditions are met:
|
14
|
|
15
|
1. Redistributions of source code must retain the above copyright notice,
|
16
|
this list of conditions and the following disclaimer.
|
17
|
|
18
|
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
|
|
22
|
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
|
*/
|
33
|
/*
|
34
|
pfSense_MODULE: filter
|
35
|
*/
|
36
|
|
37
|
##|+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
|
require("guiconfig.inc");
|
45
|
require("filter.inc");
|
46
|
require("shaper.inc");
|
47
|
|
48
|
$specialsrcdst = explode(" ", "any pptp pppoe l2tp openvpn");
|
49
|
$ifdisp = get_configured_interface_with_descr();
|
50
|
foreach ($ifdisp as $kif => $kdescr) {
|
51
|
$specialsrcdst[] = "{$kif}";
|
52
|
$specialsrcdst[] = "{$kif}ip";
|
53
|
}
|
54
|
|
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
|
|
65
|
$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
|
|
78
|
if (isset($a_filter[$id]['id']))
|
79
|
$pconfig['ruleid'] = $a_filter[$id]['id'];
|
80
|
|
81
|
if (!isset($a_filter[$id]['type']))
|
82
|
$pconfig['type'] = "pass";
|
83
|
else
|
84
|
$pconfig['type'] = $a_filter[$id]['type'];
|
85
|
|
86
|
if (isset($a_filter[$id]['floating']) || $if == "FloatingRules") {
|
87
|
$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
|
if (isset($a_filter[$id]['protocol']))
|
99
|
$pconfig['proto'] = $a_filter[$id]['protocol'];
|
100
|
else
|
101
|
$pconfig['proto'] = "any";
|
102
|
|
103
|
if ($a_filter[$id]['protocol'] == "icmp")
|
104
|
$pconfig['icmptype'] = $a_filter[$id]['icmptype'];
|
105
|
|
106
|
address_to_pconfig($a_filter[$id]['source'], $pconfig['src'],
|
107
|
$pconfig['srcmask'], $pconfig['srcnot'],
|
108
|
$pconfig['srcbeginport'], $pconfig['srcendport']);
|
109
|
|
110
|
if($a_filter[$id]['os'] <> "")
|
111
|
$pconfig['os'] = $a_filter[$id]['os'];
|
112
|
|
113
|
address_to_pconfig($a_filter[$id]['destination'], $pconfig['dst'],
|
114
|
$pconfig['dstmask'], $pconfig['dstnot'],
|
115
|
$pconfig['dstbeginport'], $pconfig['dstendport']);
|
116
|
|
117
|
if ($a_filter[$id]['dscp'] <> "")
|
118
|
$pconfig['dscp'] = $a_filter[$id]['dscp'];
|
119
|
|
120
|
$pconfig['disabled'] = isset($a_filter[$id]['disabled']);
|
121
|
$pconfig['log'] = isset($a_filter[$id]['log']);
|
122
|
$pconfig['descr'] = $a_filter[$id]['descr'];
|
123
|
|
124
|
if (isset($a_filter[$id]['tag']) && $a_filter[$id]['tag'] <> "")
|
125
|
$pconfig['tag'] = $a_filter[$id]['tag'];
|
126
|
if (isset($a_filter[$id]['tagged']) && $a_filter[$id]['tagged'] <> "")
|
127
|
$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
|
if (isset($a_filter[$id]['allowopts']))
|
131
|
$pconfig['allowopts'] = true;
|
132
|
if (isset($a_filter[$id]['disablereplyto']))
|
133
|
$pconfig['disablereplyto'] = true;
|
134
|
|
135
|
/* advanced */
|
136
|
$pconfig['max'] = $a_filter[$id]['max'];
|
137
|
$pconfig['max-src-nodes'] = $a_filter[$id]['max-src-nodes'];
|
138
|
$pconfig['max-src-conn'] = $a_filter[$id]['max-src-conn'];
|
139
|
$pconfig['max-src-states'] = $a_filter[$id]['max-src-states'];
|
140
|
$pconfig['statetype'] = $a_filter[$id]['statetype'];
|
141
|
$pconfig['statetimeout'] = $a_filter[$id]['statetimeout'];
|
142
|
|
143
|
/* advanced - nosync */
|
144
|
$pconfig['nosync'] = isset($a_filter[$id]['nosync']);
|
145
|
|
146
|
/* 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
|
|
150
|
/* Multi-WAN next-hop support */
|
151
|
$pconfig['gateway'] = $a_filter[$id]['gateway'];
|
152
|
|
153
|
/* Shaper support */
|
154
|
$pconfig['defaultqueue'] = $a_filter[$id]['defaultqueue'];
|
155
|
$pconfig['ackqueue'] = $a_filter[$id]['ackqueue'];
|
156
|
$pconfig['dnpipe'] = $a_filter[$id]['dnpipe'];
|
157
|
$pconfig['pdnpipe'] = $a_filter[$id]['pdnpipe'];
|
158
|
$pconfig['l7container'] = $a_filter[$id]['l7container'];
|
159
|
|
160
|
//schedule support
|
161
|
$pconfig['sched'] = $a_filter[$id]['sched'];
|
162
|
$pconfig['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
|
163
|
|
164
|
} else {
|
165
|
/* defaults */
|
166
|
if ($_GET['if'])
|
167
|
$pconfig['interface'] = $_GET['if'];
|
168
|
$pconfig['type'] = "pass";
|
169
|
$pconfig['src'] = "any";
|
170
|
$pconfig['dst'] = "any";
|
171
|
}
|
172
|
/* Allow the FlotingRules to work */
|
173
|
$if = $pconfig['interface'];
|
174
|
|
175
|
if (isset($_GET['dup']))
|
176
|
unset($id);
|
177
|
|
178
|
if ($_POST) {
|
179
|
|
180
|
if ($_POST['type'] == "reject" && $_POST['proto'] <> "tcp")
|
181
|
$input_errors[] = "Reject type rules only works when the protocol is set to TCP.";
|
182
|
|
183
|
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
|
|
190
|
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
|
|
195
|
if ($_POST['srcbeginport'] == "any") {
|
196
|
$_POST['srcbeginport'] = 0;
|
197
|
$_POST['srcendport'] = 0;
|
198
|
} else {
|
199
|
if (!$_POST['srcendport'])
|
200
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
201
|
}
|
202
|
if ($_POST['srcendport'] == "any")
|
203
|
$_POST['srcendport'] = $_POST['srcbeginport'];
|
204
|
|
205
|
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
|
|
210
|
if ($_POST['dstbeginport'] == "any") {
|
211
|
$_POST['dstbeginport'] = 0;
|
212
|
$_POST['dstendport'] = 0;
|
213
|
} else {
|
214
|
if (!$_POST['dstendport'])
|
215
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
216
|
}
|
217
|
if ($_POST['dstendport'] == "any")
|
218
|
$_POST['dstendport'] = $_POST['dstbeginport'];
|
219
|
}
|
220
|
|
221
|
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
|
|
234
|
unset($input_errors);
|
235
|
$pconfig = $_POST;
|
236
|
|
237
|
/* 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
|
foreach ($_POST as $key => $value) {
|
241
|
$temp = $value;
|
242
|
if (isset($_POST['floating']) && $key == "interface")
|
243
|
continue;
|
244
|
$newpost = htmlentities($temp);
|
245
|
if($newpost <> $temp)
|
246
|
$input_errors[] = "Invalid characters detected ($temp). Please remove invalid characters and save again.";
|
247
|
}
|
248
|
|
249
|
/* input validation */
|
250
|
$reqdfields = explode(" ", "type proto src");
|
251
|
if ( isset($a_filter[$id]['associated-rule-id'])===false )
|
252
|
$redqfields[] = "dst";
|
253
|
$reqdfieldsn = explode(",", "Type,Protocol,Source");
|
254
|
if ( isset($a_filter[$id]['associated-rule-id'])===false )
|
255
|
$reqdfieldsn[] = "Destination";
|
256
|
|
257
|
if($_POST['statetype'] == "modulate state" or $_POST['statetype'] == "synproxy state") {
|
258
|
if( $_POST['proto'] != "tcp" )
|
259
|
$input_errors[] = "{$_POST['statetype']} is only valid with protocol tcp.";
|
260
|
if(($_POST['statetype'] == "synproxy state") && ($_POST['gateway'] != ""))
|
261
|
$input_errors[] = "{$_POST['statetype']} is only valid if the gateway is set to 'default'.";
|
262
|
}
|
263
|
|
264
|
if (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single"))) {
|
265
|
$reqdfields[] = "srcmask";
|
266
|
$reqdfieldsn[] = "Source bit count";
|
267
|
}
|
268
|
if ( isset($a_filter[$id]['associated-rule-id'])===false &&
|
269
|
(!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single"))) ) {
|
270
|
$reqdfields[] = "dstmask";
|
271
|
$reqdfieldsn[] = "Destination bit count";
|
272
|
}
|
273
|
|
274
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
275
|
|
276
|
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
|
|
285
|
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
|
|
294
|
/* 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
|
if (!is_specialnet($_POST['srctype'])) {
|
305
|
if (($_POST['src'] && !is_ipaddroralias($_POST['src']))) {
|
306
|
$input_errors[] = "{$_POST['src']} is not a valid source IP address or alias.";
|
307
|
}
|
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
|
if (($_POST['dst'] && !is_ipaddroralias($_POST['dst']))) {
|
314
|
$input_errors[] = "{$_POST['dst']} is not a valid destination IP address or alias.";
|
315
|
}
|
316
|
if (($_POST['dstmask'] && !is_numericint($_POST['dstmask']))) {
|
317
|
$input_errors[] = "A valid destination bit count must be specified.";
|
318
|
}
|
319
|
}
|
320
|
|
321
|
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
|
if ($_POST['os'])
|
334
|
if( $_POST['proto'] != "tcp" )
|
335
|
$input_errors[] = "OS detection is only valid with protocol tcp.";
|
336
|
|
337
|
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
|
$input_errors[] = "Acknowledge queue and Queue cannot be the same.";
|
342
|
}
|
343
|
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
|
if( !empty($_POST['ruleid']) && !ctype_digit($_POST['ruleid']))
|
354
|
$input_errors[] = 'ID must be an integer';
|
355
|
if($_POST['l7container'] && $_POST['l7container'] != "none") {
|
356
|
if(!($_POST['proto'] == "tcp" || $_POST['proto'] == "udp" || $_POST['proto'] == "tcp/udp"))
|
357
|
$input_errors[] = "You can only select a layer7 container for tcp and/or udp protocols";
|
358
|
if ($_POST['type'] <> "pass")
|
359
|
$input_errors[] = "You can only select a layer7 container for Pass type rules.";
|
360
|
}
|
361
|
|
362
|
if (!$input_errors) {
|
363
|
$filterent = array();
|
364
|
$filterent['id'] = $_POST['ruleid']>0?$_POST['ruleid']:'';
|
365
|
$filterent['type'] = $_POST['type'];
|
366
|
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
|
$filterent['tagged'] = $_POST['tagged'];
|
374
|
$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
|
$filterent['interface'] = implode(",", $_POST['interface']);
|
380
|
}
|
381
|
}
|
382
|
|
383
|
/* Advanced options */
|
384
|
if ($_POST['allowopts'] == "yes")
|
385
|
$filterent['allowopts'] = true;
|
386
|
else
|
387
|
unset($filterent['allowopts']);
|
388
|
if ($_POST['disablereplyto'] == "yes")
|
389
|
$filterent['disablereplyto'] = true;
|
390
|
else
|
391
|
unset($filterent['disablereplyto']);
|
392
|
$filterent['max'] = $_POST['max'];
|
393
|
$filterent['max-src-nodes'] = $_POST['max-src-nodes'];
|
394
|
$filterent['max-src-conn'] = $_POST['max-src-conn'];
|
395
|
$filterent['max-src-states'] = $_POST['max-src-states'];
|
396
|
$filterent['statetimeout'] = $_POST['statetimeout'];
|
397
|
$filterent['statetype'] = $_POST['statetype'];
|
398
|
$filterent['os'] = $_POST['os'];
|
399
|
|
400
|
/* Nosync directive - do not xmlrpc sync this item */
|
401
|
if($_POST['nosync'] <> "")
|
402
|
$filterent['nosync'] = true;
|
403
|
else
|
404
|
unset($filterent['nosync']);
|
405
|
|
406
|
/* 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
|
|
415
|
if ($_POST['proto'] != "any")
|
416
|
$filterent['protocol'] = $_POST['proto'];
|
417
|
else
|
418
|
unset($filterent['protocol']);
|
419
|
|
420
|
if ($_POST['proto'] == "icmp" && $_POST['icmptype'])
|
421
|
$filterent['icmptype'] = $_POST['icmptype'];
|
422
|
else
|
423
|
unset($filterent['icmptype']);
|
424
|
|
425
|
pconfig_to_address($filterent['source'], $_POST['src'],
|
426
|
$_POST['srcmask'], $_POST['srcnot'],
|
427
|
$_POST['srcbeginport'], $_POST['srcendport']);
|
428
|
|
429
|
pconfig_to_address($filterent['destination'], $_POST['dst'],
|
430
|
$_POST['dstmask'], $_POST['dstnot'],
|
431
|
$_POST['dstbeginport'], $_POST['dstendport']);
|
432
|
|
433
|
if ($_POST['disabled'])
|
434
|
$filterent['disabled'] = true;
|
435
|
else
|
436
|
unset($filterent['disabled']);
|
437
|
|
438
|
if ($_POST['dscp'])
|
439
|
$filterent['dscp'] = $_POST['dscp'];
|
440
|
|
441
|
if ($_POST['log'])
|
442
|
$filterent['log'] = true;
|
443
|
else
|
444
|
unset($filterent['log']);
|
445
|
strncpy($filterent['descr'], $_POST['descr'], 52);
|
446
|
|
447
|
if ($_POST['gateway'] != "") {
|
448
|
$filterent['gateway'] = $_POST['gateway'];
|
449
|
}
|
450
|
|
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
|
|
457
|
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
|
if (isset($_POST['l7container']) && $_POST['l7container'] != "none") {
|
464
|
$filterent['l7container'] = $_POST['l7container'];
|
465
|
}
|
466
|
|
467
|
if ($_POST['sched'] != "") {
|
468
|
$filterent['sched'] = $_POST['sched'];
|
469
|
}
|
470
|
|
471
|
// If we have an associated nat rule, make sure the destination doesn't change
|
472
|
if( isset($a_filter[$id]['associated-rule-id']) ) {
|
473
|
$filterent['destination'] = $a_filter[$id]['destination'];
|
474
|
$filterent['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
|
475
|
}
|
476
|
|
477
|
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
|
|
486
|
write_config();
|
487
|
mark_subsystem_dirty('filter');
|
488
|
|
489
|
if (isset($_POST['floating']))
|
490
|
header("Location: firewall_rules.php?if=FloatingRules");
|
491
|
else
|
492
|
header("Location: firewall_rules.php?if=" . $_POST['interface']);
|
493
|
exit;
|
494
|
}
|
495
|
}
|
496
|
|
497
|
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
|
$pgtitle = array("Firewall","Rules","Edit");
|
505
|
$closehead = false;
|
506
|
|
507
|
$page_filename = "firewall_rules_edit.php";
|
508
|
include("head.inc");
|
509
|
|
510
|
?>
|
511
|
|
512
|
</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
|
|
518
|
<form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
|
519
|
<input type='hidden' name="ruleid" value="<?=(isset($pconfig['ruleid'])&&$pconfig['ruleid']>0)?htmlspecialchars($pconfig['ruleid']):''?>">
|
520
|
|
521
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
522
|
<tr>
|
523
|
<td colspan="2" valign="top" class="listtopic">Edit Firewall rule</td>
|
524
|
</tr>
|
525
|
<tr>
|
526
|
<td width="22%" valign="top" class="vncellreq">Action</td>
|
527
|
<td width="78%" class="vtable">
|
528
|
<select name="type" class="formselect">
|
529
|
<?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
|
</select>
|
535
|
<br/>
|
536
|
<span class="vexpl">
|
537
|
Choose what to do with packets that match the criteria specified below. <br/>
|
538
|
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
|
</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
|
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
|
551
|
<tr>
|
552
|
<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
|
<? endif; ?>
|
562
|
<tr>
|
563
|
<td width="22%" valign="top" class="vncellreq">Interface</td>
|
564
|
<td width="78%" class="vtable">
|
565
|
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
|
566
|
<select name="interface[]" multiple="true" class="formselect" size="3">
|
567
|
<? else: ?>
|
568
|
<select name="interface" class="formselect">
|
569
|
<?php
|
570
|
endif;
|
571
|
/* add group interfaces */
|
572
|
if (is_array($config['ifgroups']['ifgroupentry']))
|
573
|
foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
|
574
|
if (have_ruleint_access($ifgen['ifname']))
|
575
|
$interfaces[$ifgen['ifname']] = $ifgen['ifname'];
|
576
|
$ifdescs = get_configured_interface_with_descr();
|
577
|
foreach ($ifdescs as $ifent => $ifdesc)
|
578
|
if(have_ruleint_access($ifent))
|
579
|
$interfaces[$ifent] = $ifdesc;
|
580
|
if ($config['l2tp']['mode'] == "server")
|
581
|
if(have_ruleint_access("l2tp"))
|
582
|
$interfaces['l2tp'] = "L2TP VPN";
|
583
|
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
|
$interfaces["enc0"] = "IPsec";
|
594
|
/* add openvpn/tun interfaces */
|
595
|
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
|
596
|
$interfaces["openvpn"] = "OpenVPN";
|
597
|
foreach ($interfaces as $iface => $ifacename): ?>
|
598
|
<option value="<?=$iface;?>" <?php if ($pconfig['interface'] <> "" && stristr($pconfig['interface'], $iface)) echo "selected"; ?>><?=gettext($ifacename);?></option>
|
599
|
<?php endforeach; ?>
|
600
|
</select>
|
601
|
<br />
|
602
|
<span class="vexpl">Choose on which interface packets must come in to match this rule.</span>
|
603
|
</td>
|
604
|
</tr>
|
605
|
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
|
606
|
<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
|
<?php endif; ?>
|
625
|
<tr>
|
626
|
<td width="22%" valign="top" class="vncellreq">Protocol</td>
|
627
|
<td width="78%" class="vtable">
|
628
|
<select name="proto" class="formselect" onchange="proto_change()">
|
629
|
<?php
|
630
|
$protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IGMP any carp pfsync");
|
631
|
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
|
<tr id="icmpbox" name="icmpbox">
|
640
|
<td valign="top" class="vncell">ICMP type</td>
|
641
|
<td class="vtable">
|
642
|
<select name="icmptype" class="formselect">
|
643
|
<?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
|
<input name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>>
|
676
|
<strong>not</strong>
|
677
|
<br />
|
678
|
Use this option to invert the sense of the match.
|
679
|
<br />
|
680
|
<br />
|
681
|
<table border="0" cellspacing="0" cellpadding="0">
|
682
|
<tr>
|
683
|
<td>Type: </td>
|
684
|
<td>
|
685
|
<select name="srctype" class="formselect" onChange="typesel_change()">
|
686
|
<?php
|
687
|
$sel = is_specialnet($pconfig['src']); ?>
|
688
|
<option value="any" <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>>any</option>
|
689
|
<option value="single" <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
|
690
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
|
691
|
<?php if(have_ruleint_access("pptp")): ?>
|
692
|
<option value="pptp" <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
|
693
|
<?php endif; ?>
|
694
|
<?php if(have_ruleint_access("pppoe")): ?>
|
695
|
<option value="pppoe" <?php if ($pconfig['src'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
|
696
|
<?php endif; ?>
|
697
|
<?php if(have_ruleint_access("l2tp")): ?>
|
698
|
<option value="l2tp" <?php if ($pconfig['src'] == "l2tp") { echo "selected"; } ?>>L2TP clients</option>
|
699
|
<?php endif; ?>
|
700
|
<?php
|
701
|
foreach ($ifdisp as $ifent => $ifdesc): ?>
|
702
|
<?php if(have_ruleint_access($ifent)): ?>
|
703
|
<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option>
|
704
|
<option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] == $ifent . "ip") { echo "selected"; } ?>>
|
705
|
<?=$ifdesc?> address
|
706
|
</option>
|
707
|
<?php endif; ?>
|
708
|
<?php endforeach; ?>
|
709
|
</select>
|
710
|
</td>
|
711
|
</tr>
|
712
|
<tr>
|
713
|
<td>Address: </td>
|
714
|
<td>
|
715
|
<input autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> /
|
716
|
<select name="srcmask" class="formselect" id="srcmask">
|
717
|
<?php for ($i = 31; $i > 0; $i--): ?>
|
718
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
|
719
|
<?php endfor; ?>
|
720
|
</select>
|
721
|
</td>
|
722
|
</tr>
|
723
|
</table>
|
724
|
<div id="showadvancedboxspr">
|
725
|
<p>
|
726
|
<input type="button" onClick="show_source_port_range()" value="Advanced"></input> - Show source port range</a>
|
727
|
</div>
|
728
|
</td>
|
729
|
</tr>
|
730
|
<tr style="display:none" id="sprtable" name="sprtable">
|
731
|
<td width="22%" valign="top" class="vncellreq">Source port range</td>
|
732
|
<td width="78%" class="vtable">
|
733
|
<table border="0" cellspacing="0" cellpadding="0">
|
734
|
<tr>
|
735
|
<td>from: </td>
|
736
|
<td>
|
737
|
<select name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()">
|
738
|
<option value="">(other)</option>
|
739
|
<option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
740
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
741
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
742
|
<?php endforeach; ?>
|
743
|
</select>
|
744
|
<input autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo $pconfig['srcbeginport']; ?>">
|
745
|
</td>
|
746
|
</tr>
|
747
|
<tr>
|
748
|
<td>to:</td>
|
749
|
<td>
|
750
|
<select name="srcendport" class="formselect" onchange="ext_change()">
|
751
|
<option value="">(other)</option>
|
752
|
<option value="any" <?php $bfound = 0; if ($pconfig['srcendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
753
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
754
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
755
|
<?php endforeach; ?>
|
756
|
</select>
|
757
|
<input autocomplete='off' class="formfldalias" name="srcendport_cust" id="srcendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcendport']) echo $pconfig['srcendport']; ?>">
|
758
|
</td>
|
759
|
</tr>
|
760
|
</table>
|
761
|
<br />
|
762
|
<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/>
|
763
|
</td>
|
764
|
</tr>
|
765
|
<tr>
|
766
|
<td width="22%" valign="top" class="vncellreq">Destination</td>
|
767
|
<td width="78%" class="vtable">
|
768
|
<?php $dst_disabled=false; ?>
|
769
|
<?php if( isset($pconfig['associated-rule-id']) ): ?>
|
770
|
<span class="red"><strong>NOTE: </strong></span> This is associated to a NAT rule.<br />
|
771
|
You cannot edit the destination of associated filter rules.<br />
|
772
|
<br />
|
773
|
<?php
|
774
|
if (is_array($config['nat']['rule'])) {
|
775
|
foreach( $config['nat']['rule'] as $index => $nat_rule ) {
|
776
|
if( $nat_rule['assocaited-rule-id']==$pconfig['associated-rule-id'])
|
777
|
echo "<a href=\"firewall_nat_edit.php?id={$nat_rule[$index]}\">View the NAT rule</a>\n";
|
778
|
break;
|
779
|
}
|
780
|
}
|
781
|
?>
|
782
|
<br />
|
783
|
<?php $dst_disabled=true; ?>
|
784
|
<script type="text/javascript">
|
785
|
dstenabled = 0;
|
786
|
</script>
|
787
|
<?php endif; ?>
|
788
|
<input<?php echo ($dst_disabled===true?' DISABLED':''); ?> name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked"; ?>>
|
789
|
<strong>not</strong>
|
790
|
<br />
|
791
|
Use this option to invert the sense of the match.
|
792
|
<br />
|
793
|
<br />
|
794
|
<table border="0" cellspacing="0" cellpadding="0">
|
795
|
<tr>
|
796
|
<td>Type: </td>
|
797
|
<td>
|
798
|
<select<?php echo ($dst_disabled===true?' DISABLED':''); ?> name="dsttype" class="formselect" onChange="typesel_change()">
|
799
|
<?php
|
800
|
$sel = is_specialnet($pconfig['dst']); ?>
|
801
|
<option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>>any</option>
|
802
|
<option value="single" <?php if (($pconfig['dstmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
|
803
|
<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
|
804
|
<?php if(have_ruleint_access("pptp")): ?>
|
805
|
<option value="pptp" <?php if ($pconfig['dst'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
|
806
|
<?php endif; ?>
|
807
|
<?php if(have_ruleint_access("pppoe")): ?>
|
808
|
<option value="pppoe" <?php if ($pconfig['dst'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
|
809
|
<?php endif; ?>
|
810
|
<?php if(have_ruleint_access("l2tp")): ?>
|
811
|
<option value="l2tp" <?php if ($pconfig['dst'] == "l2tp") { echo "selected"; } ?>>L2TP clients</option>
|
812
|
<?php endif; ?>
|
813
|
|
814
|
<?php foreach ($ifdisp as $if => $ifdesc): ?>
|
815
|
<?php if(have_ruleint_access($if)): ?>
|
816
|
<option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option>
|
817
|
<option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo "selected"; } ?>>
|
818
|
<?=$ifdesc;?> address
|
819
|
</option>
|
820
|
<?php endif; ?>
|
821
|
<?php endforeach; ?>
|
822
|
</select>
|
823
|
</td>
|
824
|
</tr>
|
825
|
<tr>
|
826
|
<td>Address: </td>
|
827
|
<td>
|
828
|
<input<?php echo ($dst_disabled===true?' DISABLED':''); ?> name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
|
829
|
/
|
830
|
<select<?php echo ($dst_disabled===true?' DISABLED':''); ?> name="dstmask" class="formselect" id="dstmask">
|
831
|
<?php
|
832
|
for ($i = 31; $i > 0; $i--): ?>
|
833
|
<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option>
|
834
|
<?php endfor; ?>
|
835
|
</select>
|
836
|
</td>
|
837
|
</tr>
|
838
|
</table>
|
839
|
</td>
|
840
|
</tr>
|
841
|
<tr id="dprtr" name="dprtr">
|
842
|
<td width="22%" valign="top" class="vncellreq">Destination port range </td>
|
843
|
<td width="78%" class="vtable">
|
844
|
<table border="0" cellspacing="0" cellpadding="0">
|
845
|
<tr>
|
846
|
<td>from: </td>
|
847
|
<td>
|
848
|
<select<?php echo ($dst_disabled===true?' DISABLED':''); ?> name="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()">
|
849
|
<option value="">(other)</option>
|
850
|
<option value="any" <?php $bfound = 0; if ($pconfig['dstbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
851
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
852
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected"; $bfound = 1; }?>><?=htmlspecialchars($wkportdesc);?></option>
|
853
|
<?php endforeach; ?>
|
854
|
</select>
|
855
|
<input<?php echo ($dst_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']; ?>">
|
856
|
</td>
|
857
|
</tr>
|
858
|
<tr>
|
859
|
<td>to:</td>
|
860
|
<td>
|
861
|
<select<?php echo ($dst_disabled===true?' DISABLED':''); ?> name="dstendport" class="formselect" onchange="ext_change()">
|
862
|
<option value="">(other)</option>
|
863
|
<option value="any" <?php $bfound = 0; if ($pconfig['dstendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
|
864
|
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
|
865
|
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
|
866
|
<?php endforeach; ?>
|
867
|
</select>
|
868
|
<input<?php echo ($dst_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']; ?>">
|
869
|
</td>
|
870
|
</tr>
|
871
|
</table>
|
872
|
<br />
|
873
|
<span class="vexpl">
|
874
|
Specify the port or port range for the destination of the packet for this rule.
|
875
|
<br />
|
876
|
Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port
|
877
|
</span>
|
878
|
</td>
|
879
|
</tr>
|
880
|
<tr>
|
881
|
<td width="22%" valign="top" class="vncellreq">Log</td>
|
882
|
<td width="78%" class="vtable">
|
883
|
<input name="log" type="checkbox" id="log" value="yes" <?php if ($pconfig['log']) echo "checked"; ?>>
|
884
|
<strong>Log packets that are handled by this rule</strong>
|
885
|
<br />
|
886
|
<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>
|
887
|
</td>
|
888
|
</tr>
|
889
|
<tr>
|
890
|
<td width="22%" valign="top" class="vncell">Description</td>
|
891
|
<td width="78%" class="vtable">
|
892
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="52" maxlength="52" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
893
|
<br />
|
894
|
<span class="vexpl">You may enter a description here for your reference.</span>
|
895
|
</td>
|
896
|
</tr>
|
897
|
<tr>
|
898
|
<td width="22%" valign="top"> </td>
|
899
|
<td width="78%">
|
900
|
<br>
|
901
|
<input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
902
|
<?php if (isset($id) && $a_filter[$id]): ?>
|
903
|
<input name="id" type="hidden" value="<?=$id;?>">
|
904
|
<?php endif; ?>
|
905
|
<input name="after" type="hidden" value="<?=$after;?>">
|
906
|
</td>
|
907
|
</tr>
|
908
|
<tr>
|
909
|
<td> </td>
|
910
|
</tr>
|
911
|
<tr>
|
912
|
<td colspan="2" valign="top" class="listtopic">Advanced features</td>
|
913
|
</tr>
|
914
|
<tr>
|
915
|
<td width="22%" valign="top" class="vncell">Source OS</td>
|
916
|
<td width="78%" class="vtable">
|
917
|
<div id="showadvsourceosbox">
|
918
|
<input type="button" onClick="show_advanced_sourceos()" value="Advanced"></input> - Show advanced option</a>
|
919
|
</div>
|
920
|
<div id="showsourceosadv" style="display:none">
|
921
|
OS Type:
|
922
|
<select name="os" id="os" class="formselect">
|
923
|
<?php
|
924
|
$ostypes = array(
|
925
|
"" => "any",
|
926
|
"AIX" => "AIX",
|
927
|
"Linux" => "Linux",
|
928
|
"FreeBSD" => "FreeBSD",
|
929
|
"NetBSD" => "NetBSD",
|
930
|
"OpenBSD" => "OpenBSD",
|
931
|
"Solaris" => "Solaris",
|
932
|
"MacOS" => "MacOS",
|
933
|
"Windows" => "Windows",
|
934
|
"Novell" => "Novell",
|
935
|
"NMAP" => "NMAP"
|
936
|
);
|
937
|
foreach ($ostypes as $ostype => $descr): ?>
|
938
|
<option value="<?=$ostype;?>" <?php if ($ostype == $pconfig['os']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
|
939
|
<?php
|
940
|
endforeach;
|
941
|
?>
|
942
|
</select>
|
943
|
<br />
|
944
|
Note: this only works for TCP rules
|
945
|
</div>
|
946
|
</td>
|
947
|
</tr>
|
948
|
<tr>
|
949
|
<td width="22%" valign="top" class="vncell">Diffserv Code Point</td>
|
950
|
<td width="78%" class="vtable">
|
951
|
<div id="dsadv" name="dsadv">
|
952
|
<input type="button" onClick="show_dsdiv();" value="Advanced"> - Show advanced option
|
953
|
</div>
|
954
|
<div id="dsdivmain" name="dsdivmain" style="display:none">
|
955
|
<select name="dscp" id="dscp">
|
956
|
<option value=""></option>
|
957
|
<?php foreach($firewall_rules_dscp_types as $frdt): ?>
|
958
|
<option value="<?=$frdt?>"<?php if($pconfig['dscp'] == $frdt) echo " SELECTED"; ?>><?=$frdt?></option>
|
959
|
<?php endforeach; ?>
|
960
|
</select>
|
961
|
</div>
|
962
|
</td>
|
963
|
</tr>
|
964
|
<tr>
|
965
|
<td width="22%" valign="top" class="vncell">Advanced Options</td>
|
966
|
<td width="78%" class="vtable">
|
967
|
<div id="aoadv" name="aoadv">
|
968
|
<input type="button" onClick="show_aodiv();" value="Advanced"> - Show advanced option
|
969
|
</div>
|
970
|
<div id="aodivmain" name="aodivmain" style="display:none">
|
971
|
<input type="checkbox" id="allowopts" value="yes" name="allowopts"<?php if($pconfig['allowopts'] == true) echo " checked"; ?>>
|
972
|
<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.");?>
|
973
|
</span><p>
|
974
|
<input type="checkbox" id="disablereplyto" value="yes" name="disablereplyto"<?php if($pconfig['disablereplyto'] == true) echo " checked"; ?>>
|
975
|
<br/><span class="vexpl"><?=gettext("This will disable auto generated reply-to for this rule.");?>
|
976
|
</span><p>
|
977
|
<input name="tag" id="tag" value="<?=htmlspecialchars($pconfig['tag']);?>">
|
978
|
<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>");?>
|
979
|
</span><p>
|
980
|
<input name="tagged" id="tagged" value="<?=htmlspecialchars($pconfig['tagged']);?>">
|
981
|
<br /><span class="vexpl"><?=gettext("You can match packet on a mark placed before on another rule.")?>
|
982
|
</span> <p>
|
983
|
<input name="max" id="max" value="<?php echo $pconfig['max'] ?>"><br> Maximum state entries this rule can create<p>
|
984
|
<input name="max-src-nodes" id="max-src-nodes" value="<?php echo $pconfig['max-src-nodes'] ?>"><br> Maximum number of unique source hosts<p>
|
985
|
<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>
|
986
|
<input name="max-src-states" id="max-src-states" value="<?php echo $pconfig['max-src-states'] ?>"><br> Maximum state entries per host<p>
|
987
|
<input name="max-src-conn-rate" id="max-src-conn-rate" value="<?php echo $pconfig['max-src-conn-rate'] ?>"> /
|
988
|
<select name="max-src-conn-rates" id="max-src-conn-rates">
|
989
|
<option value=""<?php if(intval($pconfig['max-src-conn-rates']) < 1) echo " selected"; ?>></option>
|
990
|
<?php for($x=1; $x<255; $x++) {
|
991
|
if($x == $pconfig['max-src-conn-rates']) $selected = " selected"; else $selected = "";
|
992
|
echo "<option value=\"{$x}\"{$selected}>{$x}</option>\n";
|
993
|
} ?>
|
994
|
</select><br />
|
995
|
Maximum new connections / per second(s)
|
996
|
<p>
|
997
|
|
998
|
<input name="statetimeout" value="<?php echo $pconfig['statetimeout'] ?>"><br>
|
999
|
State Timeout in seconds
|
1000
|
<p />
|
1001
|
|
1002
|
<p><strong>NOTE: Leave fields blank to disable that feature.</strong>
|
1003
|
</div>
|
1004
|
</td>
|
1005
|
</tr>
|
1006
|
<tr>
|
1007
|
<td width="22%" valign="top" class="vncell">State Type</td>
|
1008
|
<td width="78%" class="vtable">
|
1009
|
<div id="showadvstatebox">
|
1010
|
<input type="button" onClick="show_advanced_state()" value="Advanced"></input> - Show advanced option</a>
|
1011
|
</div>
|
1012
|
<div id="showstateadv" style="display:none">
|
1013
|
<select name="statetype">
|
1014
|
<option value="keep state" <?php if(!isset($pconfig['statetype']) or $pconfig['statetype'] == "keep state") echo "selected"; ?>>keep state</option>
|
1015
|
<option value="synproxy state"<?php if($pconfig['statetype'] == "synproxy state") echo "selected"; ?>>synproxy state</option>
|
1016
|
<option value="none"<?php if($pconfig['statetype'] == "none") echo "selected"; ?>>none</option>
|
1017
|
</select><br>HINT: Select which type of state tracking mechanism you would like to use. If in doubt, use keep state.
|
1018
|
<p>
|
1019
|
<table width="90%">
|
1020
|
<tr><td width="25%"><ul><li>keep state</li></td><td>Works with all IP protocols.</ul></td></tr>
|
1021
|
<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>
|
1022
|
<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>
|
1023
|
</table>
|
1024
|
</p>
|
1025
|
</div>
|
1026
|
</td>
|
1027
|
</tr>
|
1028
|
<tr>
|
1029
|
<td width="22%" valign="top" class="vncell">No XMLRPC Sync</td>
|
1030
|
<td width="78%" class="vtable">
|
1031
|
<div id="showadvnoxmlrpcsyncbox">
|
1032
|
<input type="button" onClick="show_advanced_noxmlrpc()" value="Advanced"></input> - Show advanced option</a>
|
1033
|
</div>
|
1034
|
<div id="shownoxmlrpcadv" style="display:none">
|
1035
|
<input type="checkbox" name="nosync"<?php if($pconfig['nosync']) echo " CHECKED"; ?>><br>
|
1036
|
HINT: This prevents the rule from automatically syncing to other CARP members.
|
1037
|
</div>
|
1038
|
</td>
|
1039
|
</tr>
|
1040
|
<?php
|
1041
|
//build list of schedules
|
1042
|
$schedules = array();
|
1043
|
$schedules[] = "none";//leave none to leave rule enabled all the time
|
1044
|
if(is_array($config['schedules']['schedule'])) {
|
1045
|
foreach ($config['schedules']['schedule'] as $schedule) {
|
1046
|
if ($schedule['name'] <> "")
|
1047
|
$schedules[] = $schedule['name'];
|
1048
|
}
|
1049
|
}
|
1050
|
?>
|
1051
|
<tr>
|
1052
|
<td width="22%" valign="top" class="vncell">Schedule</td>
|
1053
|
<td width="78%" class="vtable">
|
1054
|
<div id="showadvschedulebox">
|
1055
|
<input type="button" onClick="show_advanced_schedule()" value="Advanced"></input> - Show advanced option</a>
|
1056
|
</div>
|
1057
|
<div id="showscheduleadv" style="display:none">
|
1058
|
<select name='sched'>
|
1059
|
<?php
|
1060
|
foreach($schedules as $schedule) {
|
1061
|
if($schedule == $pconfig['sched']) {
|
1062
|
$selected = " SELECTED";
|
1063
|
} else {
|
1064
|
$selected = "";
|
1065
|
}
|
1066
|
if ($schedule == "none") {
|
1067
|
echo "<option value=\"\" {$selected}>{$schedule}</option>\n";
|
1068
|
} else {
|
1069
|
echo "<option value=\"{$schedule}\" {$selected}>{$schedule}</option>\n";
|
1070
|
}
|
1071
|
}
|
1072
|
?>
|
1073
|
</select>
|
1074
|
<p>Leave as 'none' to leave the rule enabled all the time.</p>
|
1075
|
</div>
|
1076
|
</td>
|
1077
|
</tr>
|
1078
|
|
1079
|
<?php
|
1080
|
/* build a list of gateways */
|
1081
|
$gateways = array();
|
1082
|
$gateways[] = "default"; // default to don't use this feature :)
|
1083
|
if (is_array($config['gateways']['gateway_item'])) {
|
1084
|
foreach($config['gateways']['gateway_item'] as $gw_item) {
|
1085
|
if($gw_item['gateway'] <> "")
|
1086
|
$gateways[] = $gw_item['name'];
|
1087
|
}
|
1088
|
}
|
1089
|
|
1090
|
?>
|
1091
|
<tr>
|
1092
|
<td width="22%" valign="top" class="vncell">Gateway</td>
|
1093
|
<td width="78%" class="vtable">
|
1094
|
<div id="showadvgatewaybox">
|
1095
|
<input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show advanced option</a>
|
1096
|
</div>
|
1097
|
<div id="showgatewayadv" style="display:none">
|
1098
|
<select name='gateway'>
|
1099
|
<?php
|
1100
|
// add statically configured gateways to list
|
1101
|
foreach($gateways as $gw) {
|
1102
|
if($gw == "")
|
1103
|
continue;
|
1104
|
if($gw == $pconfig['gateway']) {
|
1105
|
$selected = " SELECTED";
|
1106
|
} else {
|
1107
|
$selected = "";
|
1108
|
}
|
1109
|
if ($gw == "default") {
|
1110
|
echo "<option value=\"\" {$selected}>{$gw}</option>\n";
|
1111
|
} else {
|
1112
|
$gwip = lookup_gateway_ip_by_name($gw);
|
1113
|
echo "<option value=\"{$gw}\" {$selected}>{$gw} - {$gwip}</option>\n";
|
1114
|
}
|
1115
|
}
|
1116
|
// add dynamic gateways to list
|
1117
|
$iflist = get_configured_interface_with_descr();
|
1118
|
foreach ($iflist as $ifent => $ifdesc) {
|
1119
|
if (in_array($config['interfaces'][$ifent]['ipaddr'], array("dhcp", "pppoe", "pptp"))) {
|
1120
|
if ($pconfig['gateway'] == $ifent) {
|
1121
|
$selected = " SELECTED";
|
1122
|
} else {
|
1123
|
$selected = "";
|
1124
|
}
|
1125
|
if($ifdesc <> "")
|
1126
|
echo "<option value=\"{$ifent}\" {$selected}>".strtoupper($ifent)." - {$ifdesc}</option>\n";
|
1127
|
} else if ($config['interfaces'][$ifent]['serialport'] <> "") {
|
1128
|
if ($pconfig['gateway'] == $ifent) {
|
1129
|
$selected = " SELECTED";
|
1130
|
} else {
|
1131
|
$selected = "";
|
1132
|
}
|
1133
|
if($ifdesc <> "")
|
1134
|
echo "<option value=\"{$ifent}\" {$selected}>".strtoupper($ifent)." - {$ifdesc}</option>\n";
|
1135
|
}
|
1136
|
}
|
1137
|
/* add gateway groups to the list */
|
1138
|
if (is_array($config['gateways']['gateway_group'])) {
|
1139
|
foreach($config['gateways']['gateway_group'] as $gw_group) {
|
1140
|
if($gw_group['name'] == "")
|
1141
|
continue;
|
1142
|
if($pconfig['gateway'] == $gw_group['name']) {
|
1143
|
echo "<option value=\"{$gw_group['name']}\" SELECTED>{$gw_group['name']}</option>\n";
|
1144
|
} else {
|
1145
|
echo "<option value=\"{$gw_group['name']}\">{$gw_group['name']}</option>\n";
|
1146
|
}
|
1147
|
}
|
1148
|
}
|
1149
|
?>
|
1150
|
</select>
|
1151
|
<p><strong>Leave as 'default' to use the system routing table. Or choose a gateway to utilize policy based routing.</strong></p>
|
1152
|
</div>
|
1153
|
</td>
|
1154
|
</tr>
|
1155
|
<tr>
|
1156
|
<td width="22%" valign="top" class="vncell">In/Out</td>
|
1157
|
<td width="78%" class="vtable">
|
1158
|
<div id="showadvinoutbox">
|
1159
|
<input type="button" onClick="show_advanced_inout()" value="Advanced"></input> - Show advanced option</a>
|
1160
|
</div>
|
1161
|
<div id="showinoutadv" style="display:none">
|
1162
|
<select name="dnpipe">
|
1163
|
<?php
|
1164
|
if (!is_array($dnqlist))
|
1165
|
$dnqlist = array();
|
1166
|
echo "<option value=\"none\"";
|
1167
|
if (!$dnqselected) echo " SELECTED";
|
1168
|
echo " >none</option>";
|
1169
|
foreach ($dnqlist as $dnq => $dnqkey) {
|
1170
|
if($dnq == "")
|
1171
|
continue;
|
1172
|
echo "<option value=\"$dnqkey\"";
|
1173
|
if ($dnqkey == $pconfig['dnpipe']) {
|
1174
|
$dnqselected = 1;
|
1175
|
echo " SELECTED";
|
1176
|
}
|
1177
|
echo ">{$dnq}</option>";
|
1178
|
}
|
1179
|
?>
|
1180
|
</select> /
|
1181
|
<select name="pdnpipe">
|
1182
|
<?php
|
1183
|
$dnqselected = 0;
|
1184
|
echo "<option value=\"none\"";
|
1185
|
if (!$dnqselected) echo " SELECTED";
|
1186
|
echo " >none</option>";
|
1187
|
foreach ($dnqlist as $dnq => $dnqkey) {
|
1188
|
if($dnq == "")
|
1189
|
continue;
|
1190
|
echo "<option value=\"$dnqkey\"";
|
1191
|
if ($dnqkey == $pconfig['pdnpipe']) {
|
1192
|
$dnqselected = 1;
|
1193
|
echo " SELECTED";
|
1194
|
}
|
1195
|
echo ">{$dnq}</option>";
|
1196
|
}
|
1197
|
?>
|
1198
|
</select>
|
1199
|
<br />
|
1200
|
<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>
|
1201
|
</div>
|
1202
|
</td>
|
1203
|
</tr>
|
1204
|
|
1205
|
<tr>
|
1206
|
<td width="22%" valign="top" class="vncell">Ackqueue/Queue</td>
|
1207
|
<td width="78%" class="vtable">
|
1208
|
<div id="showadvackqueuebox">
|
1209
|
<input type="button" onClick="show_advanced_ackqueue()" value="Advanced"></input> - Show advanced option</a>
|
1210
|
</div>
|
1211
|
<div id="showackqueueadv" style="display:none">
|
1212
|
<select name="ackqueue">
|
1213
|
<?php
|
1214
|
if (!is_array($qlist))
|
1215
|
$qlist = array();
|
1216
|
echo "<option value=\"none\"";
|
1217
|
if (!$qselected) echo " SELECTED";
|
1218
|
echo " >none</option>";
|
1219
|
foreach ($qlist as $q => $qkey) {
|
1220
|
if($q == "")
|
1221
|
continue;
|
1222
|
echo "<option value=\"$q\"";
|
1223
|
if ($q == $pconfig['ackqueue']) {
|
1224
|
$qselected = 1;
|
1225
|
echo " SELECTED";
|
1226
|
}
|
1227
|
echo ">{$q}</option>";
|
1228
|
}
|
1229
|
?>
|
1230
|
</select> /
|
1231
|
<select name="defaultqueue">
|
1232
|
<?php
|
1233
|
$qselected = 0;
|
1234
|
echo "<option value=\"none\"";
|
1235
|
if (!$qselected) echo " SELECTED";
|
1236
|
echo " >none</option>";
|
1237
|
foreach ($qlist as $q => $qkey) {
|
1238
|
if($q == "")
|
1239
|
continue;
|
1240
|
echo "<option value=\"$q\"";
|
1241
|
if ($q == $pconfig['defaultqueue']) {
|
1242
|
$qselected = 1;
|
1243
|
echo " SELECTED";
|
1244
|
}
|
1245
|
echo ">{$q}</option>";
|
1246
|
}
|
1247
|
?>
|
1248
|
</select>
|
1249
|
<br />
|
1250
|
<span class="vexpl">Choose the Acknowledge Queue only if you have selected Queue.</span>
|
1251
|
</td>
|
1252
|
</tr>
|
1253
|
<tr>
|
1254
|
<td width="22%" valign="top" class="vncell">Layer7</td>
|
1255
|
<td width="78%" class="vtable">
|
1256
|
<div id="showadvlayer7box">
|
1257
|
<input type="button" onClick="show_advanced_layer7()" value="Advanced"></input> - Show advanced option</a>
|
1258
|
</div>
|
1259
|
<div id="showlayer7adv" style="display:none">
|
1260
|
<select name="l7container">
|
1261
|
<?php
|
1262
|
if (!is_array($l7clist))
|
1263
|
$dnqlist = array();
|
1264
|
echo "<option value=\"none\"";
|
1265
|
echo " >none</option>";
|
1266
|
foreach ($l7clist as $l7ckey) {
|
1267
|
echo "<option value=\"{$l7ckey}\"";
|
1268
|
if ($l7ckey == $pconfig['l7container']) {
|
1269
|
echo " SELECTED";
|
1270
|
}
|
1271
|
echo ">{$l7ckey}</option>";
|
1272
|
}
|
1273
|
?>
|
1274
|
</select>
|
1275
|
<br/>
|
1276
|
<span class="vexpl">
|
1277
|
Choose a Layer7 container to apply application protocol inspection rules.
|
1278
|
These are valid for TCP and UDP protocols only.
|
1279
|
</span>
|
1280
|
</div>
|
1281
|
</td>
|
1282
|
</tr>
|
1283
|
<tr>
|
1284
|
<td width="22%" valign="top"> </td>
|
1285
|
<td width="78%">
|
1286
|
<br>
|
1287
|
<input name="Submit" type="submit" class="formbtn" value="Save"> <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
|
1288
|
<?php if (isset($id) && $a_filter[$id]): ?>
|
1289
|
<input name="id" type="hidden" value="<?=$id;?>">
|
1290
|
<?php endif; ?>
|
1291
|
<input name="after" type="hidden" value="<?=$after;?>">
|
1292
|
</td>
|
1293
|
</tr>
|
1294
|
</table>
|
1295
|
</form>
|
1296
|
<script language="JavaScript">
|
1297
|
<!--
|
1298
|
ext_change();
|
1299
|
typesel_change();
|
1300
|
proto_change();
|
1301
|
|
1302
|
<?php
|
1303
|
$isfirst = 0;
|
1304
|
$aliases = "";
|
1305
|
$addrisfirst = 0;
|
1306
|
$aliasesaddr = "";
|
1307
|
if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
|
1308
|
foreach($config['aliases']['alias'] as $alias_name) {
|
1309
|
switch ($alias_name['type']) {
|
1310
|
case "port":
|
1311
|
if($isfirst == 1) $portaliases .= ",";
|
1312
|
$portaliases .= "'" . $alias_name['name'] . "'";
|
1313
|
$isfirst = 1;
|
1314
|
break;
|
1315
|
case "host":
|
1316
|
case "network":
|
1317
|
case "openvpn":
|
1318
|
if($addrisfirst == 1) $aliasesaddr .= ",";
|
1319
|
$aliasesaddr .= "'" . $alias_name['name'] . "'";
|
1320
|
$addrisfirst = 1;
|
1321
|
break;
|
1322
|
default:
|
1323
|
break;
|
1324
|
}
|
1325
|
}
|
1326
|
?>
|
1327
|
|
1328
|
var addressarray=new Array(<?php echo $aliasesaddr; ?>);
|
1329
|
var customarray=new Array(<?php echo $portaliases; ?>);
|
1330
|
|
1331
|
var oTextbox1 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
|
1332
|
var oTextbox2 = new AutoSuggestControl(document.getElementById("srcbeginport_cust"), new StateSuggestions(customarray));
|
1333
|
var oTextbox3 = new AutoSuggestControl(document.getElementById("srcendport_cust"), new StateSuggestions(customarray));
|
1334
|
var oTextbox4 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
|
1335
|
var oTextbox5 = new AutoSuggestControl(document.getElementById("dstbeginport_cust"), new StateSuggestions(customarray));
|
1336
|
var oTextbox6 = new AutoSuggestControl(document.getElementById("dstendport_cust"), new StateSuggestions(customarray));
|
1337
|
//-->
|
1338
|
</script>
|
1339
|
<?php include("fend.inc"); ?>
|
1340
|
</body>
|
1341
|
</html>
|