Project

General

Profile

Download (23.8 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    firewall_nat_out.php
5
    Copyright (C) 2004 Scott Ullrich
6
    All rights reserved.
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:	nat
35
*/
36

    
37
##|+PRIV
38
##|*IDENT=page-firewall-nat-outbound
39
##|*NAME=Firewall: NAT: Outbound page
40
##|*DESCR=Allow access to the 'Firewall: NAT: Outbound' page.
41
##|*MATCH=firewall_nat_out.php*
42
##|-PRIV
43

    
44
require("guiconfig.inc");
45
require_once("functions.inc");
46
require_once("filter.inc");
47
require_once("shaper.inc");
48

    
49
if (!is_array($config['nat']['advancedoutbound']))
50
	$config['nat']['advancedoutbound'] = array();
51

    
52
if (!is_array($config['nat']['advancedoutbound']['rule']))
53
	$config['nat']['advancedoutbound']['rule'] = array();
54

    
55
$a_out = &$config['nat']['advancedoutbound']['rule'];
56

    
57
if ($_POST['apply']) {
58
	write_config();
59

    
60
	$retval = 0;
61
	$retval |= filter_configure();
62

    
63
	if(stristr($retval, "error") <> true)
64
	        $savemsg = get_std_save_message($retval);
65
	else
66
		$savemsg = $retval;
67

    
68
	if ($retval == 0) {
69
		clear_subsystem_dirty('natconf');
70
		clear_subsystem_dirty('filter');
71
        }
72
}
73

    
74

    
75

    
76
if (isset($_POST['save']) && $_POST['save'] == "Save") {
77
	/* mutually exclusive settings - if user wants advanced NAT, we don't generate automatic rules */
78
	switch ($_POST['advancedoripsec']) {
79
	case "ipsecpassthru":
80
               	$config['nat']['ipsecpassthru']['enable'] = true;
81
               	unset($config['nat']['advancedoutbound']['enable']);
82
		break;
83
	case "advancedoutboundnat":
84
        	if (!isset($config['nat']['advancedoutbound']['enable'])) {
85
			$config['nat']['advancedoutbound']['enable'] = true;
86
			// if there are already AON rules configured, don't generate default ones
87
			if(!empty($a_out))
88
				continue;
89
			/*
90
			 *    user has enabled advanced outbound NAT and doesn't have rules
91
			 *    lets automatically create entries
92
			 *    for all of the interfaces to make life easier on the pip-o-chap
93
			 */
94
			$ifdescrs = get_configured_interface_with_descr();
95
				
96
			foreach($ifdescrs as $if => $ifdesc) {
97
				if (!interface_has_gateway($if))
98
					continue;
99
				foreach ($ifdescrs as $if2 => $ifdesc2) {
100
					if (interface_has_gateway($if2))
101
						continue;
102

    
103
					$osipaddr = get_interface_ip($if2);
104
					$ossubnet = get_interface_subnet($if2);
105
					if (!is_ipaddr($osipaddr) || empty($ossubnet))
106
						continue;
107
					$osn = gen_subnet($osipaddr, $ossubnet);
108

    
109
					$natent = array();
110
					$natent['source']['network'] = "{$osn}/{$ossubnet}";
111
					$natent['dstport'] = "500";
112
					$natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'),$ifdesc2,$ifdesc);
113
					$natent['target'] = "";
114
					$natent['interface'] = $if;
115
					$natent['destination']['any'] = true;
116
					$natent['staticnatport'] = true;
117
					$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
118
					$a_out[] = $natent;
119

    
120
					$natent = array();
121
					$natent['source']['network'] = "{$osn}/{$ossubnet}";
122
					$natent['sourceport'] = "";
123
					$natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'),$ifdesc2,$ifdesc);
124
					$natent['target'] = "";
125
					$natent['interface'] = $if;
126
					$natent['destination']['any'] = true;
127
					$natent['natport'] = "";
128
					$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
129
					$a_out[] = $natent;
130
				}
131
				/* Localhost */
132
				$natent = array();
133
				$natent['source']['network'] = "127.0.0.0/8";
134
				$natent['dstport'] = "";
135
				$natent['descr'] = sprintf(gettext('Auto created rule for localhost to %1$s'),$ifdesc);
136
				$natent['target'] = "";
137
				$natent['interface'] = $if;
138
				$natent['destination']['any'] = true;
139
				$natent['staticnatport'] = false;
140
				$natent['natport'] = "1024:65535";
141
				$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
142
				$a_out[] = $natent;
143
				/* PPTP subnet */
144
				if (($config['pptpd']['mode'] == "server") && is_private_ip($config['pptpd']['remoteip'])) {
145
					$pptp_size = empty($config['pptpd']['n_pptp_units']) ? 16 : $config['pptpd']['n_pptp_units'];
146
					$pptptopip = $pptp_size - 1;
147
					$pptp_subnets = ip_range_to_subnet_array($config['pptpd']['remoteip'], long2ip32(ip2long($config['pptpd']['remoteip'])+$pptptopip));
148
					foreach ($pptp_subnets as $pptpsn) {
149
						$natent = array();
150
						$natent['source']['network'] = $pptpsn;
151
						$natent['sourceport'] = "";
152
						$natent['descr'] = gettext("Auto created rule for PPTP server");
153
						$natent['target'] = "";
154
						$natent['interface'] = $if;
155
						$natent['destination']['any'] = true;
156
						$natent['natport'] = "";
157
						$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
158
						$a_out[] = $natent;
159
					}
160
				}
161
				/* PPPoE subnet */
162
				if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
163
					foreach ($config['pppoes']['pppoe'] as $pppoes) {
164
						if (($pppoes['mode'] == "server") && is_ipaddr($pppoes['localip'])) {
165
							if($pppoes['pppoe_subnet'] <> "")
166
								$ossubnet = $pppoes['pppoe_subnet'];
167
							else
168
								$ossubnet = "32";
169
							$osn = gen_subnet($pppoes['localip'], $ossubnet);
170
							$natent = array();
171
							$natent['source']['network'] = "{$osn}/{$ossubnet}";
172
							$natent['sourceport'] = "";
173
							$natent['descr'] = gettext("Auto created rule for PPPoE server");
174
							$natent['target'] = "";
175
							$natent['interface'] = $if;
176
							$natent['destination']['any'] = true;
177
							$natent['natport'] = "";
178
							$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
179
							$a_out[] = $natent;
180
						}
181
					}
182
				}
183
				/* L2TP subnet */
184
				if($config['l2tp']['mode'] == "server") {
185
					if (is_ipaddr($config['l2tp']['localip'])) {
186
						if($config['l2tp']['l2tp_subnet'] <> "")
187
							$ossubnet = $config['l2tp']['l2tp_subnet'];
188
						else
189
							$ossubnet = "32";
190
						$osn = gen_subnet($config['l2tp']['localip'], $ossubnet);
191
						$natent = array();
192
						$natent['source']['network'] = "{$osn}/{$ossubnet}";
193
						$natent['sourceport'] = "";
194
						$natent['descr'] = gettext("Auto created rule for L2TP server");
195
						$natent['target'] = "";
196
						$natent['interface'] = $if;
197
						$natent['destination']['any'] = true;
198
						$natent['natport'] = "";
199
						$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
200
						$a_out[] = $natent;
201
					}
202
				}
203
				/* add openvpn interfaces */
204
				if($config['openvpn']['openvpn-server']) {
205
					foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) {
206
						$natent = array();
207
						$natent['source']['network'] = $ovpnsrv['tunnel_network'];
208
						$natent['sourceport'] = "";
209
						$natent['descr'] = gettext("Auto created rule for OpenVPN server");
210
						$natent['target'] = "";
211
						$natent['interface'] = $if;
212
						$natent['destination']['any'] = true;
213
						$natent['natport'] = "";
214
						$natent['created'] = make_config_revision_entry(null, gettext("Manual Outbound NAT Switch"));
215
						$a_out[] = $natent;
216
					}
217
				}
218
			}
219

    
220
			$savemsg = gettext("Default rules for each interface have been created.");
221
		}
222
		break;
223
	}
224
	if (write_config())
225
		mark_subsystem_dirty('natconf');
226
        header("Location: firewall_nat_out.php");
227
        exit;
228
}
229

    
230
if ($_GET['act'] == "del") {
231
	if ($a_out[$_GET['id']]) {
232
		unset($a_out[$_GET['id']]);
233
		if (write_config())
234
			mark_subsystem_dirty('natconf');
235
		header("Location: firewall_nat_out.php");
236
		exit;
237
	}
238
}
239

    
240
if (isset($_POST['del_x'])) {
241
        /* delete selected rules */
242
        if (is_array($_POST['rule']) && count($_POST['rule'])) {
243
                foreach ($_POST['rule'] as $rulei) {
244
                        unset($a_out[$rulei]);
245
                }
246
		if (write_config())
247
			mark_subsystem_dirty('natconf');
248
                header("Location: firewall_nat_out.php");
249
                exit;
250
        }
251

    
252
} else if ($_GET['act'] == "toggle") {
253
	if ($a_out[$_GET['id']]) {
254
		if(isset($a_out[$_GET['id']]['disabled']))
255
			unset($a_out[$_GET['id']]['disabled']);
256
		else
257
			$a_out[$_GET['id']]['disabled'] = true;
258
		if (write_config("Firewall: NAT: Outbound, enable/disable NAT rule"))
259
			mark_subsystem_dirty('natconf');
260
		header("Location: firewall_nat_out.php");
261
		exit;
262
	}
263
} else {
264
        /* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
265
        unset($movebtn);
266
        foreach ($_POST as $pn => $pd) {
267
                if (preg_match("/move_(\d+)_x/", $pn, $matches)) {
268
                        $movebtn = $matches[1];
269
                        break;
270
                }
271
        }
272
        /* move selected rules before this rule */
273
        if (isset($movebtn) && is_array($_POST['rule']) && count($_POST['rule'])) {
274
                $a_out_new = array();
275

    
276
                /* copy all rules < $movebtn and not selected */
277
                for ($i = 0; $i < $movebtn; $i++) {
278
                        if (!in_array($i, $_POST['rule']))
279
                                $a_out_new[] = $a_out[$i];
280
                }
281

    
282
                /* copy all selected rules */
283
                for ($i = 0; $i < count($a_out); $i++) {
284
                        if ($i == $movebtn)
285
                                continue;
286
                        if (in_array($i, $_POST['rule']))
287
                                $a_out_new[] = $a_out[$i];
288
                }
289

    
290
                /* copy $movebtn rule */
291
                if ($movebtn < count($a_out))
292
                        $a_out_new[] = $a_out[$movebtn];
293

    
294
                /* copy all rules > $movebtn and not selected */
295
                for ($i = $movebtn+1; $i < count($a_out); $i++) {
296
                        if (!in_array($i, $_POST['rule']))
297
                                $a_out_new[] = $a_out[$i];
298
                }
299
                if (count($a_out_new) > 0)
300
			$a_out = $a_out_new;
301
		else
302
			unset($config['nat']['advancedoutbound']);
303

    
304
		if (write_config())
305
			mark_subsystem_dirty('natconf');
306
                header("Location: firewall_nat_out.php");
307
                exit;
308
        }
309
}
310

    
311

    
312
$pgtitle = array(gettext("Firewall"),gettext("NAT"),gettext("Outbound"));
313
include("head.inc");
314

    
315
?>
316
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
317
<?php include("fbegin.inc"); ?>
318
<form action="firewall_nat_out.php" method="post" name="iform">
319
<script type="text/javascript" language="javascript" src="/javascript/row_toggle.js"></script>
320
<?php if ($savemsg) print_info_box($savemsg); ?>
321
<?php if (is_subsystem_dirty('natconf')): ?>
322
<?php print_info_box_np(gettext("The NAT configuration has been changed.")."<br/>".gettext("You must apply the changes in order for them to take effect."));?><br/>
323
<?php endif; ?>
324
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="firwall nat outbound">  <tr><td>
325
<?php
326
	$tab_array = array();
327
	$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
328
	$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
329
	$tab_array[] = array(gettext("Outbound"), true, "firewall_nat_out.php");
330
	$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
331
	display_top_tabs($tab_array);
332
?>
333
  </td></tr>
334
  <tr>
335
    <td>
336
	<div id="mainarea">
337
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
338
				<tr><td align="right"><b><?=gettext("Mode:"); ?></b></td>
339
                  <td>
340
                      &nbsp;&nbsp;<input name="advancedoripsec" type="radio" id="ipsecpassthru" value="ipsecpassthru" <?php if (isset($config['nat']['ipsecpassthru']['enable'])) echo "checked=\"checked\"";?> />
341
                      <strong><?=gettext("Automatic outbound NAT rule generation"); ?><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?=gettext("(IPsec passthrough included)");?></strong>
342
                  </td>
343

    
344
                  <td>
345
                      &nbsp;&nbsp;<input name="advancedoripsec" type="radio" id="advancedoutbound" value="advancedoutboundnat" <?php if (isset($config['nat']['advancedoutbound']['enable'])) echo "checked=\"checked\"";?> />
346
                      <strong><?=gettext("Manual Outbound NAT rule generation") . "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . gettext("(AON - Advanced Outbound NAT)");?></strong></td>
347
                  <td valign="middle" align="left">
348
					<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
349
					&nbsp;<br/>&nbsp;
350
                  </td>
351
                </tr>
352
				<tr>
353
					<td colspan="5">
354
						&nbsp;
355
					</td>
356
				</tr>
357
				<tr>
358
					<td  class="vtable" colspan="5">
359
						&nbsp;
360
					</td>
361
				</tr>
362
              </table>
363
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="mappings">
364
				<tr><td colspan="5"><b>&nbsp;<?=gettext("Mappings:"); ?></b></td></tr>
365
				<tr><td>&nbsp;</td></tr>
366
                <tr id="frheader">
367
                  <td width="3%" class="list">&nbsp;</td>
368
                  <td width="3%" class="list">&nbsp;</td>
369
                  <td width="10%" class="listhdrr"><?=gettext("Interface");?></td>
370
                  <td width="15%" class="listhdrr"><?=gettext("Source");?></td>
371
                  <td width="10%" class="listhdrr"><?=gettext("Source Port");?></td>
372
                  <td width="15%" class="listhdrr"><?=gettext("Destination");?></td>
373
                  <td width="10%" class="listhdrr"><?=gettext("Destination Port");?></td>
374
                  <td width="15%" class="listhdrr"><?=gettext("NAT Address");?></td>
375
                  <td width="10%" class="listhdrr"><?=gettext("NAT Port");?></td>
376
		  <td width="10%" class="listhdrr"><?=gettext("Static Port");?></td>
377
                  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
378
                  <td width="5%" class="list">
379
                    <table border="0" cellspacing="0" cellpadding="1" summary="add">
380
                      <tr>
381
			<td width="17"></td>
382
                        <td><a href="firewall_nat_out_edit.php?after=-1"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>" alt="add" /></a></td>
383
                      </tr>
384
                    </table>
385
		  </td>
386
                </tr>
387
              <?php $nnats = $i = 0; foreach ($a_out as $natent): ?>
388
                <tr valign="top" id="fr<?=$nnats;?>">
389
                  <td class="listt"><input type="checkbox" id="frc<?=$nnats;?>" name="rule[]" value="<?=$i;?>" onclick="fr_bgcolor('<?=$nnats;?>')" style="margin: 0; padding: 0; width: 15px; height: 15px;" /></td>
390
				  <td class="listt" align="center">
391
					<?php
392
					$iconfn = "pass";
393
					if (isset($natent['disabled'])) {
394
						$textss = "<span class=\"gray\">";
395
						$textse = "</span>";
396
						$iconfn .= "_d";
397
					} else {
398
						$textss = $textse = "";
399
					}
400
					?>
401
					<a href="?act=toggle&amp;id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_<?=$iconfn;?>.gif" width="11" height="11" border="0" title="<?=gettext("click to toggle enabled/disabled status");?>" alt="icon" /></a>
402
				  </td>
403
                  <td class="listlr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
404
                    <?php echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])); ?>
405
                                        &nbsp;
406
                  </td>
407
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
408
                    <?=$natent['source']['network'];?>
409
                  </td>
410
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
411
                    <?php
412
			echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
413
                      if (!$natent['sourceport'])
414
                          echo "*";
415
                      else
416
                          echo $natent['sourceport'];
417
                    ?>
418
                  </td>
419
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
420
                    <?php
421
                      if (isset($natent['destination']['any']))
422
                          echo "*";
423
                      else {
424
                          if (isset($natent['destination']['not']))
425
                              echo "!&nbsp;";
426
                          echo $natent['destination']['address'];
427
                      }
428
                    ?>
429
                  </td>
430
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
431
                    <?php
432
			echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
433
                      if (!$natent['dstport'])
434
                          echo "*";
435
                      else
436
                          echo $natent['dstport'];
437
                    ?>
438
                  </td>
439
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
440
                    <?php
441
					if (isset($natent['nonat']))
442
						echo '<I>NO NAT</I>';
443
					elseif (!$natent['target'])
444
						echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
445
					elseif ($natent['target'] == "other-subnet")
446
						echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
447
					else
448
						echo $natent['target'];
449
                    ?>
450
                  </td>
451
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
452
                    <?php
453
                      if (!$natent['natport'])
454
                          echo "*";
455
                      else
456
                          echo $natent['natport'];
457
                    ?>
458
                  </td>
459
                  <td class="listr" onclick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';" align="center">
460
                    <?php
461
			if(isset($natent['staticnatport']))
462
			    echo gettext("YES");
463
			else
464
			    echo gettext("NO");
465
                    ?>		    
466
                  </td>
467
                  <td class="listbg" onclick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';">
468
                    <?=htmlspecialchars($natent['descr']);?>&nbsp;
469
                  </td>
470
                  <td class="list nowrap" valign="middle">
471
                    <table border="0" cellspacing="0" cellpadding="1" summary="move">
472
                      <tr>
473
                        <td><input onmouseover="fr_insline(<?=$nnats;?>, true)" onmouseout="fr_insline(<?=$nnats;?>, false)" name="move_<?=$i;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" title="<?=gettext("move selected rules before this rule");?>" type="image" style="height:17;width:17;border:0" /></td>
474
                        <td><a href="firewall_nat_out_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit mapping");?>" alt="edit" /></a></td>
475
                      </tr>
476
                      <tr>
477
			<td align="center" valign="middle"><a href="firewall_nat_out.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this rule?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete rule");?>" alt="delete" /></a></td>
478
                        <td><a href="firewall_nat_out_edit.php?dup=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add a new NAT based on this one");?>" width="17" height="17" border="0" alt="duplicate" /></a></td>
479
                      </tr>
480
                    </table>
481
              <?php $i++; $nnats++; endforeach; ?>
482
                <tr>
483
                  <td class="list" colspan="11"></td>
484
                  <td class="list nowrap" valign="middle">
485
                    <table border="0" cellspacing="0" cellpadding="1" summary="edit">
486
                      <tr>
487
                        <td><?php if ($nnats == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_left_d.gif" width="17" height="17" title="<?=gettext("move selected mappings to end");?>" border="0" alt="move" /><?php else: ?><input name="move_<?=$i;?>" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_left.gif" style="width:17;height:17;border:0" title="<?=gettext("move selected mappings to end");?>" /><?php endif; ?></td>
488
                        <td><a href="firewall_nat_out_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add new mapping");?>" alt="add" /></a></td>
489
                      </tr>
490
                      <tr>
491
                        <td><?php if ($nnats == 0): ?><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x_d.gif" width="17" height="17" title="<?=gettext("delete selected rules");?>" border="0" alt="delete" /><?php else: ?><input name="del" type="image" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" style="width:17;height:17" title="<?=gettext("delete selected mappings");?>" onclick="return confirm('<?=gettext("Do you really want to delete the selected mappings?");?>')" /><?php endif; ?></td>
492
                      </tr>
493
                    </table></td>
494
                </tr>
495
                <tr>
496
                  <td colspan="12">
497
			<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:"); ?><br/>
498
			</strong></span>
499
			<?=gettext("With automatic outbound NAT enabled, a mapping is automatically created " .
500
			"for each interface's subnet (except WAN-type connections) and the rules " .
501
			"on this page are ignored.<br/><br/> " .
502
			"If manual outbound NAT is enabled, outbound NAT rules will not be " .
503
			"automatically generated and only the mappings you specify on this page " .
504
			"will be used. <br/><br/> " .
505
			"If a target address other than a WAN-type interface's IP address is used, " .
506
			"then depending on the way the WAN connection is setup, a "); ?>
507
			<a href="firewall_virtual_ip.php"><?=gettext("Virtual IP"); ?></a>
508
			<?= gettext(" may also be required.") ?>
509
			<br/><br/>
510
			<?= gettext("To completely disable outbound NAT, switch to Manual Outbound NAT then delete any " .
511
			"NAT rules that appear in the list.") ?></span></p>
512
                    </td>
513
                </tr>
514

    
515
              </table>
516
	    </div>
517
</td>
518
  </tr>
519
</table>
520
            </form>
521
<?php include("fend.inc"); ?>
522
</body>
523
</html>
(67-67/246)