summaryrefslogtreecommitdiff
path: root/sbin/iked
AgeCommit message (Collapse)Author
2017-06-01Expand $eapid in iked tags, allowing PF rules to be written based on EAPStuart Henderson
identity (username). OK mikeb@
2017-05-21A few more freezero() usesTheo de Raadt
ok yasuoka mikeb
2017-04-26cope with IP address changes. before, we were trying to resend the msgHenning Brauer
with the no-longer-available address over and over and over, requiring iked to be restarted eventually. instead, on EADDRNOTAVAIL, schedule SA deletion so a new one is set up shortly thereafter. ok reyk mikeb
2017-04-24Fix configuration of ASN1_DN IDs.Reyk Floeter
Public key authentication uses public key files that are stored in the /etc/iked/pubkeys/ directory where the IKE IDs are encoded as filenames. This does not simply work with ASN1_DNs where the IDs include slashes and other special characters. Instead of breaking and failing when an ASN1_DN is configured, simply skip the public key lookup but allow to use it with certificates or PSKs. Reported and fix tested by Igor V. Gubenko - Thanks.
2017-04-18use freezero()Theo de Raadt
2017-04-13Add a NAT-T keepalive timer in case we are behind a NAT gateway.Patrick Wildt
See RFC 5996, section 2.23, NAT Traversal: In the case of a mismatching NAT_DETECTION_DESTINATION_IP hash, it means that the system receiving the NAT_DETECTION_DESTINATION_IP payload is behind a NAT and that system SHOULD start sending keepalive packets as defined in [UDPENCAPS]. With markus@, ok reyk@
2017-03-30Only close the SA if an error happens before ikev2_msg_init() was calledPatrick Wildt
to make sure we do not run ikev2_msg_cleanup() on an unitialized stack variable. ok deraadt@ reyk@
2017-03-28Add helpful debug messages to tell us why public key authentication failed.Reyk Floeter
This is currently only visible in debug mode (eg. iked -dvv), some debug messages will be turned into regular warnings later. OK claudio@ deraadt@
2017-03-28Remove RSA from the list of keywords, lookup is now done in a table.Reyk Floeter
This lets us configure explicit old-style RSA again. OK mikeb@
2017-03-28Don't send informational responses before we're having the key material.Reyk Floeter
iked starts sending keepalive messages after authentication and after successfully completing the handshake. Other implementations, like we've seen on Microsoft Azure, start sending keepalive messages right after receiving the first SA_INIT message when they set up the key material, even before we received the SA_INIT response to complete the DH exchange. The solution is to ignore early keepalive messages before we're ready to encrypt our response, in the transition between SA_INIT and AUTH. The peer should still accept one or more missed keepalives. OK mikeb@
2017-03-28Returning -1 in an imsg handler like ikev2_dispatch_cert aborts iked.Reyk Floeter
-1 means "I didn't handle or know this imsg", it should not be used to indicate an application error in this context. OK mikeb@
2017-03-27Don't cache the DH group in the policyMike Belopuhov
When tearing IKE SA down, the DH group referred by it is destroyed, however it remains cached in the policy. With the introduction of IKE SA rekeying we have extended the life of this dangling pointer by reusing it on new SAs. So instead of caching the pointer in the policy we can store the DH group ID and create a DH group on demand using this parameter if it's specified. With and OK reyk
2017-03-27correct verb pattern;Jason McIntyre
2017-03-27Factor out flows into separate configuration messagesMike Belopuhov
We reach an imsg payload limit with just a few traffic selectors so in order to load more we need to split them up and send separately. Suggested and OK reyk
2017-03-27spacingReyk Floeter
2017-03-27Fix another iked leak of SAs in pfkey_sa(), copy tags correctly.Reyk Floeter
Diff from markus@ OK mikeb@ patrick@
2017-03-27Add support to reflect the responder IKEv2 COOKIE.Reyk Floeter
This fixes connecting to Azure VPN and other implementations that implement the IKEv2 COOKIE mechanism on the responder side. Azure decides to send you a responder COOKIE after too many connection attempts - we have to keep it and reflect it to establish a connection. This implementation is only for the initiator (client) side, we do not support sending COOKIEs on the responder (server) side yet. OK patrick@ mikeb@
2017-03-27Add support for RFC4754 (ECDSA) and RFC7427 authentication.Reyk Floeter
These modes provide stronger and more flexible ways for authentication: while RSA public key auth relies on SHA-1 hashes, the news modes use SHA2-256 and up to SHA2-512 hashes. Original diff from markus@ with patches from mikeb@ and me. OK mikeb@ patrick@
2017-03-23set ps_noaction to not fork uneeded children when checking config with -nJonathan Gray
ok mikeb@ reyk@
2017-03-21From a syslog perspective it does not make sense to log fatal andAlexander Bluhm
warn with the same severity. Switch log_warn() to LOG_ERR and keep fatal() at LOG_CRIT. OK reyk@ florian@
2017-03-13Resolve simultaneous Child SA rekeyingMike Belopuhov
From and OK markus, OK reyk
2017-03-13Resolve simultaneous IKE SA rekeyingMike Belopuhov
From and OK markus, OK reyk
2017-03-13Make sure that proposal contains a DH group when rekeying with PFS enabledReyk Floeter
Via markus, OK mikeb@
2017-03-13NAT-T improvementsReyk Floeter
Move repeated creation of the NAT-T payload into a function, remove erroneous msg_offset, and improve NAT-T handling. From and OK markus, OK mikeb
2017-03-13Don't rekey acquired Child SAsMike Belopuhov
From and OK markus, OK reyk
2017-03-13Clarify iked.conf(5) manpage in regards to IP compression.Patrick Wildt
ok markus@ reyk@
2017-03-13When setting up IPcomp flows for the networks 'A' and 'B' betweenPatrick Wildt
gateways 'a' and 'b', we replace the ESP flow "A->B ESP" with an IPCOMP flow "A->B IPCOMP" and add a matching (transport mode) ESP flow between the gateways "a->b ESP". The later is now marked with flow_ipcomp so it is not translated into "a->b IPCOMP" on rekeying. When SAs get deleted we do an extra loop to figure out if matching IPcomp SAs can now be removed, too. This allows faster expiry of unused IPcomp SAs. Disable bytes lifetime for IP compression. ok markus@ reyk@
2017-03-13When freeing a Child SA make sure it's peer no longer points to itMike Belopuhov
From and OK markus, OK reyk
2017-03-13Fix and improve the IKE SA rekeying timeout, add a randomized jitter.Reyk Floeter
Diff from markus@ with a small tweak from me. OK mikeb@ patrick@
2017-03-13Improve reporting of authentication errorsMike Belopuhov
From and OK markus, OK reyk
2017-03-13flow_cmp() must compare the same flow-attributes as the kernel,Patrick Wildt
otherwise we never can keep the in-daemon and the in-kernel idea of flows in sync and iked ends up deleting flows that are still in use. Make use of flow_cmp() and a new flow_equal() instead of handcrafting the compare in an if. ok markus@ reyk@
2017-03-13We need to call policy_ref() for policies that have refcountingPatrick Wildt
enabled. Refcounting is enabled when a policy is removed during 'ikectl reload' and still has SAs point to it. On IKESA rekeying such a policy will be referenced by the new IKESA, so we need to adjust the refcount -- otherwise the policies get free()d too early and we will crash at some point. ok markus@ mikeb@ reyk@
2017-02-28Depending on the addresses, ipsecctl(8) automatically groups saAlexander Bluhm
bundles together. Extend the kernel interface to export the bundle information to userland. Then ipsecctl -ss -v can show the internal relations. Unfortunately the header SADB_X_EXT_PROTOCOL was reused by SADB_X_GRPSPIS, so it cannot be used to transfer the second sa type with sysctl. Introduce a new SADB_X_EXT_SATYPE2 and use it consistently. OK hshoexer@ markus@
2017-02-24In a scenario where a config reload happens during an IKE_AUTH exchange,Patrick Wildt
and we move an SA from one to another policy, we need to make sure to do refcounting if the policies involved are already in the garbage collect phase. ok markus@ mikeb@
2017-02-03Stop assuming that in_{addr,port}_t are typedefed in <sys/types.h> andPhilip Guenther
instead pull in <netinet/in.h> or <arpa/inet.h> when those are needed. ok florian@ beck@ millert@
2017-01-20Add a warning when the address pool is exhaustedMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Constify the data argument for ibuf_newMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Reset various pointers in ikev2_msg_cleanupMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Make sure to free reference to the public key after decodingMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Closed SAs should never be treated as validMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Check bounds of the flows array when configuring traffic selectorsMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Verify the certificate imsg payload sizeMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Include only found SPIs into the PAYLOAD_DELETE messageMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Minor formatting fixMike Belopuhov
From and OK markus@, OK reyk
2017-01-20New RFC7383 defineMike Belopuhov
From and OK markus@, OK reyk
2017-01-17Nuke some whitespace that keeps poking me in the eye as I try toKenneth R Westerback
steal code.
2017-01-09Stop accessing verbose and debug variables from log.c directly.Reyk Floeter
This replaces log_verbose() and "extern int verbose" with the two functions log_setverbose() and log_getverbose(). Pointed out by benno@ OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)
2017-01-09Replace hand-rolled for(;;) traversal of ctl_conns TAILQ withKenneth R Westerback
TAILQ_FOREACH(). No intentional functional change. ok reyk@
2017-01-08Sync log.c with the latest version from vmd/log.c that preserves errnoReyk Floeter
so it is safe calling log_* after an error without loosing the it.
2017-01-05Replace symset()'s hand-rolled for(;;) traversal of 'symhead' TAILQKenneth R Westerback
with more modern TAILQ_FOREACH(). This what symget() was already doing. Add paranoia '{}' around body of symget()'s TAILQ_FOREACH(). No intentional functional change. ok bluhm@ otto@