summaryrefslogtreecommitdiff
path: root/sbin/iked/ikev2_msg.c
AgeCommit message (Collapse)Author
2017-11-27Implement MOBIKE (RFC 4555) support in iked(8), with us acting asPatrick Wildt
responder. In practice this support means that clients like iPhones can roam in different networks (LTE, WiFi) and change their external addresses without having to re-do the whole handshake. It allows the client to choose how and when to change the external tunnel endpoint addresses on demand, depending on which network is better or even is connected at all. ok sthen@ tweaks from jmc@ tested by a handful
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-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-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-01-20Reset various pointers in ikev2_msg_cleanupMike Belopuhov
From and OK markus@, OK reyk
2017-01-20Closed SAs should never be treated as validMike Belopuhov
From and OK markus@, OK reyk
2016-09-04Now that we have IP_SENDSRCADDR, add sendtofrom().Vincent Gross
Ok jca@ and reyk@
2015-10-19Remove the ikev1 stub - Since I started iked, it has an empty privsepReyk Floeter
process for ISAKMP+IKEv1. I kept it to let somebody either contribute the old protocol one day, I never intended to implement IKEv1 myself, or to add a new kind of pipe to isakmpd to hand off IKEv1 messages. As IKEv2 is widely supported by all major OS and networking vendors now, I'm happy to scrap the idea of supporting ISAKMP+IKEv1. It is still possible to use isakmpd for legacy VPNs. OK mikeb@
2015-10-15Remove some unnecessary NULL-checks before free(). Change two bzero()mmcc
calls on pf data to explicit_bzero(). ok mikeb@
2015-08-21Switch iked to C99-style fixed-width integer types.Reyk Floeter
OK mikeb@
2015-03-26initial support for RFC 7427 signatures, so we are no longerMarkus Friedl
restricted to SHA1 for RSA signatures. ok mikeb@
2015-02-15convert bcmp to memcmpTed Unangst
ok doug millert miod
2015-02-06unneeded getopt.hTheo de Raadt
2015-01-19Remove unnecessary <netinet/ip_ipsp.h> includesMike Belopuhov
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-11-07Repair initiator with PSK authMike Belopuhov
Attempt state transition to VALID (or EAP_VALID) in the ikev2_ike_auth after we have completed authentication synchronously (PSK) or asynchronously (X.509 and RSA) eliminating the need to do so in multiple places and restoring the correct order for PSK. ok markus
2014-08-25Delete secret or secret-derived data with explicit_bzero.Doug Hogan
concept ok deraadt@ diff looks ok tedu@
2014-05-07print msgid for debugging; ok reyk & mikebMarkus Friedl
2014-05-06initiate ike sa rekeying (ikesalifetime keyword), re-queue pfkeyMarkus Friedl
events while we are busy initiating child-SAs; ok mikeb@
2014-05-05the caller of ikev2_msg_retransmit_response already frees the sa; ok mikebMarkus Friedl
2014-04-29make sure the state machine only advances if the AUTH payload hasMarkus Friedl
been verified; with & ok mikeb@
2014-04-22Update iked to use the same proc.c that relayd uses.Reyk Floeter
Less differences, less code to audit. ok mikeb@
2014-04-10Add validation routines to ikev2_pld.c: For each payload type overallReyk Floeter
header structure is checked for sanity before copying the header. Always pass down the number of remaining bytes in the payload or substructure so we can always ensure to not go beyond actual data. Also remove the quick parsing step as it does not provide a real benefit anymore. From Hans-Joerg Hoexer ok mikeb@ markus@
2014-02-17Fix compiler warnings in the format strings: use %zd for ssize_t andReyk Floeter
%zu for size_t. From Andre de Oliveira With input and OK from blambert@ markus@
2014-01-24use a bit saner timer apiMike Belopuhov
2013-12-03never cast to sockaddr_storage, always cast to the abstract 'class' sockaddrMarkus Friedl
this fixes an out-of-bounds-memcpy in pfkey_process(); ok mikeb@
2013-09-26After some manipulations with the buffer, ike message header (hdr)Mike Belopuhov
might no longer point to the same memory as before. The bug was reported and fix was tested by LEVAI Daniel. Thanks!
2013-03-21remove excessive includesTheo de Raadt
2013-01-08Remove private CVS tag from an obsolete repository and bump copyrightReyk Floeter
to 2013 while I'm here... this is my way of saying "happy new year!".
2012-12-15Remove unused variables.Reyk Floeter
2012-10-22Fix NAT-T support in iked, both on the initiator and the responderReyk Floeter
side. Also add a new command line option -t to optionally enforce NAT-T with UDP encapsulation on port 4500. Tested by mikeb@ and me ok mikeb@
2012-09-18update email addresses to match reality.Reyk Floeter
sure jsg@ mikeb@
2012-06-27leftover code re-enqueued the same item on the list multiple timesMike Belopuhov
2012-06-27prevent an endless loopMike Belopuhov
2012-06-26improve ikev2_msg_retransmit_timeoutMike Belopuhov
2012-06-26compare exchange types as well when looking up a message;Mike Belopuhov
proceed with a response only when the appropriate request is found.
2012-06-22Add initial support for retransmition timeouts and response retries.Mike Belopuhov
This should still be considered an experimental work in progress.
2012-05-30pass a file descriptor in the msg_fd instead of a function argumentMike Belopuhov
2012-05-24don't increment the next expected message id when sending a response back.Mike Belopuhov
while it might look like a step backwards, this fixes up eap negotiation and bigger changes to this code are in the pipe anyways.
2012-05-07Sync up several defines with RFC 5996. IANA has changed the existingMike Belopuhov
IKEv2 Payload Type "Encrypted" (E) to "Encrypted and Authenticated" (SK).
2011-05-09rename functions in proc.c to proc_* and move some code from imsg_util.c toReyk Floeter
proc.c. this is the first sync to what i did for relayd but does not include the multi-instance handling - so no functional change.
2011-01-21handle empty encrypted payloads (might happen with some informationals)Reyk Floeter
ok mikeb@
2011-01-21Reimplement the iked(8) policy evaluation for incoming connections toReyk Floeter
use the last matching semantics of PF. The previous rbtree-based implementation was broken and tried to do a longest prefix match. But instead of prefix match and using radix-trees to fix it I decided with mikeb@ to implement it as last matching policy evaluation. The last matching policy wins; the "quick" keyword can enforce first matching; additional keywords like "skip" are specific to iked(8). See iked.conf(5) for more details. The implementation also uses skip steps based on PF's code. It significantly speeds up the evaluation of many policies but also adds a little delay when loading them (only noticeable with thousands of policies). This allows iked(8) to scale well with thousands of configured policies but I also liked the fact to have skip steps in another piece of code. ok dhartmei@ for using his skip step code under the ISC license in policy.c ok mikeb@, jmc@
2010-12-22child sa rekeying revamp plus numerous bugfixes;Mike Belopuhov
with suggestions and OK from reyk
2010-09-30disable padding correctly. therefore we no longer need to supplyMike Belopuhov
additional space in the buffer and just pad input length up to the block size. finalization is not needed for properly padded data. kills a bunch of XXX's and an annoying error from openssl. also, check a result from CipherUpdate while here. ok reyk
2010-06-27Instead of modifying and fiddling with the IKE SA in the payloadReyk Floeter
parsing routines directly, first parse the message and save the parsed elements in the temporary message struct before validating the information and taking any other actions on the actual SA. This needs more testing, but is the cleaner and better approach.
2010-06-14check if cert is available and validReyk Floeter
2010-06-14Initial support for initiator mode which allows to run iked as aReyk Floeter
"client" or to configure iked to iked (OpenBSD to OpenBSD) IKEv2 VPNs. It currently only supports psk (pre-shared keys) and no certificates, doesn't do any rekeying or SA timeouts, and needs more cleanup. So it is not quite production ready yet - but ready for simple tests...
2010-06-14restructure code a bit to move closer to initiator mode:Reyk Floeter
- split responder/initiator- specific code into different functions and use shared functions for common stuff. - first parse the received message and store information in the temporary message struct instead of modifying the ike sa in the parsing code directly.