Project

General

Profile

Frequently Asked Questions (FAQ) » History » Version 18

Noel Kuntze, 17.02.2016 01:18
Non standard IKE ports

1 5 Martin Willi
h1. Frequently Asked Questions
2 1 Martin Willi
3 11 Tobias Brunner
{{>toc}}
4 1 Martin Willi
5 11 Tobias Brunner
h2. IKEv1
6 1 Martin Willi
7 17 Noel Kuntze
h3. multiple subnets per SA
8 17 Noel Kuntze
9 17 Noel Kuntze
*Q:* Can I tunnel several subnets in one CHILD_SA?
10 17 Noel Kuntze
11 17 Noel Kuntze
*A:* Usually not, unless you're a roadwarrior client and can use the UNITY extension. In any other case, you need to define a seperate CHILD_SA per subnet pair.
12 17 Noel Kuntze
If you're a roadwarrior and use a proprietary implementation, please read the notes about [[UserDocumentation#Interoperability|interoperability]]. If you use strongSwan, try setting @rightsubnet=0.0.0.0/0@
13 17 Noel Kuntze
and enable the [[UnityPlugin|UNITY]] extension. You also need to make sure that the plugin is loaded to be able to use it.
14 17 Noel Kuntze
An easy to manage example for a site-to-site setup follows:
15 17 Noel Kuntze
<pre>
16 17 Noel Kuntze
conn myikesettings
17 17 Noel Kuntze
    keyexchange=ikev1
18 17 Noel Kuntze
    left=10.0.0.1
19 17 Noel Kuntze
    right=10.0.0.2
20 17 Noel Kuntze
    leftcert=mycert.pem
21 17 Noel Kuntze
    rightcert=othercert.oem
22 17 Noel Kuntze
    ike=aesgcm16-prfsha256-modp3072!
23 17 Noel Kuntze
    esp=aesgcm16-modp3072!
24 17 Noel Kuntze
25 17 Noel Kuntze
conn sa_1
26 17 Noel Kuntze
    leftsubnet=192.168.1.0/24
27 17 Noel Kuntze
    rightsubnet=192.168.51.0/24
28 17 Noel Kuntze
    also=myikesettings
29 17 Noel Kuntze
    auto=route
30 17 Noel Kuntze
31 17 Noel Kuntze
conn sa_2
32 17 Noel Kuntze
    leftsubnet=192.168.2.0/24
33 17 Noel Kuntze
    rightsubnet=192.168.52.0/24
34 17 Noel Kuntze
    also=myikesettings
35 17 Noel Kuntze
    auto=route
36 17 Noel Kuntze
</pre>
37 14 Tobias Brunner
h3. "no proposal chosen" returned by ZyXEL/Linksys/x router
38 1 Martin Willi
39 14 Tobias Brunner
*Q:* _I'm trying to set up a VPN tunnel with a ZyXEL/Linksys/X router but the other side keeps on telling me "no proposal chosen" when strongSwan initiates the connection._
40 14 Tobias Brunner
41 6 Tobias Brunner
*A:* Make sure that the peer supports all the algorithms (including the key lengths) which strongSwan proposes for IKE and ESP. In terms of IKE, the proposal consists of the following parts: Encryption algorithm, hash algorithm (PRF) and DH group. In terms of ESP the proposal includes the following: Encryption algorithm, hash algorithm, pfs group (DH group) and *compression algorithm*. There are lots of IPsec implementations out there that do *not* support compression or have implemented it erronously. So the first thing to try in this situation is to switch compression off on the peer. strongSwan's default setting is
42 5 Martin Willi
<pre>
43 1 Martin Willi
compress=no
44 1 Martin Willi
</pre>
45 1 Martin Willi
See also Chapter "14.1 Authentication and encryption algorithms":http://www.strongswan.org/docs/readme4.htm#section_14.1 of the strongSwan documentation. It has good information about the relevant parameters.
46 11 Tobias Brunner
47 1 Martin Willi
48 14 Tobias Brunner
h3. "no RSA public key known for '...'"
49 1 Martin Willi
50 14 Tobias Brunner
*Q:* _I'm getting the error message "no RSA public key known for '....' ". What am I doing wrong?_
51 14 Tobias Brunner
52 11 Tobias Brunner
*A:* If you are using RSA based signatures for authentication strongSwan needs to have the peer's RSA public key in order to verify its authentication. This public key can be provided either by using the @rightrsasigkey@ directive in [[ipsecconf|ipsec.conf]] which was popular with FreeS/WAN or it can be extracted from the peer's X.509 certificate. This certificate can in turn be preloaded via the @rightcert@ directive if it is available locally or it can be requested from the remote end with a _certificate request_. Now if the certificate is missing one reason might be that the remote end refused to send it. Another reason could be that strongSwan did not send a _certificate request_. This happens if you set the @nocrsend@ option to @yes@. The Astaro Security Gateway which uses strongSwan behind the scene is known to do that. In order to make the IPsec connection work in that scenario you need to set @leftsendcert@ to @yes@ on the other end. With @leftsendcert=yes@ strongSwan sends its certificate across even if no _certificate request_ was received. This helps to interoperate with some misconfigured peers.
53 1 Martin Willi
54 1 Martin Willi
55 14 Tobias Brunner
h3. Aggressive Mode
56 1 Martin Willi
57 14 Tobias Brunner
*Q:* _Does strongSwan support IKEv1 Aggressive Mode?_
58 1 Martin Willi
59 1 Martin Willi
*A:* Since [[5.0.0|version 5.0.0]] the answer is _yes_. For previous releases, where the IKEv1 protocol was handled by the pluto daemon, the answer is and remains _no_. 
60 1 Martin Willi
However, the strongSwan developers still recommend to avoid its use with pre-shared keys. This is due to a known weakness of the protocol. With Aggressive Mode, a hash of the pre-shared key is transmitted in clear-text. An eavesdropper can capture this hash and run an offline brute-force attack against it. Once the pre-shared key is known "MITM attacks":http://en.wikipedia.org/wiki/Man-in-the-middle_attack to gather the XAuth credentials can easily be executed. Aggressive Mode is therefore incompatible with the basic principles of the strongSwan project which is to deliver a product that meets high security standards. That's why, in order to use Aggressive Mode with pre-shared keys as responder (i.e. on gateways) it is required to set @charon.i_dont_care_about_security_and_use_aggressive_mode_psk=yes@ in [[strongswan.conf]]. As promised often in numerous public and private talks strongSwan then changes its name to *weakSwan*. It is not required to set this option for clients as they often have no other choice.
61 1 Martin Willi
62 1 Martin Willi
To avoid Aggressive Mode with pre-shared keys (and other short-comings of IKEv1 Main or Aggressive Mode) the best option is to switch to *IKEv2*. But even for IKEv1 strongSwan [[5.0.0]] now provides an easy to deploy alternative: {{tc(ikev1/xauth-id-rsa-hybrid, hybrid authentication)}}.  This mode uses a certificate to authenticate the gateway and only XAuth to authenticate the client, during Phase 1 (Main or Aggressive Mode) the client is not authenticated.
63 1 Martin Willi
64 1 Martin Willi
65 14 Tobias Brunner
h3. Public key authentication fails with retransmissions
66 1 Martin Willi
67 14 Tobias Brunner
*Q:* _strongSwan fails to initiate a connection to a peer. I'm using RSA authentication and I noticed the two error messages: @'discarding duplicate packet; already STATE_MAIN_I3'@ on the initiator side and @'max number of retransmissions (2) reached STATE_MAIN_R2'@ on the responder side._
68 14 Tobias Brunner
69 1 Martin Willi
*A:* This problem might be related to the Path MTU (Maximum Transmission Unit). The IKE protocol is transported in UDP datagrams. As result the UDP datagrams also contain the X.509 certificate you are using. Now, if you're using a large certificate the UDP datagram might get bigger than the PMTU. That's the point where IP fragmentation kicks in and cuts your IP packet / UDP datagram in two or more pieces. There are some firewalls out there that strictly block IP fragments and therefore hamper your IKE connection. Large X.509 certificates could result from long Distinguished names or from long RSA keys (2048 bit). As a workaround you can reconfigure your firewall, try to make your certificates smaller or preload the certificates on both sides and thereby get away without transmitting the certificates over UDP.
70 1 Martin Willi
71 14 Tobias Brunner
Since version:5.0.2 strongSwan supports the proprietary IKEv1 fragmentation extension, which can be enabled with the _fragmentation_ option in [[ConnSection|ipsec.conf]].
72 8 Daniel Mentz
73 11 Tobias Brunner
74 14 Tobias Brunner
h3. NAT between Windows L2TP/IPsec clients and older strongSwan servers
75 14 Tobias Brunner
76 14 Tobias Brunner
*Q:* _I want to set up strongSwan to interoperate with Microsoft Windows using L2TP/IPsec. I'm getting the error message "NAT-Traversal: Transport mode disabled due to security concerns" which results in strongSwan sending an encrypted notification BAD_PROPOSAL_SYNTAX_
77 14 Tobias Brunner
78 14 Tobias Brunner
*A:* Here is a quote from strongSwan lead developer Andreas Steffen on how to deal with this problem:
79 14 Tobias Brunner
80 14 Tobias Brunner
> NAT-Traversal with IPsec transport mode has some inherent security risks. Since Microsoft doesn't care about this please compile strongSwan with the option
81 14 Tobias Brunner
> <pre>
82 14 Tobias Brunner
  ./configure  --enable-nat-transport</pre>
83 14 Tobias Brunner
84 14 Tobias Brunner
85 14 Tobias Brunner
h3. "ignoring CERT_PKCS7_WRAPPED_X509 certificate request" with Juniper device
86 14 Tobias Brunner
87 14 Tobias Brunner
*Q:* _I'm trying to setup strongSwan to interop with a device from Juniper. The connection setup fails. I found the following message in the log file: @'ignoring CERT_PKCS7_WRAPPED_X509 certificate request payload'@._
88 14 Tobias Brunner
89 8 Daniel Mentz
*A:* The problem is that Juniper expects strongSwan to send its certificate[s] in CERT_PKCS7_WRAPPED_X509 format which is quite unusual. strongSwan can parse such payloads (e.g. Windows XP sends them if there is a multi-level certificate chain) but currently cannot construct them since there was never a need. We have full PKCS#7 functionality in our scepclient tool but it hasn't be integrated into the pluto daemon.
90 1 Martin Willi
91 1 Martin Willi
Are you using a multi-level certificate hierarchy and if yes could you import the root and all intermediate CA certificates statically on your Juniper box? Or just use a simple certificate hierarchy with path length 0?
92 1 Martin Willi
93 1 Martin Willi
94 14 Tobias Brunner
h3. "next payload type of ISAKMP Message has an unknown value: 33"
95 1 Martin Willi
96 14 Tobias Brunner
*Q:* _I'm trying to set up a connection using a pre-shared key configuration. I get the following error message: @'packet from 10.x.x.30:500: next payload type of ISAKMP Message has an unknown value: 33'@._
97 1 Martin Willi
98 14 Tobias Brunner
*A:* This error message usually points to a difference in the pre-shared key configured on the two server. With the wrong key the receiver is not able to correctly decrypt the incoming traffic. Please check the configured PSKs in [[ipsec.secrets]].
99 14 Tobias Brunner
100 14 Tobias Brunner
101 1 Martin Willi
h2. IKEv2
102 1 Martin Willi
103 8 Daniel Mentz
104 14 Tobias Brunner
h3. Disabling NAT traversal?
105 14 Tobias Brunner
106 14 Tobias Brunner
*Q:* _How can I turn off NAT traversal in charon (IKEv2)?_
107 14 Tobias Brunner
108 14 Tobias Brunner
*A:* NAT traversal cannot be disabled in the charon daemon. If you don't like automatic port floating to UDP/4500 due to the MOBIKE protocol (RFC 4555) which happens even if no NAT situation exists then you can disable MOBIKE by adding
109 8 Daniel Mentz
<pre>
110 11 Tobias Brunner
mobike=no
111 11 Tobias Brunner
</pre> to [[ipsecconf|ipsec.conf]] in the connection definition.
112 9 Daniel Mentz
113 14 Tobias Brunner
114 14 Tobias Brunner
h3. Public key authentication fails with retransmissions
115 14 Tobias Brunner
116 14 Tobias Brunner
*Q:* _My IKEv2 connection fails with retransmits during the IKE_AUTH exchange when using RSA certificates, but works when a PSK is used. Why?_
117 14 Tobias Brunner
118 14 Tobias Brunner
*A:* This is probably related to the Path MTU(Maximum Transmission Unit). The IKE_AUTH messages that contain the certificates and certificate requests can get pretty big, therefore, the IP packets transporting these UDP datagrams could get fragmented. Some firewalls might block IP fragments and will therefore hamper your IKE connection.  If you can't configure the responsible firewall(s) to accept fragments you could try to preload the certificates on both sides and then configure _rightsendcert=never_ in [[ConnSection|ipsec.conf]] to prevent the daemon from sending certificate requests. With the default setting of _leftsendcert=ifasked_ the own certificate will not be sent (this could be enforced with _leftsendcert=never_). Using ECDSA instead of RSA will also reduce the size of the IKE_AUTH messages as keys/certificates will be significantly smaller.
119 14 Tobias Brunner
120 15 Chris Buechler
The version:5.1.2 release and newer contain support for the "IKEv2 fragmentation extension":http://tools.ietf.org/html/draft-ietf-ipsecme-ikev2-fragmentation, which can be enabled with the _fragmentation_ option in [[connsection|ipsec.conf]].
121 14 Tobias Brunner
122 12 Daniel Mentz
h2. General Questions
123 12 Daniel Mentz
124 14 Tobias Brunner
h3. Capturing outbound plaintext packets with tcpdump/wireshark
125 14 Tobias Brunner
126 14 Tobias Brunner
*Q:* _When using tcpdump/wireshark to sniff traffic secured by IPsec, incoming packets show up twice: encrypted i.e. as ESP packets and unencrypted as plaintext packets. However, for outgoing traffic, only ESP packets show up. How can I get incoming *and* outgoing packets as plaintext?_
127 12 Daniel Mentz
128 12 Daniel Mentz
*A:* That's a peculiarity of the Linux kernel. Capture the (UDP encapsulated) ESP packets and use wireshark to decrypt them. See http://wiki.wireshark.org/ESP_Preferences
129 12 Daniel Mentz
Run the following command to determine the encryption algorithms and the symmetric keys used by the kernel. Depending on your configuration, strongSwan periodically changes encryption keys. Keep this in mind if you are capturing traffic over an extended period of time.
130 12 Daniel Mentz
<pre>
131 12 Daniel Mentz
ip xfrm state
132 1 Martin Willi
</pre>
133 16 Noel Kuntze
There's also a [[CorrectTrafficDump|document]] about traffic dumps, that shows the ways to dump different traffic on the IPsec endpoint.
134 18 Noel Kuntze
135 18 Noel Kuntze
h3. Non-standard IKE ports
136 18 Noel Kuntze
137 18 Noel Kuntze
*Q:* Can I use a local non-standard port for IKE?
138 18 Noel Kuntze
*A:* The default socket implementation @socket-default@ can only listen on a single, predermined port. It can not listen on multiple ports.
139 18 Noel Kuntze
There are compile time flags to determine the ports and two settings on strongswan.conf that can be used to influence the behaviour.
140 18 Noel Kuntze
There is also another socket implementation called @socket-dynamic@, which is experimental and can send IKE messages on any port.
141 18 Noel Kuntze
You can also use the @DNAT@ and @SNAT@ targets in iptables to move ports around, if you so desire.