2898 |
2898 |
foreach ($config['ipsec']['tunnel'] as $tunnel) {
|
2899 |
2899 |
if(isset($tunnel['disabled']))
|
2900 |
2900 |
continue;
|
2901 |
|
update_filter_reload_status("Creating IPSEC tunnel items {$tunnel['descr']}...");
|
|
2901 |
update_filter_reload_status("Creating IPsec tunnel items {$tunnel['descr']}...");
|
2902 |
2902 |
/* if tunnel is disabled, lets skip to next item */
|
2903 |
2903 |
$ipsec_ips = array(get_current_wan_address($tunnel['interface']));
|
2904 |
2904 |
/* is this a dynamic dns hostname? */
|
... | ... | |
2921 |
2921 |
continue;
|
2922 |
2922 |
if(!$remote_gateway)
|
2923 |
2923 |
continue;
|
2924 |
|
$ipfrules .= "pass out quick on \${$iface} proto udp from any to {$remote_gateway} port = 500 keep state label \"IPSEC: {$tunnel['descr']} - outbound isakmp\"\n";
|
2925 |
|
$ipfrules .= "pass in quick on \${$iface} proto udp from {$remote_gateway} to any port = 500 keep state label \"IPSEC: {$tunnel['descr']} - inbound isakmp\"\n";
|
|
2924 |
$ipfrules .= "pass out quick on \${$iface} proto udp from any to {$remote_gateway} port = 500 keep state label \"IPsec: {$tunnel['descr']} - outbound isakmp\"\n";
|
|
2925 |
$ipfrules .= "pass in quick on \${$iface} proto udp from {$remote_gateway} to any port = 500 keep state label \"IPsec: {$tunnel['descr']} - inbound isakmp\"\n";
|
2926 |
2926 |
if ($tunnel['p2']['protocol'] == 'esp') {
|
2927 |
|
$ipfrules .= "pass out quick on \${$iface} proto esp from any to {$remote_gateway} keep state label \"IPSEC: {$tunnel['descr']} - outbound esp proto\"\n";
|
2928 |
|
$ipfrules .= "pass in quick on \${$iface} proto esp from {$remote_gateway} to any keep state label \"IPSEC: {$tunnel['descr']} - inbound esp proto\"\n";
|
|
2927 |
$ipfrules .= "pass out quick on \${$iface} proto esp from any to {$remote_gateway} keep state label \"IPsec: {$tunnel['descr']} - outbound esp proto\"\n";
|
|
2928 |
$ipfrules .= "pass in quick on \${$iface} proto esp from {$remote_gateway} to any keep state label \"IPsec: {$tunnel['descr']} - inbound esp proto\"\n";
|
2929 |
2929 |
}
|
2930 |
2930 |
if ($tunnel['p2']['protocol'] == 'ah') {
|
2931 |
|
$ipfrules .= "pass out quick on \${$iface} proto ah from any to {$remote_gateway} keep state label \"IPSEC: {$tunnel['descr']} - outbound ah proto\"\n";
|
2932 |
|
$ipfrules .= "pass in quick on \${$iface} proto ah from {$remote_gateway} to any keep state label \"IPSEC: {$tunnel['descr']} - inbound ah proto\"\n";
|
|
2931 |
$ipfrules .= "pass out quick on \${$iface} proto ah from any to {$remote_gateway} keep state label \"IPsec: {$tunnel['descr']} - outbound ah proto\"\n";
|
|
2932 |
$ipfrules .= "pass in quick on \${$iface} proto ah from {$remote_gateway} to any keep state label \"IPsec: {$tunnel['descr']} - inbound ah proto\"\n";
|
2933 |
2933 |
}
|
2934 |
2934 |
}
|
2935 |
2935 |
}
|
... | ... | |
2942 |
2942 |
$ipseccfg = $config['ipsec'];
|
2943 |
2943 |
if (isset($ipseccfg['mobileclients']['enable'])) {
|
2944 |
2944 |
foreach($ifdescrs as $iface) {
|
2945 |
|
$ipfrules .= "pass in quick on \${$iface} proto udp from any to any port = 500 keep state label \"IPSEC: Mobile - inbound isakmp\"\n";
|
2946 |
|
$ipfrules .= "pass in quick on \${$iface} proto esp from any to any keep state label \"IPSEC: Mobile - inbound esp proto\"\n";
|
2947 |
|
$ipfrules .= "pass in quick on \${$iface} proto ah from any to any keep state label \"IPSEC: Mobile - inbound ah proto\"\n";
|
|
2945 |
$ipfrules .= "pass in quick on \${$iface} proto udp from any to any port = 500 keep state label \"IPsec: Mobile - inbound isakmp\"\n";
|
|
2946 |
$ipfrules .= "pass in quick on \${$iface} proto esp from any to any keep state label \"IPsec: Mobile - inbound esp proto\"\n";
|
|
2947 |
$ipfrules .= "pass in quick on \${$iface} proto ah from any to any keep state label \"IPsec: Mobile - inbound ah proto\"\n";
|
2948 |
2948 |
}
|
2949 |
2949 |
}
|
2950 |
2950 |
}
|
... | ... | |
3067 |
3067 |
$ints = array();
|
3068 |
3068 |
$int = filter_translate_type_to_real_interface($ifname);
|
3069 |
3069 |
/* if the interface is pppoe, set the ng0 interface */
|
3070 |
|
update_filter_reload_status("Creating IPSEC tunnel items {$tunnel['descr']}...");
|
|
3070 |
update_filter_reload_status("Creating IPsec tunnel items {$tunnel['descr']}...");
|
3071 |
3071 |
$ip = find_interface_ip($int);
|
3072 |
3072 |
if ($config['interfaces'][$ifname]['ipaddr'] == "pppoe")
|
3073 |
3073 |
$int = " { " . filter_translate_type_to_real_interface($ifname) . " ng0 } ";
|
... | ... | |
3154 |
3154 |
}
|
3155 |
3155 |
|
3156 |
3156 |
/* permit internal ipsec outbound traffic */
|
3157 |
|
$rule .="pass out quick on \$enc0 keep state label \"IPSEC internal host to host\"";
|
|
3157 |
$rule .="pass out quick on \$enc0 keep state label \"IPsec internal host to host\"";
|
3158 |
3158 |
|
3159 |
3159 |
return $rule;
|
3160 |
3160 |
}
|
touch up text
Ticket #1569