Frequently Asked Questions¶
- Table of contents
- Frequently Asked Questions
- "no proposal chosen" returned by ZyXEL/Linksys/x router
- "no RSA public key known for '...'"
- "invalid HASH_V1 payload length, decryption failed?"
- Aggressive Mode
- Public key authentication fails with retransmissions
- NAT between Windows L2TP/IPsec clients and strongSwan < 5.0.0
- "ignoring CERT_PKCS7_WRAPPED_X509 certificate request" with Juniper device
- "next payload type of ISAKMP Message has an unknown value: 33"
- "ignoring unprotected INFORMATIONAL"
- General Questions
- Capturing outbound plaintext packets with tcpdump/wireshark
- Non-standard IKE ports
- strongSwan crashes
- Plugin is missing
- configuration compatibility with FreeS/WAN, Openswan and Libreswan
- Multiple subnets per SA
- IPsec and iptables/nftables
- High Availability and Failover configurations
- Wildcard Certificates
- Common Name field in the Distinguished Name
- "constraint check failed: identity '...' required"
- "No private key found"
"no proposal chosen" returned by ZyXEL/Linksys/x router¶
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.
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
See also Chapter 14.1 Authentication and encryption algorithms of the strongSwan documentation. It has good information about the relevant parameters.
"no RSA public key known for '...'"¶
Q: I'm getting the error message "no RSA public key known for '....' ". What am I doing wrong?
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 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
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.
"invalid HASH_V1 payload length, decryption failed?"¶
Q: I'm getting the error message "invalid HASH_V1 payload length, decryption failed?" when using PSK authentication. What could be the reason?
A: This is most likely due to an incorrect PSK on one of the peers. Since the PSK is incorporated into the key material used so secure the IKEv1 packets they can't be decrypted properly if the PSKs don't match.
Note that the PSK whose associated identities/IPs matches best is used. So if the local identity is configured with every PSK every PSK will basically match to some degree. Which is why only remote identities/IPs should be associated with PSKs.
For IKEv1 the first lookup is always based on the IP addresses (i.e. every secret that lists the local IP will match). If no PSK is found an initiator will use the configured identities for a second lookup. As responder identities can only be used if aggressive mode is used (which should never be used with PSK). However, if a configuration is found (based on the IPs) a lookup based on the configured identities is done (all matching configs are considered until a PSK is found).
Q: Does strongSwan support IKEv1 Aggressive Mode?
A: Since 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.
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 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.
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: 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.
Public key authentication fails with retransmissions¶
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.
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.
NAT between Windows L2TP/IPsec clients and strongSwan < 5.0.0¶
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
A: NAT-Traversal with IPsec transport mode has some inherent security risks. Since Microsoft doesn't care about this, you need to compile strongSwan versions prior to 5.0.0 with the option
"ignoring CERT_PKCS7_WRAPPED_X509 certificate request" with Juniper device¶
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'.
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.
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?
"next payload type of ISAKMP Message has an unknown value: 33"¶
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'.
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.
"ignoring unprotected INFORMATIONAL"¶
Q: strongSwan logs "ignoring unprotected INFORMATIONAL". What does that mean?
A: It means that strongSwan did not process an Informational message, because the other peer did not authenticate it, that is, it didn't contain an AUTH payload. Some implementations send error notifies in such a way. If so, try to determine what the problem is based on the type of notify that was contained in the message (it should be listed in the log message before this one).
Disabling NAT traversal?¶
Q: How can I turn off NAT traversal in charon (IKEv2)?
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
mobike=noto ipsec.conf in the connection definition.
Public key authentication fails with retransmissions¶
Q: My IKEv2 connection fails with retransmits during the IKE_AUTH exchange when using RSA certificates, but works when a PSK is used. Why?
A: This is probably related to the Path MTU. 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 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.
Capturing outbound plaintext packets with tcpdump/wireshark¶
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?
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
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.
ip xfrm state
There's also a document about traffic dumps, that shows the ways to dump different traffic on the IPsec endpoint.
Non-standard IKE ports¶
Q: Can I use a local non-standard port for IKE?
A: The default socket implementation socket-default can only listen on two, predetermined ports (by default, one is used for NAT-Traversal). There are compile time flags and two settings in strongswan.conf to determine these ports, but clients usually will only use the default ports (500/4500). However, strongSwan as a client can use an arbitrary remote port, which may be configured via rightikeport (see the notes regarding custom server ports and NAT-Traversal).
To use arbitrary ports on a client (determined when socket-default plugin is initialized) the settings above may be set to 0. There is also another socket implementation called socket-dynamic, which is experimental and can send IKE messages from any port (specified with leftikeport), and requires sending packets to the remote NAT-T port (e.g. rightikeport=4500).
You can also use the
SNAT targets in iptables to move ports around, if you so desire.
Q: strongSwan sometimes crashes and I don't know why. What should I do?
A: If you compiled it yourself, make sure your cleaned the build directory before compiling. If you do not do that, you can end up linking objects of different strongSwan versions together and that can cause crashes. If you don't use the same configure options when building a newer version uninstalling/removing the previous binaries/libraries is required (the same applies if you previously had strongSwan installed from a distribution package). Then recompile it and reinstall it. If the crash persists, use the search function and try to find a similar bug report and read it. If you can not find one, open a new issue on the issue tracker. If you are not using the latest version, it is very likely that the crash you experienced was already fixed.
If you installed it as binary package, check the corresponding distribution's issue track for reports or use the search function here and try to find a similar bug report and read it. If you can not find one, open a new issue on the issue tracker. If you are not using the latest version, it is very likely that the crash you experienced was already fixed.
Plugin is missing¶
Q: I need some plugin, but it seems my version of charon doesn't load it! What should I do?!
A: Check if you customized the list of loaded plugins. If so, make sure the plugin you need is included (see below for details on modular plugin loading). Then make sure the plugin is actually installed. For that, run
find (check the man page of
find for the syntax) with the required syntax to search your hard drive for the plugin's .so file. If it exists and is in a plausible directory, then it should be installed. Then restart the daemon.
If your installation of strongSwan is configured for modular loading (the default since 5.1.2) and
strongswan.conf includes the strongswan.d/charon/ directory, check if the plugin specific configuration file in /etc/strongswan.d/charon/ contains
load = yes in the plugin specific configuration section. If the file does not exist, the plugin is likely not installed.
If you compiled strongSwan yourself, rebuild it with the required plugins enabled.
If you got strongSwan from the repositories of a distribution, look for additional packages. It is likely the distribution ships the plugin you're looking for in another package. If you still can not find it, search the issue tracker of that distribution for a bug report or feature request that requests the plugin you want. If you found one, weigh in on it, if it is not already closed or a plausible reason was given why the request can not be fulfilled.
If you did not find a bug report of feature request in the issue tracker of that distribution, open one stating your request for the plugin you're looking for to be included.
configuration compatibility with FreeS/WAN, Openswan and Libreswan¶
Q: Are configuration files of FreeS/WAN, Openswan and Libreswan compatible with the ones of strongSwan?
A: They are not compatible. Although the format of ipsec.conf is identical between the different swans, they files are not compatible, because several options have different meanings and a variety of different
options are absent from some versions and others exist. Do not attempt to reuse configuration files between different swans.
Multiple subnets per SA¶
Q: Can I tunnel several subnets in one CHILD_SA?
A: If you use IKEv2, you can. If you use IKEv1, you need to be a roadwarrior and use the UNITY extension (strongSwan implements it with the Unity plugin). In any other case, you need to define a seperate CHILD_SA per subnet pair.
If you're a roadwarrior and use a proprietary implementation, please read the notes about interoperability. If you use strongSwan, try setting
and enable the Unity extension. You also need to make sure that the plugin is loaded to be able to use it.
An easy to manage example for a site-to-site setup follows:
conn myikesettings keyexchange=ikev1 left=10.0.0.1 right=10.0.0.2 leftcert=mycert.pem rightcert=othercert.oem ike=aesgcm16-prfsha256-modp3072! esp=aesgcm16-modp3072! conn sa_1 leftsubnet=192.168.1.0/24 rightsubnet=192.168.51.0/24 also=myikesettings auto=route conn sa_2 leftsubnet=192.168.2.0/24 rightsubnet=192.168.52.0/24 also=myikesettings auto=route
IPsec and iptables/nftables¶
Q: How does IPsec on Linux interact with iptables/nftables?
A: ipsec protected traffic passes through the same tables and chains as unprotected traffic. The only exception is that ipsec protected traffic passes through some chains twice. You can tell protected and unprotected traffic apart using the
policy module in iptables. There's currently (2016-11-17) no way to tell the traffic apart using nftables. This graph shows where IPsec (XFRM) hooks into Netfilter and which tables and chains are traversed in what order. Packets that are compressed using the ipcomp option pass through some chains three times. Once as encapsulated packet, then as IP-in-IP packet and then as the actual packet. The protocol number depends on the encapsulated protocol. You need to allow the protocols in
ip6tables depending on your tunnel configuration.
High Availability and Failover configurations¶
Q: Does strongSwan support high availability and failover configurations?
A: At this moment (version 5.5.1), strongSwan only supports active-active HA clusters that are comprised of two nodes. It only supports active-passive configurations when both peers receive the same packets by use of an multicast group, as described in HighAvailability. Failover configurations with policy based tunnels are not possible. However, with route based tunnels that are built using VTIs and with a dynamic routing daemon, such a configuration should be possible between one strongSwan installation and two redundant remote gateways, like AWS.
Q: Does strongSwan support wildcard certificates?
A:: No, it doesn't. The reason for that is that wildcard certificates are declared deprecated in RFC 6125.
Common Name field in the Distinguished Name¶
Q: Does strongSwan support checking the ID against the Common Name (CN) field of the Distinguished Name (DN) in X.509 certificates?
A:: No, it doesn't. This is discussed in #629. The ID must be present in a SAN field with the correct type.
"constraint check failed: identity '...' required"¶
Q: The authentication fails with the error "constraint check failed: identity '...' required". What exactly is the problem?
A:: To prevent MITM attacks some of the clients that, for simplicity, don't require configuring the server identity explicitly (e.g. the Android and macOS apps or the NetworkManager plugin) enforce the hostname/IP as remote identity and will check that this identity is contained in a subjectAlternativeName (SAN) extension of the server certificate. If that's not the case you'll receive that error (also see the questions above regarding matching identities against CN and wildcard certificates). The Android app allows configuring the server identity explicitly in the advanced profile settings, but other clients might not. In that case you'll have to add the missing SAN to the certificate (e.g. with the
--san option for pki --issue) or use a hostname or IP that's already contained as SAN in the certificate.
"No private key found"¶
Q: strongSwan logs "No private key found". What's wrong?
A: You are trying to use a certificate to authenticate yourself for which you did not provide the private key to strongSwan. If you're using ipsec.conf, you need to put a reference to the private key in the ipsec.secrets file. You need to have the private key in order to be able to use it. If it still logs the error, make sure you reread the secrets or restarted the daemon. strongSwan obviously also needs to be able to read the file the key is in. If it persists, check if the certificate's public key was generated using the private key you're trying to use. It surprisingly often happens that people mix up private keys and certificates and try to use the wrong private key.