Project

General

Profile

Download (29.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	firewall_rules.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
##|+PRIV
35
##|*IDENT=page-firewall-rules
36
##|*NAME=Firewall: Rules page
37
##|*DESCR=Allow access to the 'Firewall: Rules' page.
38
##|*MATCH=firewall_rules.php*
39
##|-PRIV
40

    
41

    
42
$pgtitle = array("Firewall", "Rules");
43
require("guiconfig.inc");
44

    
45
if (!is_array($config['filter']['rule'])) {
46
	$config['filter']['rule'] = array();
47
}
48
filter_rules_sort();
49
$a_filter = &$config['filter']['rule'];
50

    
51
$if = $_GET['if'];
52
if ($_POST['if'])
53
	$if = $_POST['if'];
54

    
55
$ifdescs = get_configured_interface_with_descr();
56

    
57
foreach ($ifdescs as $ifent => $ifdesc)
58
	if(have_ruleint_access($ifent)) 
59
		$iflist[$ifent] = $ifdesc;
60

    
61
if ($config['l2tp']['mode'] == "server")
62
        if(have_ruleint_access("l2tp"))
63
                $iflist['l2tp'] = "L2TP VPN";
64

    
65
if ($config['pptpd']['mode'] == "server")
66
	if(have_ruleint_access("pptp")) 
67
		$iflist['pptp'] = "PPTP VPN";
68

    
69
if ($config['pppoe']['mode'] == "server")
70
	if(have_ruleint_access("pppoe")) 
71
		$iflist['pppoe'] = "PPPoE VPN";
72

    
73
/* add ipsec interfaces */
74
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable']))
75
	if(have_ruleint_access("enc0")) 
76
		$iflist["enc0"] = "IPsec";
77

    
78
/* add openvpn/tun interfaces */
79
if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
80
   	$iflist["openvpn"] = "OpenVPN";
81

    
82
if (!$if || !isset($iflist[$if])) {
83
	if ("any" == $if)
84
                $if = "FloatingRules";
85
        else if ("FloatingRules" != $if)
86
                $if = "wan";
87
}
88

    
89
if ($_POST) {
90

    
91
	$pconfig = $_POST;
92

    
93
	if ($_POST['apply']) {
94
		$retval = 0;
95
		config_lock();
96
		$retval = filter_configure();
97
		config_unlock();
98

    
99
		if (file_exists($d_filterconfdirty_path))
100
			unlink($d_filterconfdirty_path);
101

    
102
		$savemsg = "The settings have been applied.  The firewall rules are now reloading in the background.  You can also <a href='status_filter_reload.php'>monitor</a> the reload progress.";
103
	}
104
}
105

    
106
if ($_GET['act'] == "del") {
107
        if ($a_filter[$_GET['id']]) {
108
                unset($a_filter[$_GET['id']]);
109
                write_config();
110
                touch($d_filterconfdirty_path);
111
                header("Location: firewall_rules.php?if={$if}");
112
                exit;
113
        }
114
}
115

    
116
if (isset($_POST['del_x'])) {
117
	/* delete selected rules */
118
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
119
		foreach ($_POST['rule'] as $rulei) {
120
			unset($a_filter[$rulei]);
121
		}
122
		write_config();
123
		touch($d_filterconfdirty_path);
124
		header("Location: firewall_rules.php?if={$if}");
125
		exit;
126
	}
127
} else if ($_GET['act'] == "toggle") {
128
	if ($a_filter[$_GET['id']]) {
129
                if(isset($a_filter[$_GET['id']]['disabled']))
130
                        unset($a_filter[$_GET['id']]['disabled']);
131
                else
132
                        $a_filter[$_GET['id']]['disabled'] = true;
133
		write_config();
134
		touch($d_filterconfdirty_path);
135
		header("Location: firewall_rules.php?if={$if}");
136
		exit;
137
	}
138
} else {
139
	/* yuck - IE won't send value attributes for image buttons, while Mozilla does -
140
	   so we use .x/.y to fine move button clicks instead... */
141
	unset($movebtn);
142
	foreach ($_POST as $pn => $pd) {
143
		if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
144
			$movebtn = $matches[1];
145
			break;
146
		}
147
	}
148
	/* move selected rules before this rule */
149
	if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
150
		$a_filter_new = array();
151

    
152
		/* copy all rules < $movebtn and not selected */
153
		for ($i = 0; $i < $movebtn; $i++) {
154
			if (!in_array($i, $_POST['rule']))
155
				$a_filter_new[] = $a_filter[$i];
156
		}
157

    
158
		/* copy all selected rules */
159
		for ($i = 0; $i < count($a_filter); $i++) {
160
			if ($i == $movebtn)
161
				continue;
162
			if (in_array($i, $_POST['rule']))
163
				$a_filter_new[] = $a_filter[$i];
164
		}
165

    
166
		/* copy $movebtn rule */
167
		if ($movebtn < count($a_filter))
168
			$a_filter_new[] = $a_filter[$movebtn];
169

    
170
		/* copy all rules > $movebtn and not selected */
171
		for ($i = $movebtn+1; $i < count($a_filter); $i++) {
172
			if (!in_array($i, $_POST['rule']))
173
				$a_filter_new[] = $a_filter[$i];
174
		}
175

    
176
		$a_filter = $a_filter_new;
177
		write_config();
178
		touch($d_filterconfdirty_path);
179
		header("Location: firewall_rules.php?if={$if}");
180
		exit;
181
	}
182
}
183
$closehead = false;
184

    
185
include("head.inc");
186

    
187
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
188
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
189
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
190
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
191
?>
192
</head>
193

    
194
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
195
<?php include("fbegin.inc"); ?>
196
<form action="firewall_rules.php" method="post">
197
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js">
198
</script>
199
<?php if ($savemsg) print_info_box($savemsg); ?>
200
<?php if (file_exists($d_filterconfdirty_path)): ?><p>
201
<?php print_info_box_np("The firewall rule configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
202
<?php endif; ?>
203
<table width="100%" border="0" cellpadding="0" cellspacing="0">
204
  <tr><td class="tabnavtbl">
205
  <?php
206
	/* active tabs */
207
	$tab_array = array();
208
       if ("FloatingRules" == $if)
209
                        $active = true;
210
                else
211
                        $active = false;
212
        $tab_array[] = array("Floating", $active, "firewall_rules.php?if=FloatingRules");
213
	$tabscounter = 0; $i = 0; foreach ($iflist as $ifent => $ifname) {
214
		if ($ifent == $if)
215
			$active = true;
216
		else
217
			$active = false;
218
		$tab_array[] = array($ifname, $active, "firewall_rules.php?if={$ifent}");
219
	}
220
	display_top_tabs($tab_array);
221
  ?>
222
  </td></tr>
223
  <tr>
224
    <td>
225
	<div id="mainarea">
226
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
227
                <tr id="frheader">
228
                  <td width="3%" class="list">&nbsp;</td>
229
                  <td width="5%" class="list">&nbsp;</td>
230
                  <td width="6%" class="listhdrr">Proto</td>
231
                  <td width="15%" class="listhdrr">Source</td>
232
                  <td width="7%" class="listhdrr">Port</td>
233
                  <td width="15%" class="listhdrr">Destination</td>
234
                  <td width="7%" class="listhdrr">Port</td>
235
		  <td width="5%" class="listhdrr">Gateway</td>
236
		  <td width="10%" class="listhdrr">Queue</td>
237
		  <td width="5%" class="listhdrr">Schedule</td>
238
                  <td width="22%" class="listhdr">Description</td>
239
                  <td width="10%" class="list">
240
			<table border="0" cellspacing="0" cellpadding="1">
241
			   <tr>
242
				<?php
243
					$nrules = 0;
244
					for ($i = 0; isset($a_filter[$i]); $i++) {
245
						$filterent = $a_filter[$i];
246
						if ($filterent['interface'] != $if && !isset($filterent['floating']))
247
                                                       continue;
248
                                               if (isset($filterent['floating']) && "FloatingRules" != $if)
249
							continue;
250
						$nrules++;
251
					}
252
				?>
253
				<td>
254
				<?php if ($nrules == 0): ?>
255
				<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="delete selected rules" border="0"><?php else: ?>
256
				<input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="delete selected rules" onclick="return confirm('Do you really want to delete the selected rules?')"><?php endif; ?>
257
				</td>
258
				<td align="center" valign="middle"><a href="firewall_rules_edit.php?if=<?=$if;?>&after=-1"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add new rule" width="17" height="17" border="0"></a></td>
259
			   </tr>
260
			</table>
261
		  </td>
262
		</tr>
263
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
264
                <tr valign="top" id="frrfc1918">
265
                  <td width="3%" class="list">&nbsp;</td>
266
                  <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td>
267
                  <td class="listlr" style="background-color: #e0e0e0">*</td>
268
                  <td class="listr" style="background-color: #e0e0e0">RFC 1918 networks</td>
269
                  <td class="listr" style="background-color: #e0e0e0">*</td>
270
                  <td class="listr" style="background-color: #e0e0e0">*</td>
271
                  <td class="listr" style="background-color: #e0e0e0">*</td>
272
                  <td class="listr" style="background-color: #e0e0e0">*</td>
273
		<td class="listr" style="background-color: #e0e0e0">Default</td>
274
	 		 <td class="listr" style="background-color: #e0e0e0">*</td>
275
                  <td class="listbg">Block private networks</td>
276
                  <td valign="middle" nowrap class="list">
277
				    <table border="0" cellspacing="0" cellpadding="1">
278
					<tr>
279
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="move selected rules before this rule"></td>
280
					  <td><a href="interfaces.php#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit rule" width="17" height="17" border="0"></a></td>
281
					</tr>
282
					<tr>
283
					  <td align="center" valign="middle"></td>
284
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="add a new rule based on this one" width="17" height="17" border="0"></td>
285
					</tr>
286
					</table>
287
				  </td>
288
				</tr>
289
<?php endif; ?>
290
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
291
                <tr valign="top" id="frrfc1918">
292
                  <td width="3%" class="list">&nbsp;</td>
293
                  <td class="listt" align="center"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11" border="0"></td>
294
                  <td class="listlr" style="background-color: #e0e0e0">*</td>
295
                  <td class="listr" style="background-color: #e0e0e0">Reserved/not assigned by IANA</td>
296
                  <td class="listr" style="background-color: #e0e0e0">*</td>
297
                  <td class="listr" style="background-color: #e0e0e0">*</td>
298
                  <td class="listr" style="background-color: #e0e0e0">*</td>
299
				  <td class="listr" style="background-color: #e0e0e0">*</td>
300
				   <td class="listr" style="background-color: #e0e0e0">*</td>
301
		  <td class="listr" style="background-color: #e0e0e0">*</td>
302
                  <td class="listbg">Block bogon networks</td>
303
                  <td valign="middle" nowrap class="list">
304
				    <table border="0" cellspacing="0" cellpadding="1">
305
					<tr>
306
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="move selected rules before this rule"></td>
307
					  <td><a href="interfaces.php#rfc1918"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit rule" width="17" height="17" border="0"></a></td>
308
					</tr>
309
					<tr>
310
					  <td align="center" valign="middle"></td>
311
					  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus_d.gif" title="add a new rule based on this one" width="17" height="17" border="0"></td>
312
					</tr>
313
					</table>
314
				  </td>
315
				</tr>
316
<?php endif; ?>
317
				<?php $nrules = 0; for ($i = 0; isset($a_filter[$i]); $i++):
318
					$filterent = $a_filter[$i];
319
					if ($filterent['interface'] != $if && !isset($filterent['floating']))
320
                                               continue;
321
                                        if (isset($filterent['floating']) && "FloatingRules" != $if)
322
                                                continue;
323
				?>
324
                <tr valign="top" id="fr<?=$nrules;?>">
325
                  <td class="listt"><input type="checkbox" id="frc<?=$nrules;?>" name="rule[]" value="<?=$i;?>" onClick="fr_bgcolor('<?=$nrules;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;"></td>
326
                  <td class="listt" align="center">
327
				  <?php if ($filterent['type'] == "block")
328
				  			$iconfn = "block";
329
						else if ($filterent['type'] == "reject") {
330
							if ($filterent['protocol'] == "tcp" || $filterent['protocol'] == "udp" || $filterent['protocol'] == "tcp/udp")
331
								$iconfn = "reject";
332
							else
333
								$iconfn = "block";
334
						} else
335
							$iconfn = "pass";
336
						if (isset($filterent['disabled'])) {
337
							$textss = "<span class=\"gray\">";
338
							$textse = "</span>";
339
							$iconfn .= "_d";
340
						} else {
341
							$textss = $textse = "";
342
						}
343
				  ?>
344
				  <a href="?if=<?=$if;?>&act=toggle&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="click to toggle enabled/disabled status"></a>
345
				  <?php if (isset($filterent['log'])):
346
							$iconfnlog = "log_s";
347
						if (isset($filterent['disabled']))
348
							$iconfnlog .= "_d";
349
				  	?>
350
				  <br><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfnlog;?>.gif" width="11" height="15" border="0">
351
				  <?php endif; ?>
352
				  </td>
353
				<?php
354
				
355
				//build Alias popup box
356
				$span_end = "";
357
				$alias_src_span_begin = "";
358
				$alias_src_port_span_begin = "";
359
				$alias_dst_span_begin = "";
360
				$alias_dst_port_span_begin = "";
361
				
362
				$alias_popup = rule_popup($filterent['source']['address'],pprint_port($filterent['source']['port']),$filterent['destination']['address'],pprint_port($filterent['destination']['port']));
363
				$span_end = "</U></span>";
364
					
365
				$alias_src_span_begin = $alias_popup["src"];
366
				 									
367
				$alias_src_port_span_begin = $alias_popup["srcport"];
368
													
369
				$alias_dst_span_begin = $alias_popup["dst"];
370
														
371
				$alias_dst_port_span_begin = $alias_popup["dstport"];
372
					
373
				//build Schedule popup box
374
				$a_schedules = &$config['schedules']['schedule'];
375
				$schedule_span_begin = "";
376
				$schedule_span_end = "";
377
				$sched_caption = "";
378
				$sched_content = "";
379
				$schedstatus = false;
380
				$dayArray = array ('Mon','Tues','Wed','Thur','Fri','Sat','Sun');
381
				$monthArray = array ('January','February','March','April','May','June','July','August','September','October','November','December');
382
				if($config['schedules']['schedule'] <> "" and is_array($config['schedules']['schedule'])){
383
					foreach ($a_schedules as $schedule)
384
					{
385
						if ($schedule['name'] == $filterent['sched'] ){
386
							$schedstatus = get_time_based_rule_status($schedule);
387
							
388
							foreach($schedule['timerange'] as $timerange) {
389
								$tempFriendlyTime = "";
390
								$tempID = "";
391
								$firstprint = false;
392
								if ($timerange){
393
									$dayFriendly = "";
394
									$tempFriendlyTime = "";							
395
										
396
									//get hours
397
									$temptimerange = $timerange['hour'];
398
									$temptimeseparator = strrpos($temptimerange, "-");
399
									
400
									$starttime = substr ($temptimerange, 0, $temptimeseparator); 
401
									$stoptime = substr ($temptimerange, $temptimeseparator+1); 
402
										
403
									if ($timerange['month']){
404
										$tempmontharray = explode(",", $timerange['month']);
405
										$tempdayarray = explode(",",$timerange['day']);
406
										$arraycounter = 0;
407
										$firstDayFound = false;
408
										$firstPrint = false;
409
										foreach ($tempmontharray as $monthtmp){
410
											$month = $tempmontharray[$arraycounter];
411
											$day = $tempdayarray[$arraycounter];
412
											
413
											if (!$firstDayFound)
414
											{
415
												$firstDay = $day;
416
												$firstmonth = $month;
417
												$firstDayFound = true;
418
											}
419
												
420
											$currentDay = $day;
421
											$nextDay = $tempdayarray[$arraycounter+1];
422
											$currentDay++;
423
											if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])){
424
												if ($firstPrint)
425
													$dayFriendly .= ", ";
426
												$currentDay--;
427
												if ($currentDay != $firstDay)
428
													$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
429
												else
430
													$dayFriendly .=  $monthArray[$month-1] . " " . $day;
431
												$firstDayFound = false;	
432
												$firstPrint = true;
433
											}													
434
											$arraycounter++;	
435
										}
436
									}
437
									else
438
									{
439
										$tempdayFriendly = $timerange['position'];
440
										$firstDayFound = false;
441
										$tempFriendlyDayArray = explode(",", $tempdayFriendly);								
442
										$currentDay = "";
443
										$firstDay = "";
444
										$nextDay = "";
445
										$counter = 0;													
446
										foreach ($tempFriendlyDayArray as $day){
447
											if ($day != ""){
448
												if (!$firstDayFound)
449
												{
450
													$firstDay = $tempFriendlyDayArray[$counter];
451
													$firstDayFound = true;
452
												}
453
												$currentDay =$tempFriendlyDayArray[$counter];
454
												//get next day
455
												$nextDay = $tempFriendlyDayArray[$counter+1];
456
												$currentDay++;					
457
												if ($currentDay != $nextDay){
458
													if ($firstprint)
459
														$dayFriendly .= ", ";
460
													$currentDay--;
461
													if ($currentDay != $firstDay)
462
														$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
463
													else
464
														$dayFriendly .= $dayArray[$firstDay-1];
465
													$firstDayFound = false;	
466
													$firstprint = true;			
467
												}
468
												$counter++;
469
											}
470
										}
471
									}		
472
									$timeFriendly = $starttime . " - " . $stoptime;
473
									$description = $timerange['rangedescr'];
474
									$sched_content .= $dayFriendly . "; " . $timeFriendly . "<br>";
475
								}
476
							}
477
							$sched_caption = $schedule['descr'];
478
							$schedule_span_begin = "<span style=\"cursor: help;\" onmouseover=\"domTT_activate(this, event, 'content', '<h1>$sched_caption</h1><p>$sched_content</p>', 'trail', true, 'delay', 0, 'fade', 'both', 'fadeMax', 93, 'styleClass', 'niceTitle');\" onmouseout=\"this.style.color = ''; domTT_mouseout(this, event);\"><U>";
479
							$schedule_span_end = "</U></span>";
480
						}
481
					}
482
				}
483
				$printicon = false;
484
				$alttext = "";
485
				$image = "";
486
				if (!isset($filterent['disabled'])){
487
					 if ($schedstatus) 
488
					 { 
489
					 	if ($iconfn == "block" || $iconfn == "reject")
490
					 	{
491
					 		$image = "icon_block";
492
					 		$alttext = "Traffic matching this rule is currently being denied";
493
					 	}
494
					 	else
495
					 	{
496
					 		$image = "icon_pass";
497
					 		$alttext = "Traffic matching this rule is currently being allowed";
498
					 	}
499
					 	$printicon = true;
500
					  }
501
					  else if ($filterent['sched'])
502
					  { 
503
					 	if ($iconfn == "block" || $iconfn == "reject")
504
					 	{
505
					 		$image = "icon_block_d";
506
					 		$alttext = "Traffic matching this rule is currently being allowed";
507
					 	}
508
					 	else
509
					 	{
510
					 		$image = "icon_block";
511
					 		$alttext = "Traffic matching this rule is currently being denied";
512
					 	}
513
					 	$printicon = true;				  	
514
					  }
515
				}
516
				?>
517
                  <td class="listlr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
518
                    <?=$textss;?><?php if (isset($filterent['protocol'])) echo strtoupper($filterent['protocol']); else echo "*"; ?><?=$textse;?>
519
                  </td>
520
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
521
				    <?=$textss;?><?php echo $alias_src_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['source']));?><?php echo $alias_src_span_end;?><?=$textse;?>
522
                  </td>
523
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
524
                    <?=$textss;?><?php echo $alias_src_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['source']['port'])); ?><?php echo $alias_src_port_span_end;?><?=$textse;?>
525
                  </td>
526
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
527
				    <?=$textss;?><?php echo $alias_dst_span_begin;?><?php echo htmlspecialchars(pprint_address($filterent['destination'])); ?><?php echo $alias_dst_span_end;?><?=$textse;?>
528
                  </td>
529
	              <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
530
                    <?=$textss;?><?php echo $alias_dst_port_span_begin;?><?php echo htmlspecialchars(pprint_port($filterent['destination']['port'])); ?><?php echo $alias_dst_port_span_end;?><?=$textse;?>
531
                  </td>
532
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';">
533
                    <?=$textss;?><?php if (isset($config['interfaces'][$filterent['gateway']]['descr'])) echo htmlspecialchars($config['interfaces'][$filterent['gateway']]['descr']); else  echo htmlspecialchars(pprint_port($filterent['gateway'])); ?><?=$textse;?>
534
                  </td>
535
<td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><?=$textss;?>
536
                          <?php
537
							if (isset($filterent['ackqueue']) && isset($filterent['defaultqueue'])) {
538
								$desc = $filterent['ackqueue'] ;
539
							    echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['ackqueue']}&action=show\">{$desc}</a>";
540
								$desc = $filterent['defaultqueue'];
541
							    echo "/<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>";
542
							} else if (isset($filterent['defaultqueue'])) {
543
								$desc = $filterent['defaultqueue'];
544
							    echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&action=show\">{$desc}</a>"; }
545
							else echo "none";
546
						  ?><?=$textse;?>
547
                        </td>
548
                  <td class="listr" onClick="fr_toggle(<?=$nrules;?>)" id="frd<?=$nrules;?>" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';"><font color="black">
549
                    <?php if ($printicon) { ?><img src="./themes/<?= $g['theme']; ?>/images/icons/<?php echo $image; ?>.gif" title="<?php echo $alttext;?>" border="0"><?php } ?>&nbsp;<?=$textss;?><?php echo $schedule_span_begin;?><?=htmlspecialchars($filterent['sched']);?><?php echo $schedule_span_end; ?><?=$textse;?>
550
                  </td>
551
                  <td class="listbg" onClick="fr_toggle(<?=$nrules;?>)" ondblclick="document.location='firewall_rules_edit.php?id=<?=$i;?>';" class="descr">
552
                    <?=$textss;?><?=htmlspecialchars($filterent['descr']);?>&nbsp;<?=$textse;?>
553
                  </td>
554
                  <td valign="middle" nowrap class="list">
555
				    <table border="0" cellspacing="0" cellpadding="1">
556
					<tr>
557
					  <td><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="move selected rules before this rule" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"></td>
558
					  <td><a href="firewall_rules_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit rule" width="17" height="17" border="0"></a></td>
559
					</tr>
560
					<tr>
561
					  <td align="center" valign="middle"><a href="firewall_rules.php?act=del&if=<?=$if;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="delete rule" onclick="return confirm('Do you really want to delete this rule?')"></a></td>
562
					  <td><a href="firewall_rules_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add a new rule based on this one" width="17" height="17" border="0"></a></td>
563
					</tr>
564
					</table>
565
				  </td>
566
				</tr>
567
			  <?php $nrules++; endfor; ?>
568
			  <?php if ($nrules == 0): ?>
569
              <td class="listt"></td>
570
			  <td class="listt"></td>
571
			  <td class="listlr" colspan="9" align="center" valign="middle">
572
			  <span class="gray">
573
			  No rules are currently defined for this interface.<br>
574
			  All incoming connections on this interface will be blocked until you add pass rules.<br><br>
575
			  Click the <a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add new rule" border="0" width="17" height="17" align="absmiddle"></a> button to add a new rule.</span>
576
			  </td>
577
			  <?php endif; ?>
578
                <tr id="fr<?=$nrules;?>">
579
                  <td class="list"></td>
580
                  <td class="list"></td>
581
                  <td class="list">&nbsp;</td>
582
                  <td class="list">&nbsp;</td>
583
                  <td class="list">&nbsp;</td>
584
		  <td class="list">&nbsp;</td>
585
		  <td class="list">&nbsp;</td>
586
                  <td class="list">&nbsp;</td>
587
                  <td class="list">&nbsp;</td>
588
                  <td class="list">&nbsp;</td>
589
                  <td class="list">&nbsp;</td>
590
                  <td class="list">
591
				    <table border="0" cellspacing="0" cellpadding="1">
592
					<tr>
593
				      <td>
594
					  <?php if ($nrules == 0): ?><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="move selected rules to end" border="0"><?php else: ?><input name="move_<?=$i;?>" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" width="17" height="17" title="move selected rules to end" onMouseOver="fr_insline(<?=$nrules;?>, true)" onMouseOut="fr_insline(<?=$nrules;?>, false)"><?php endif; ?></td>
595
					  <td></td>
596
				    </tr>
597
					<tr>
598
					  <td>
599
					  <?php if ($nrules == 0): ?>
600
					  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="delete selected rules" border="0"><?php else: ?>
601
					  <input name="del" type="image" src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" title="delete selected rules" onclick="return confirm('Do you really want to delete the selected rules?')"><?php endif; ?>
602
					  </td>
603
			                  <td><a href="firewall_rules_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add new rule" width="17" height="17" border="0"></a></td>
604
					</tr>
605
				    </table>
606
				  </td>
607
				</tr>
608
              </table>
609
	      <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
610
                <tr>
611
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass.gif" width="11" height="11"></td>
612
                  <td>pass</td>
613
                  <td width="14"></td>
614
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" width="11" height="11"></td>
615
                  <td>block</td>
616
                  <td width="14"></td>
617
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject.gif" width="11" height="11"></td>
618
                  <td>reject</td>
619
                  <td width="14"></td>
620
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" width="11" height="11"></td>
621
                  <td>log</td>
622
                </tr>
623
                <tr>
624
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_pass_d.gif" width="11" height="11"></td>
625
                  <td nowrap>pass (disabled)</td>
626
                  <td>&nbsp;</td>
627
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block_d.gif" width="11" height="11"></td>
628
                  <td nowrap>block (disabled)</td>
629
                  <td>&nbsp;</td>
630
                  <td><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_reject_d.gif" width="11" height="11"></td>
631
                  <td nowrap>reject (disabled)</td>
632
                  <td>&nbsp;</td>
633
                  <td width="16"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif" width="11" height="11"></td>
634
                  <td nowrap>log (disabled)</td>
635
                </tr>
636
		<tr>
637
		  <td colspan="10">
638
  <p>
639
  <strong><span class="red">Hint:<br>
640
  </span></strong>Rules are evaluated on a first-match basis (i.e.
641
  the action of the first rule to match a packet will be executed).
642
  This means that if you use block rules, you'll have to pay attention
643
  to the rule order. Everything that isn't explicitly passed is blocked
644
  by default.</p>
645
		 </td>
646
	        </tr>
647
              </table>
648
	</div>
649
    </td>
650
  </tr>
651
</table>
652
  <input type="hidden" name="if" value="<?=$if;?>">
653
</form>
654
<?php include("fend.inc"); ?>
655
</body>
656
</html>
(49-49/205)