diff options
author | Ermal LUÇI <eri@pfsense.org> | 2015-01-07 21:02:09 +0100 |
---|---|---|
committer | Ermal LUÇI <eri@pfsense.org> | 2015-01-07 21:02:39 +0100 |
commit | 5324ea38a1783200f3d8c1eec1229505c19968ef (patch) | |
tree | 9405f944462e0f1d74c819ded6b3b7487849c5cd /etc/inc/vpn.inc | |
parent | b9f290bd2772e20d97927e7ed812078a466958c7 (diff) | |
download | pfsense-5324ea38a1783200f3d8c1eec1229505c19968ef.zip pfsense-5324ea38a1783200f3d8c1eec1229505c19968ef.tar.gz |
Move to specifically specifying the ID type apart when an ip address to have strongswan do proper behaviour. Also for DynDNS names use the dns type id so strongswan does the resolving by its own.
Diffstat (limited to 'etc/inc/vpn.inc')
-rw-r--r-- | etc/inc/vpn.inc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index d5775da..60a844f 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -478,14 +478,14 @@ EOD; /* XXX" Traffic selectors? */ $pskconf .= " : RSA {$ph1keyfile}\n"; } else { - list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local"); - list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap); + list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, 'local'); + list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, 'peer', $rgmap); if (empty($peerid_data)) continue; $myid = isset($ph1ent['mobile']) ? trim($myid_data) : "%any"; - $peerid = ($peerid_data != "allusers") ? trim($peerid_data) : ""; + $peerid = ($peerid_data != 'allusers') ? trim($peerid_data) : ''; if (!empty($ph1ent['pre-shared-key'])) { if ($myid_type == 'fqdn' && !empty($myid_data)) $pskconf .= "@{$myid} {$peerid} : PSK 0s" . base64_encode(trim($ph1ent['pre-shared-key'])) . "\n"; @@ -560,17 +560,19 @@ EOD; } else $right_spec = $ph1ent['remote-gateway']; - list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, "local"); - if ($myid_type == 'fqdn') - $myid_data = "@{$myid_data}"; - list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, "peer", $rgmap); - if ($peerid_type == 'fqdn') - $peerid_data = "@{$peerid_data}"; + list ($myid_type, $myid_data) = ipsec_find_id($ph1ent, 'local'); + if ($myid_type != 'address') + $myid_data = "{$myid_type}:{$myid_data}"; /* Only specify peer ID if we are not dealing with a mobile PSK-only tunnel */ $peerid_spec = ''; - if (!isset($ph1ent['mobile'])) - $peerid_spec = $peerid_data; + if (!isset($ph1ent['mobile'])) { + list ($peerid_type, $peerid_data) = ipsec_find_id($ph1ent, 'peer', $rgmap); + if ($peerid_type != 'address') + $peerid_spec = "{$peerid_type}:{$peerid_data}"; + else + $peerid_spec = $peerid_data; + } if (is_array($ph1ent['encryption-algorithm']) && !empty($ph1ent['encryption-algorithm']['name']) && !empty($ph1ent['hash-algorithm'])) { $ealgosp1 = ''; |