1 |
340e6dca
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
|
|
firewall_nat.php
|
4 |
|
|
*/
|
5 |
fd9ebcd5
|
Stephen Beaver
|
/* ====================================================================
|
6 |
7c540a5c
|
Stephen Beaver
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
9da2cf1c
|
Stephen Beaver
|
*
|
8 |
cb41dd63
|
Renato Botelho
|
* Some or all of this file is based on the m0n0wall project which is
|
9 |
|
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10 |
fd9ebcd5
|
Stephen Beaver
|
*
|
11 |
7c540a5c
|
Stephen Beaver
|
* Redistribution and use in source and binary forms, with or without modification,
|
12 |
|
|
* are permitted provided that the following conditions are met:
|
13 |
fd9ebcd5
|
Stephen Beaver
|
*
|
14 |
7c540a5c
|
Stephen Beaver
|
* 1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
* this list of conditions and the following disclaimer.
|
16 |
fd9ebcd5
|
Stephen Beaver
|
*
|
17 |
7c540a5c
|
Stephen Beaver
|
* 2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
* notice, this list of conditions and the following disclaimer in
|
19 |
|
|
* the documentation and/or other materials provided with the
|
20 |
|
|
* distribution.
|
21 |
fd9ebcd5
|
Stephen Beaver
|
*
|
22 |
7c540a5c
|
Stephen Beaver
|
* 3. All advertising materials mentioning features or use of this software
|
23 |
|
|
* must display the following acknowledgment:
|
24 |
|
|
* "This product includes software developed by the pfSense Project
|
25 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
26 |
fd9ebcd5
|
Stephen Beaver
|
*
|
27 |
7c540a5c
|
Stephen Beaver
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
28 |
|
|
* endorse or promote products derived from this software without
|
29 |
|
|
* prior written permission. For written permission, please contact
|
30 |
|
|
* coreteam@pfsense.org.
|
31 |
fd9ebcd5
|
Stephen Beaver
|
*
|
32 |
7c540a5c
|
Stephen Beaver
|
* 5. Products derived from this software may not be called "pfSense"
|
33 |
|
|
* nor may "pfSense" appear in their names without prior written
|
34 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
35 |
fd9ebcd5
|
Stephen Beaver
|
*
|
36 |
7c540a5c
|
Stephen Beaver
|
* 6. Redistributions of any form whatsoever must retain the following
|
37 |
|
|
* acknowledgment:
|
38 |
fd9ebcd5
|
Stephen Beaver
|
*
|
39 |
7c540a5c
|
Stephen Beaver
|
* "This product includes software developed by the pfSense Project
|
40 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
41 |
919d91f9
|
Phil Davis
|
*
|
42 |
7c540a5c
|
Stephen Beaver
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
43 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
45 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
46 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
47 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
48 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
49 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
51 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
52 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
53 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
54 |
fd9ebcd5
|
Stephen Beaver
|
*
|
55 |
7c540a5c
|
Stephen Beaver
|
* ====================================================================
|
56 |
fd9ebcd5
|
Stephen Beaver
|
*
|
57 |
|
|
*/
|
58 |
7ac5a4cb
|
Scott Ullrich
|
/*
|
59 |
0e6ac11d
|
Stephen Beaver
|
pfSense_MODULE: nat
|
60 |
7ac5a4cb
|
Scott Ullrich
|
*/
|
61 |
5b237745
|
Scott Ullrich
|
|
62 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
63 |
|
|
##|*IDENT=page-firewall-nat-portforward
|
64 |
|
|
##|*NAME=Firewall: NAT: Port Forward page
|
65 |
|
|
##|*DESCR=Allow access to the 'Firewall: NAT: Port Forward' page.
|
66 |
|
|
##|*MATCH=firewall_nat.php*
|
67 |
|
|
##|-PRIV
|
68 |
|
|
|
69 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
70 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
71 |
|
|
require_once("filter.inc");
|
72 |
|
|
require_once("shaper.inc");
|
73 |
483e6de8
|
Scott Ullrich
|
require_once("itemid.inc");
|
74 |
5b237745
|
Scott Ullrich
|
|
75 |
37ba954d
|
Phil Davis
|
if (!is_array($config['nat']['rule'])) {
|
76 |
5b237745
|
Scott Ullrich
|
$config['nat']['rule'] = array();
|
77 |
37ba954d
|
Phil Davis
|
}
|
78 |
fbe94068
|
Scott Ullrich
|
|
79 |
5b237745
|
Scott Ullrich
|
$a_nat = &$config['nat']['rule'];
|
80 |
|
|
|
81 |
8bbab8a3
|
Stephen Beaver
|
/* update rule order, POST[rule] is an array of ordered IDs */
|
82 |
6cb366de
|
Stephen Beaver
|
if($_POST['order-store']) {
|
83 |
|
|
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
|
84 |
|
|
$a_nat_new = array();
|
85 |
8bbab8a3
|
Stephen Beaver
|
|
86 |
6cb366de
|
Stephen Beaver
|
// if a rule is not in POST[rule], it has been deleted by the user
|
87 |
|
|
foreach ($_POST['rule'] as $id)
|
88 |
|
|
$a_nat_new[] = $a_nat[$id];
|
89 |
8bbab8a3
|
Stephen Beaver
|
|
90 |
6cb366de
|
Stephen Beaver
|
$a_nat = $a_nat_new;
|
91 |
dbbd22f9
|
Stephen Beaver
|
|
92 |
6cb366de
|
Stephen Beaver
|
if (write_config())
|
93 |
|
|
mark_subsystem_dirty('filter');
|
94 |
dbbd22f9
|
Stephen Beaver
|
|
95 |
6cb366de
|
Stephen Beaver
|
header("Location: firewall_nat.php");
|
96 |
|
|
exit;
|
97 |
|
|
}
|
98 |
8bbab8a3
|
Stephen Beaver
|
}
|
99 |
|
|
|
100 |
514dbaf8
|
Scott Ullrich
|
/* if a custom message has been passed along, lets process it */
|
101 |
37ba954d
|
Phil Davis
|
if ($_GET['savemsg']) {
|
102 |
514dbaf8
|
Scott Ullrich
|
$savemsg = $_GET['savemsg'];
|
103 |
37ba954d
|
Phil Davis
|
}
|
104 |
514dbaf8
|
Scott Ullrich
|
|
105 |
5b237745
|
Scott Ullrich
|
if ($_POST) {
|
106 |
|
|
$pconfig = $_POST;
|
107 |
|
|
|
108 |
|
|
if ($_POST['apply']) {
|
109 |
e8c2c890
|
Bill Marquette
|
|
110 |
5b237745
|
Scott Ullrich
|
$retval = 0;
|
111 |
7a6c350f
|
Scott Ullrich
|
|
112 |
e2c9ef13
|
Scott Ullrich
|
$retval |= filter_configure();
|
113 |
05da8941
|
Erik Fonnesbeck
|
$savemsg = get_std_save_message($retval);
|
114 |
7d04082e
|
Scott Ullrich
|
|
115 |
1a700ea6
|
Scott Ullrich
|
pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/apply");
|
116 |
|
|
|
117 |
5b237745
|
Scott Ullrich
|
if ($retval == 0) {
|
118 |
a368a026
|
Ermal Lu?i
|
clear_subsystem_dirty('natconf');
|
119 |
|
|
clear_subsystem_dirty('filter');
|
120 |
5b237745
|
Scott Ullrich
|
}
|
121 |
7d04082e
|
Scott Ullrich
|
|
122 |
5b237745
|
Scott Ullrich
|
}
|
123 |
|
|
}
|
124 |
|
|
|
125 |
759d0de1
|
Renato Botelho
|
if ($_GET['act'] == "del") {
|
126 |
|
|
if ($a_nat[$_GET['id']]) {
|
127 |
3a343d73
|
jim-p
|
|
128 |
759d0de1
|
Renato Botelho
|
if (isset($a_nat[$_GET['id']]['associated-rule-id'])) {
|
129 |
|
|
delete_id($a_nat[$_GET['id']]['associated-rule-id'], $config['filter']['rule']);
|
130 |
3a343d73
|
jim-p
|
$want_dirty_filter = true;
|
131 |
759d0de1
|
Renato Botelho
|
}
|
132 |
|
|
unset($a_nat[$_GET['id']]);
|
133 |
3a343d73
|
jim-p
|
|
134 |
|
|
if (write_config()) {
|
135 |
|
|
mark_subsystem_dirty('natconf');
|
136 |
37ba954d
|
Phil Davis
|
if ($want_dirty_filter) {
|
137 |
3a343d73
|
jim-p
|
mark_subsystem_dirty('filter');
|
138 |
37ba954d
|
Phil Davis
|
}
|
139 |
3a343d73
|
jim-p
|
}
|
140 |
0e6ac11d
|
Stephen Beaver
|
|
141 |
759d0de1
|
Renato Botelho
|
header("Location: firewall_nat.php");
|
142 |
|
|
exit;
|
143 |
|
|
}
|
144 |
|
|
}
|
145 |
|
|
|
146 |
00bcbdd0
|
Bill Marquette
|
if (isset($_POST['del_x'])) {
|
147 |
0e6ac11d
|
Stephen Beaver
|
/* delete selected rules */
|
148 |
|
|
if (is_array($_POST['rule']) && count($_POST['rule'])) {
|
149 |
|
|
foreach ($_POST['rule'] as $rulei) {
|
150 |
049a688e
|
Ermal Lu?i
|
$target = $rule['target'];
|
151 |
b9e28d57
|
unknown
|
// Check for filter rule associations
|
152 |
6c07db48
|
Phil Davis
|
if (isset($a_nat[$rulei]['associated-rule-id'])) {
|
153 |
9b16b834
|
Ermal Lu?i
|
delete_id($a_nat[$rulei]['associated-rule-id'], $config['filter']['rule']);
|
154 |
7d5b007c
|
Sjon Hortensius
|
|
155 |
b9e28d57
|
unknown
|
mark_subsystem_dirty('filter');
|
156 |
|
|
}
|
157 |
6cb366de
|
Stephen Beaver
|
|
158 |
0e6ac11d
|
Stephen Beaver
|
unset($a_nat[$rulei]);
|
159 |
|
|
}
|
160 |
6cb366de
|
Stephen Beaver
|
|
161 |
37ba954d
|
Phil Davis
|
if (write_config()) {
|
162 |
3a343d73
|
jim-p
|
mark_subsystem_dirty('natconf');
|
163 |
37ba954d
|
Phil Davis
|
}
|
164 |
6cb366de
|
Stephen Beaver
|
|
165 |
3a343d73
|
jim-p
|
header("Location: firewall_nat.php");
|
166 |
|
|
exit;
|
167 |
4b9a670c
|
Scott Ullrich
|
}
|
168 |
0e6ac11d
|
Stephen Beaver
|
}
|
169 |
|
|
|
170 |
d16a49ae
|
Colin Fleming
|
$closehead = false;
|
171 |
6c07db48
|
Phil Davis
|
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward"));
|
172 |
6eb17647
|
Scott Ullrich
|
include("head.inc");
|
173 |
|
|
|
174 |
0e6ac11d
|
Stephen Beaver
|
if ($savemsg)
|
175 |
|
|
print_info_box($savemsg, 'success');
|
176 |
|
|
|
177 |
|
|
if (is_subsystem_dirty('natconf'))
|
178 |
|
|
print_info_box_np(gettext('The NAT configuration has been changed.') . '<br />' .
|
179 |
|
|
gettext('You must apply the changes in order for them to take effect.') . '<br />');
|
180 |
2a9db752
|
Scott Dale
|
|
181 |
0e6ac11d
|
Stephen Beaver
|
$tab_array = array();
|
182 |
|
|
$tab_array[] = array(gettext("Port Forward"), true, "firewall_nat.php");
|
183 |
|
|
$tab_array[] = array(gettext("1:1"), false, "firewall_nat_1to1.php");
|
184 |
|
|
$tab_array[] = array(gettext("Outbound"), false, "firewall_nat_out.php");
|
185 |
|
|
$tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php");
|
186 |
|
|
display_top_tabs($tab_array);
|
187 |
24f600b0
|
Scott Ullrich
|
?>
|
188 |
d16a49ae
|
Colin Fleming
|
|
189 |
00bcbdd0
|
Bill Marquette
|
<form action="firewall_nat.php" method="post" name="iform">
|
190 |
8bbab8a3
|
Stephen Beaver
|
<div class="panel panel-default">
|
191 |
|
|
<div class="panel-heading"><?=gettext('Rules')?></div>
|
192 |
|
|
<div class="panel-body table-responsive">
|
193 |
|
|
<table class="table table-striped table-hover table-condensed">
|
194 |
|
|
<thead>
|
195 |
|
|
<tr>
|
196 |
7c540a5c
|
Stephen Beaver
|
<th><!-- Checkbox --></th>
|
197 |
8bbab8a3
|
Stephen Beaver
|
<th><!-- Rule type --></th>
|
198 |
|
|
<th><?=gettext("If")?></th>
|
199 |
|
|
<th><?=gettext("Proto")?></th>
|
200 |
|
|
<th><?=gettext("Src. addr")?></th>
|
201 |
|
|
<th><?=gettext("Src. ports")?></th>
|
202 |
|
|
<th><?=gettext("Dest. addr")?></th>
|
203 |
|
|
<th><?=gettext("Dest. ports")?></th>
|
204 |
|
|
<th><?=gettext("NAT IP")?></th>
|
205 |
|
|
<th><?=gettext("NAT Ports")?></th>
|
206 |
|
|
<th><?=gettext("Description")?></th>
|
207 |
|
|
<th><?=gettext("Actions")?></th>
|
208 |
|
|
</tr>
|
209 |
|
|
</thead>
|
210 |
|
|
<tbody class='user-entries'>
|
211 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
212 |
dbbd22f9
|
Stephen Beaver
|
|
213 |
0e6ac11d
|
Stephen Beaver
|
$nnats = $i = 0;
|
214 |
|
|
|
215 |
|
|
foreach ($a_nat as $natent):
|
216 |
|
|
|
217 |
dbbd22f9
|
Stephen Beaver
|
$alias = rule_columns_with_alias(
|
218 |
|
|
$natent['source']['address'],
|
219 |
|
|
pprint_port($natent['source']['port']),
|
220 |
|
|
$natent['destination']['address'],
|
221 |
|
|
pprint_port($natent['destination']['port'])
|
222 |
|
|
);
|
223 |
0e6ac11d
|
Stephen Beaver
|
|
224 |
dbbd22f9
|
Stephen Beaver
|
/* if user does not have access to edit an interface skip on to the next record */
|
225 |
e6f34d22
|
Phil Davis
|
if (!have_natpfruleint_access($natent['interface']))
|
226 |
dbbd22f9
|
Stephen Beaver
|
continue;
|
227 |
0e6ac11d
|
Stephen Beaver
|
?>
|
228 |
7c540a5c
|
Stephen Beaver
|
|
229 |
|
|
<tr id="fr<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';">
|
230 |
|
|
<td >
|
231 |
|
|
<input type="checkbox" id="frc<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" name="rule[]" value="<?=$i;?>"/>
|
232 |
|
|
</td>
|
233 |
8bbab8a3
|
Stephen Beaver
|
<td>
|
234 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
235 |
e6f34d22
|
Phil Davis
|
if ($natent['associated-rule-id'] == "pass"):
|
236 |
0e6ac11d
|
Stephen Beaver
|
?>
|
237 |
7abddc12
|
Stephen Beaver
|
<i class="icon-play" title="<?=gettext("All traffic matching this NAT entry is passed")?>"></i>
|
238 |
a8726a3d
|
Scott Ullrich
|
<?php
|
239 |
dbbd22f9
|
Stephen Beaver
|
elseif (!empty($natent['associated-rule-id'])):
|
240 |
a8726a3d
|
Scott Ullrich
|
?>
|
241 |
7abddc12
|
Stephen Beaver
|
<i class="icon-random" title="<?=gettext("Firewall rule ID ")?><?=htmlspecialchars($nnatid)?> . <?=gettext('is managed by this rule')?>"></i>
|
242 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
243 |
dbbd22f9
|
Stephen Beaver
|
endif;
|
244 |
0e6ac11d
|
Stephen Beaver
|
?>
|
245 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
246 |
91d452c7
|
Stephen Beaver
|
<td>
|
247 |
8bbab8a3
|
Stephen Beaver
|
<?=$textss?>
|
248 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
249 |
dbbd22f9
|
Stephen Beaver
|
if (!$natent['interface'])
|
250 |
|
|
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan"));
|
251 |
|
|
else
|
252 |
|
|
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']));
|
253 |
0e6ac11d
|
Stephen Beaver
|
?>
|
254 |
8bbab8a3
|
Stephen Beaver
|
<?=$textse?>
|
255 |
|
|
</td>
|
256 |
dbbd22f9
|
Stephen Beaver
|
|
257 |
91d452c7
|
Stephen Beaver
|
<td>
|
258 |
8bbab8a3
|
Stephen Beaver
|
<?=$textss?><?=strtoupper($natent['protocol'])?><?=$textse?>
|
259 |
|
|
</td>
|
260 |
dbbd22f9
|
Stephen Beaver
|
|
261 |
91d452c7
|
Stephen Beaver
|
<td>
|
262 |
dbbd22f9
|
Stephen Beaver
|
|
263 |
|
|
|
264 |
|
|
<?php
|
265 |
|
|
if (isset($alias['src'])):
|
266 |
|
|
?>
|
267 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['src']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['src'])?>" data-html="true">
|
268 |
|
|
<?php
|
269 |
|
|
endif;
|
270 |
|
|
?>
|
271 |
|
|
<?=htmlspecialchars(pprint_address($natent['source']))?>
|
272 |
|
|
<?php
|
273 |
|
|
if (isset($alias['src'])):
|
274 |
|
|
?>
|
275 |
|
|
<i class='icon icon-pencil'></i></a>
|
276 |
|
|
<?php
|
277 |
|
|
endif;
|
278 |
|
|
?>
|
279 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
280 |
91d452c7
|
Stephen Beaver
|
<td>
|
281 |
dbbd22f9
|
Stephen Beaver
|
<?php
|
282 |
|
|
if (isset($alias['srcport'])):
|
283 |
|
|
?>
|
284 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['srcport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['srcport'])?>" data-html="true">
|
285 |
|
|
<?php
|
286 |
|
|
endif;
|
287 |
|
|
?>
|
288 |
|
|
<?=htmlspecialchars(pprint_port($natent['source']['port']))?>
|
289 |
|
|
<?php
|
290 |
|
|
if (isset($alias['srcport'])):
|
291 |
|
|
?>
|
292 |
|
|
<i class='icon icon-pencil'></i></a>
|
293 |
|
|
<?php
|
294 |
|
|
endif;
|
295 |
|
|
?>
|
296 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
297 |
dbbd22f9
|
Stephen Beaver
|
|
298 |
91d452c7
|
Stephen Beaver
|
<td>
|
299 |
dbbd22f9
|
Stephen Beaver
|
<?php
|
300 |
|
|
if (isset($alias['dst'])):
|
301 |
|
|
?>
|
302 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['dst']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['dst'])?>" data-html="true">
|
303 |
|
|
<?php
|
304 |
|
|
endif;
|
305 |
|
|
?>
|
306 |
|
|
<?=htmlspecialchars(pprint_address($natent['destination']))?>
|
307 |
|
|
<?php
|
308 |
|
|
if (isset($alias['dst'])):
|
309 |
|
|
?>
|
310 |
|
|
<i class='icon icon-pencil'></i></a>
|
311 |
|
|
<?php
|
312 |
|
|
endif;
|
313 |
|
|
?>
|
314 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
315 |
91d452c7
|
Stephen Beaver
|
<td>
|
316 |
dbbd22f9
|
Stephen Beaver
|
<?php
|
317 |
|
|
if (isset($alias['dstport'])):
|
318 |
|
|
?>
|
319 |
|
|
<a href="/firewall_aliases_edit.php?id=<?=$alias['dstport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['dstport'])?>" data-html="true">
|
320 |
|
|
<?php
|
321 |
|
|
endif;
|
322 |
|
|
?>
|
323 |
|
|
<?=htmlspecialchars(pprint_port($natent['destination']['port']))?>
|
324 |
|
|
<?php
|
325 |
|
|
if (isset($alias['dstport'])):
|
326 |
|
|
?>
|
327 |
|
|
<i class='icon icon-pencil'></i></a>
|
328 |
|
|
<?php
|
329 |
|
|
endif;
|
330 |
|
|
?>
|
331 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
332 |
dbbd22f9
|
Stephen Beaver
|
|
333 |
91d452c7
|
Stephen Beaver
|
<td >
|
334 |
dbbd22f9
|
Stephen Beaver
|
<?=htmlspecialchars($natent['target'])?>
|
335 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
336 |
91d452c7
|
Stephen Beaver
|
<td>
|
337 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
338 |
dbbd22f9
|
Stephen Beaver
|
$localport = $natent['local-port'];
|
339 |
0e6ac11d
|
Stephen Beaver
|
|
340 |
dbbd22f9
|
Stephen Beaver
|
list($dstbeginport, $dstendport) = explode("-", $natent['destination']['port']);
|
341 |
0e6ac11d
|
Stephen Beaver
|
|
342 |
dbbd22f9
|
Stephen Beaver
|
if ($dstendport) {
|
343 |
|
|
$localendport = $natent['local-port'] + $dstendport - $dstbeginport;
|
344 |
|
|
$localport .= '-' . $localendport;
|
345 |
|
|
}
|
346 |
0e6ac11d
|
Stephen Beaver
|
?>
|
347 |
dbbd22f9
|
Stephen Beaver
|
<?=htmlspecialchars(pprint_port($localport))?>
|
348 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
349 |
dbbd22f9
|
Stephen Beaver
|
|
350 |
91d452c7
|
Stephen Beaver
|
<td>
|
351 |
dbbd22f9
|
Stephen Beaver
|
<?=htmlspecialchars($natent['descr'])?>
|
352 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
353 |
91d452c7
|
Stephen Beaver
|
<td>
|
354 |
65a0e193
|
Stephen Beaver
|
<a class="fa fa-pencil" title="<?=gettext("Edit rule"); ?>" href="firewall_nat_edit.php?id=<?=$i?>"></a>
|
355 |
|
|
<a class="fa fa-clone" title="<?=gettext("Add a new NAT based on this one")?>" href="firewall_nat_edit.php?dup=<?=$i?>"></a>
|
356 |
|
|
<a class="fa fa-trash" title="<?=gettext("Delete rule")?>" href="firewall_nat.php?act=del&id=<?=$i?>" onclick="return confirm('<?=gettext("Are you sure you want to delete this rule?")?>')"></a>
|
357 |
8bbab8a3
|
Stephen Beaver
|
</td>
|
358 |
|
|
</tr>
|
359 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
360 |
|
|
$i++;
|
361 |
|
|
$nnats++;
|
362 |
|
|
endforeach;
|
363 |
|
|
?>
|
364 |
8bbab8a3
|
Stephen Beaver
|
</tbody>
|
365 |
|
|
</table>
|
366 |
|
|
</div>
|
367 |
4cf530c4
|
Stephen Beaver
|
</div>
|
368 |
dbbd22f9
|
Stephen Beaver
|
|
369 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
370 |
0149ef4d
|
Stephen Beaver
|
<a href="firewall_nat_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add new rule')?>">
|
371 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
372 |
0149ef4d
|
Stephen Beaver
|
<?=gettext('Add')?>
|
373 |
|
|
</a>
|
374 |
|
|
<button name="del_x" type="submit" class="btn btn-danger btn-sm">
|
375 |
9d5a20cf
|
heper
|
<i class="fa fa-trash icon-embed-btn"></i>
|
376 |
0149ef4d
|
Stephen Beaver
|
<?=gettext("Delete"); ?>
|
377 |
|
|
</button>
|
378 |
|
|
<button type="submit" id="order-store" name="order-store" class="btn btn-primary btn-sm" disabled="disabled">
|
379 |
9d5a20cf
|
heper
|
<i class="fa fa-save icon-embed-btn"></i>
|
380 |
0149ef4d
|
Stephen Beaver
|
<?=gettext("Save")?>
|
381 |
|
|
</button>
|
382 |
09415b9e
|
Stephen Beaver
|
</nav>
|
383 |
0e6ac11d
|
Stephen Beaver
|
</form>
|
384 |
3d335c4d
|
Scott Ullrich
|
|
385 |
7c540a5c
|
Stephen Beaver
|
<script>
|
386 |
65a0e193
|
Stephen Beaver
|
events.push(function() {
|
387 |
7c540a5c
|
Stephen Beaver
|
|
388 |
65a0e193
|
Stephen Beaver
|
stripe_table();
|
389 |
7c540a5c
|
Stephen Beaver
|
|
390 |
65a0e193
|
Stephen Beaver
|
// Make rules sortable
|
391 |
4cf530c4
|
Stephen Beaver
|
$('table tbody.user-entries').sortable({
|
392 |
|
|
cursor: 'grabbing',
|
393 |
|
|
update: function(event, ui) {
|
394 |
|
|
$('#order-store').removeAttr('disabled');
|
395 |
65a0e193
|
Stephen Beaver
|
stripe_table();
|
396 |
4cf530c4
|
Stephen Beaver
|
}
|
397 |
|
|
});
|
398 |
6cb366de
|
Stephen Beaver
|
|
399 |
|
|
// Check all of the rule checkboxes so that their values are posted
|
400 |
|
|
$('#order-store').click(function () {
|
401 |
|
|
$('[id^=frc]').prop('checked', true);
|
402 |
|
|
});
|
403 |
4cf530c4
|
Stephen Beaver
|
});
|
404 |
|
|
</script>
|
405 |
3d335c4d
|
Scott Ullrich
|
<?php
|
406 |
0e6ac11d
|
Stephen Beaver
|
|
407 |
e6f34d22
|
Phil Davis
|
if (count($a_nat) > 0) {
|
408 |
3d335c4d
|
Scott Ullrich
|
?>
|
409 |
0e6ac11d
|
Stephen Beaver
|
<!-- Legend -->
|
410 |
|
|
<div>
|
411 |
|
|
<dl class="dl-horizontal responsive">
|
412 |
|
|
<dt><?=gettext('Legend')?></dt> <dd></dd>
|
413 |
|
|
<dt><i class="icon icon-play"></i></dt> <dd><?=gettext('Pass')?></dd>
|
414 |
|
|
<dt><i class="icon icon-random"></i></dt> <dd><?=gettext('Linked rule')?></dd>
|
415 |
|
|
</dl>
|
416 |
|
|
</div>
|
417 |
3d335c4d
|
Scott Ullrich
|
|
418 |
0e6ac11d
|
Stephen Beaver
|
<?php
|
419 |
|
|
}
|
420 |
|
|
|
421 |
c10cb196
|
Stephen Beaver
|
include("foot.inc");
|