. * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ##|+PRIV ##|*IDENT=page-firewall-nat-1-1 ##|*NAME=Firewall: NAT: 1:1 ##|*DESCR=Allow access to the 'Firewall: NAT: 1:1' page. ##|*MATCH=firewall_nat_1to1.php* ##|-PRIV require_once("guiconfig.inc"); require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); if (!is_array($config['nat']['onetoone'])) { $config['nat']['onetoone'] = array(); } $a_1to1 = &$config['nat']['onetoone']; /* update rule order, POST[rule] is an array of ordered IDs */ if (array_key_exists('order-store', $_POST)) { if (is_array($_POST['rule']) && !empty($_POST['rule'])) { $a_1to1_new = array(); // if a rule is not in POST[rule], it has been deleted by the user foreach ($_POST['rule'] as $id) { $a_1to1_new[] = $a_1to1[$id]; } $a_1to1 = $a_1to1_new; if (write_config(gettext("Firewall: NAT: 1:1 - reordered NAT 1:1 mappings."))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_1to1.php"); exit; } } if ($_POST['apply']) { $retval = 0; $retval |= filter_configure(); if ($retval == 0) { clear_subsystem_dirty('natconf'); clear_subsystem_dirty('filter'); } } if ($_POST['act'] == "del") { if ($a_1to1[$_POST['id']]) { unset($a_1to1[$_POST['id']]); if (write_config(gettext("Firewall: NAT: 1:1 - deleted NAT 1:1 mapping."))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_1to1.php"); exit; } } if (isset($_POST['del_x'])) { /* delete selected rules */ if (is_array($_POST['rule']) && count($_POST['rule'])) { foreach ($_POST['rule'] as $rulei) { unset($a_1to1[$rulei]); } if (write_config(gettext("Firewall: NAT: 1:1 - deleted selected NAT 1:1 mappings."))) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_1to1.php"); exit; } } else if ($_POST['act'] == "toggle") { if ($a_1to1[$_POST['id']]) { if (isset($a_1to1[$_POST['id']]['disabled'])) { unset($a_1to1[$_POST['id']]['disabled']); $wc_msg = gettext('Firewall: NAT: 1:1 - enabled a NAT 1:1 rule.'); } else { $a_1to1[$_POST['id']]['disabled'] = true; $wc_msg = gettext('Firewall: NAT: 1:1 - disabled a NAT 1:1 rule.'); } if (write_config($wc_msg)) { mark_subsystem_dirty('natconf'); } header("Location: firewall_nat_1to1.php"); exit; } } $pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("1:1")); $pglinks = array("", "firewall_nat.php", "@self"); include("head.inc"); if ($_POST['apply']) { print_apply_result_box($retval); } if (is_subsystem_dirty('natconf')) { print_apply_box(gettext('The NAT configuration has been changed.') . '
' . gettext('The changes must be applied for them to take effect.')); } $tab_array = array(); $tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php"); $tab_array[] = array(gettext("1:1"), true, "firewall_nat_1to1.php"); $tab_array[] = array(gettext("Outbound"), false, "firewall_nat_out.php"); $tab_array[] = array(gettext("NPt"), false, "firewall_nat_npt.php"); display_top_tabs($tab_array); ?>

', '') . '
' . gettext('If a 1:1 NAT entry is added for any of the interface IPs on this system, ' . 'it will make this system inaccessible on that IP address. i.e. if ' . 'the WAN IP address is used, any services on this system (IPsec, OpenVPN server, etc.) ' . 'using the WAN IP address will no longer function.'), 'info', false); ?>