diff options
author | Ermal <eri@pfsense.org> | 2010-04-29 10:34:36 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-04-29 10:34:59 +0000 |
commit | 7d35ed789061a755127ac4b2dde533c30e4bdee1 (patch) | |
tree | f220848e31df8b87cdb66c0b0b34f6fd80dffd84 /usr/local/www/firewall_nat_out.php | |
parent | b696422827193d3f165e077f2b56e575022fd553 (diff) | |
download | pfsense-7d35ed789061a755127ac4b2dde533c30e4bdee1.zip pfsense-7d35ed789061a755127ac4b2dde533c30e4bdee1.tar.gz |
Create rules for openvpn/l2tp/pppoe/pptp when switching to manual outbound nat so the user can do less work.
Diffstat (limited to 'usr/local/www/firewall_nat_out.php')
-rwxr-xr-x | usr/local/www/firewall_nat_out.php | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index 90ffe43..07d696e 100755 --- a/usr/local/www/firewall_nat_out.php +++ b/usr/local/www/firewall_nat_out.php @@ -136,6 +136,77 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") { $a_out[] = $natent; } } + /* PPTP subnet */ + if($config['pptpd']['mode'] == "server") { + if (is_ipaddr($config['pptpd']['localip'])) { + if($config['pptpd']['pptp_subnet'] <> "") + $ossubnet = $config['pptpd']['pptp_subnet']; + else + $ossubnet = "32"; + $osn = gen_subnet($config['pptpd']['localip'], $osn); + $natent = array(); + $natent['source']['network'] = "{$osn}/{$ossubnet}"; + $natent['sourceport'] = ""; + $natent['descr'] = "Auto created rule for PPTP server"; + $natent['target'] = ""; + $natent['interface'] = "pptp"; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $a_out[] = $natent; + } + } + /* PPPoE subnet */ + if($config['pppoe']['mode'] == "server") { + if (is_ipaddr($config['pppoe']['localip'])) { + if($config['pppoe']['pppoe_subnet'] <> "") + $ossubnet = $config['pppoe']['pptp_subnet']; + else + $ossubnet = "32"; + $osn = gen_subnet($config['pppoe']['localip'], $osn); + $natent = array(); + $natent['source']['network'] = "{$osn}/{$ossubnet}"; + $natent['sourceport'] = ""; + $natent['descr'] = "Auto created rule for PPPoE server"; + $natent['target'] = ""; + $natent['interface'] = "pppoe"; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $a_out[] = $natent; + } + } + /* L2TP subnet */ + if($config['l2tp']['mode'] == "server") { + if (is_ipaddr($config['l2tp']['localip'])) { + if($config['l2tp']['l2tp_subnet'] <> "") + $ossubnet = $config['l2tp']['pptp_subnet']; + else + $ossubnet = "32"; + $osn = gen_subnet($config['l2tp']['localip'], $osn); + $natent = array(); + $natent['source']['network'] = "{$osn}/{$ossubnet}"; + $natent['sourceport'] = ""; + $natent['descr'] = "Auto created rule for L2TP server"; + $natent['target'] = ""; + $natent['interface'] = "l2tp"; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $a_out[] = $natent; + } + } + /* add openvpn interfaces */ + if($config['openvpn']['openvpn-server']) { + foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) { + $natent = array(); + $natent['source']['network'] = $ovpnsrv['tunnel_network']; + $natent['sourceport'] = ""; + $natent['descr'] = "Auto created rule for OpenVPN server"; + $natent['target'] = ""; + $natent['interface'] = "openvpn"; + $natent['destination']['any'] = true; + $natent['natport'] = ""; + $a_out[] = $natent; + } + } $savemsg = "Default rules for each interface have been created."; } break; |