Project

General

Profile

Download (6.87 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	firewall_nat_1to1.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_MODULE:	nat
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-firewall-nat-1-1
37
##|*NAME=Firewall: NAT: 1:1 page
38
##|*DESCR=Allow access to the 'Firewall: NAT: 1:1' page.
39
##|*MATCH=firewall_nat_1to1.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43
require_once("functions.inc");
44
require_once("filter.inc");
45
require_once("shaper.inc");
46

    
47
if (!is_array($config['nat']['onetoone'])) {
48
	$config['nat']['onetoone'] = array();
49
}
50
$a_1to1 = &$config['nat']['onetoone'];
51

    
52
if ($_POST) {
53

    
54
	$pconfig = $_POST;
55

    
56
	if ($_POST['apply']) {
57
		$retval = 0;
58
		$retval |= filter_configure();
59
		$savemsg = get_std_save_message($retval);
60

    
61
		if ($retval == 0) {
62
			clear_subsystem_dirty('natconf');
63
			clear_subsystem_dirty('filter');
64
		}
65
	}
66
}
67

    
68
if ($_GET['act'] == "del") {
69
	if ($a_1to1[$_GET['id']]) {
70
		unset($a_1to1[$_GET['id']]);
71
		write_config();
72
		mark_subsystem_dirty('natconf');
73
		header("Location: firewall_nat_1to1.php");
74
		exit;
75
	}
76
}
77

    
78
$pgtitle = array("Firewall","NAT","1:1");
79
include("head.inc");
80

    
81
?>
82
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
83
<?php include("fbegin.inc"); ?>
84
<form action="firewall_nat_1to1.php" method="post">
85
<?php if ($savemsg) print_info_box($savemsg); ?>
86
<?php if (is_subsystem_dirty('natconf')): ?><p>
87
<?php print_info_box_np("The NAT configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br>
88
<?php endif; ?>
89
<table width="100%" border="0" cellpadding="0" cellspacing="0">  <tr><td>
90
<?php
91
	$tab_array = array();
92
	$tab_array[] = array("Port Forward", false, "firewall_nat.php");
93
	$tab_array[] = array("1:1", true, "firewall_nat_1to1.php");
94
	$tab_array[] = array("Outbound", false, "firewall_nat_out.php");
95
	display_top_tabs($tab_array);
96
?>
97
  </td></tr>
98
  <tr>
99
    <td>
100
	<div id="mainarea">
101
              <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
102
                <tr>
103
		  <td width="10%" class="listhdrr">Interface</td>
104
                  <td width="20%" class="listhdrr">External IP</td>
105
                  <td width="20%" class="listhdrr">Internal IP</td>
106
                  <td width="40%" class="listhdr">Description</td>
107
                  <td width="10%" class="list">
108
                    <table border="0" cellspacing="0" cellpadding="1">
109
                      <tr>
110
			<td width="17"></td>
111
                        <td valign="middle"><a href="firewall_nat_1to1_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add rule"></a></td>
112
                      </tr>
113
                    </table>
114
		  </td>
115
				</tr>
116
			  <?php $i = 0; foreach ($a_1to1 as $natent): ?>
117
                <tr>
118
		  <td class="listlr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
119
                  <?php
120
					if (!$natent['interface'] || ($natent['interface'] == "wan"))
121
						echo "WAN";
122
					else
123
						echo htmlspecialchars($config['interfaces'][$natent['interface']]['descr']);
124
				  ?>
125
                  </td>
126
                  <td class="listr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
127
                    <?php echo $natent['external'];
128
					if ($natent['subnet']) echo "/" . $natent['subnet']; ?>
129
                  </td>
130
                  <td class="listr" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
131
                    <?php echo $natent['internal'];
132
					if ($natent['subnet']) echo "/" . $natent['subnet']; ?>
133
                  </td>
134
                  <td class="listbg" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
135
                    <?=htmlspecialchars($natent['descr']);?>&nbsp;
136
                  </td>
137
                  <td class="list" nowrap>
138
                    <table border="0" cellspacing="0" cellpadding="1">
139
                      <tr>
140
                        <td valign="middle"><a href="firewall_nat_1to1_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="edit rule"></a></td>
141
                        <td valign="middle"><a href="firewall_nat_1to1.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="delete rule"></a></td>
142
                      </tr>
143
                    </table>
144
                  </td>
145
                </tr>
146
		<?php $i++; endforeach; ?>
147
                <tr>
148
                  <td class="list" colspan="4"></td>
149
                  <td class="list">
150
                    <table border="0" cellspacing="0" cellpadding="1">
151
                      <tr>
152
			<td width="17"></td>
153
                        <td valign="middle"><a href="firewall_nat_1to1_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="add rule"></a></td>
154
                      </tr>
155
                    </table>
156
                  </td>
157
                </tr>
158
		<tr>
159
		  <td colspan="4">
160
		        <p><span class="vexpl"><span class="red"><strong>Note:<br>
161
                      </strong></span>Depending on the way your WAN connection is setup, you may also need a <a href="firewall_virtual_ip.php">Virtual IP</a>.<br/>
162
			If you add a 1:1 NAT entry for any of the interface IPs on this system, it will make this system inaccessible on that IP address. i.e. if
163
			you use your WAN IP address, any services on this system (IPsec, OpenVPN server, etc.) using the WAN IP address will no longer function.</span></p>
164
		  </td>
165
		<tr>
166
              </table>
167
	    </div>
168
	</td>
169
</tr>
170
</table>
171
</form>
172
<?php include("fend.inc"); ?>
173
</body>
174
</html>
(51-51/221)