summaryrefslogtreecommitdiff
path: root/sbin/iked
AgeCommit message (Collapse)Author
2019-07-03snprintf/vsnprintf return < 0 on error, rather than -1.Theo de Raadt
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-05-11Add support for IKEv2 Message Fragmentation as defined in RFC 7383.Patrick Wildt
ok sthen@
2019-05-10Set the IKED_REQ_INFORMATIONAL flag when sending a delete requestPatrick Wildt
during rekeying to make sure that the response is not rejected. From Tobias Heider "much more stable" dhill@
2019-05-10Enforce messages after IKE_SA_INIT exchange to contain onlyPatrick Wildt
encrypted payloads. Also increment message id only for valid messages. From Tobias Heider ok sthen@
2019-04-02When curve25519 was added to iked, it was based on the internet-draft andStuart Henderson
used a private-use group number. Switch to the group number assigned in RFC8031 as used in other implementations. "this is the right time" deraadt@ "I like the idea" reyk@ If you use iked<>iked and have configured curve25519 in iked.conf (this is not the default), you can switch to another PFS group before updating then switch back. OpenBSD 6.3+ allows multiple "ikesa" lines so the initiator can choose which to use.
2019-02-27update RFC references, from tobias_heider at genua.de, ok claudio@Stuart Henderson
2019-02-26Fix sending IKEV2_CFG_INTERNAL_IP6_DNS, IKEV2_CFG_INTERNAL_IP6_NBNS,Patrick Wildt
IKEV2_CFG_INTERNAL_IP6_DHCP and IKEV2_CFG_INTERNAL_IP6_SERVER by using the correct member in the iked_addr struct for the address. From Aram Havarnean
2019-02-13(unsigned) means (unsigned int) which on ptrdiff_t or size_t or otherTheo de Raadt
larger types really is a range reduction... Almost any cast to (unsigned) is a bug. ok millert tb benno
2018-12-07Make sure the TAP extension is only added to the vector when needed.Martin Pieuchot
Fix a problem reported by Mark Patruck and dhill@ ok markus@, dhill@
2018-12-07Make sure that the prefixlen returned by mask2prefixlen6 is never biggerClaudio Jeker
than 128 also fail hard when the mask is non contiguous. OK remi@
2018-11-07sync cmdline_symset() changes with src/usr.sbin; OK sashan@ claudio@miko
2018-11-01- odd condition/test in PF lexerAlexandr Nedvedicky
(and other lexers too) This commit rectifies earlier change: in the lex... even inside quotes, a \ followed by space or tab should expand to space or tab, and a \ followed by newline should be ignored (as a line continuation). compatible with the needs of hoststated (which has the most strict quoted string requirements), and ifstated (where one commonly does line continuations in strings). OK deraadt@, OK millert@
2018-08-06Remove cpath pledge(2) promise. We decided that not deleting the unix controlRicardo Mestre
sockets cause no harm and this way we close another attack surface by not allowing the daemon to create/delete any more files. OK kn@
2018-07-11Do for most running out of memory err() what was done for most runningKenneth R Westerback
out of memory log_warn(). i.e. ("%s", __func__) instead of manual function names and redundant verbiage about which wrapper detected the out of memory condition. ok henning@
2018-07-09No need to mention which memory allocation entry point failed (malloc,Kenneth R Westerback
calloc or strdup), we just need to log that we ran out of memory in a particular function. Recommended by florian@ and deraadt@ ok benno@ henning@ tb@
2018-07-08Be consistent in warn() and log_warn() usage whenKenneth R Westerback
running out of memory. Next step, be correct *and* consistent. ok dennis@ tb@ benno@ schwarze@
2018-07-03Rephrase a misleading sentence in iked(8), and add a missingStefan Sperling
reference to RFC 7359. Patch by David Dahlberg
2018-06-22Use __func__ in log_debug calls.rob
Ok gsoares@
2018-06-11Fix an off-by-one line count when using include statements.denis
Thanks to otto@ for the initial diff. OK benno@
2018-04-26Plug leak in error case of the common 'varset' implementations.Kenneth R Westerback
ok benno@
2018-03-22The iked(8) fuzzer did not fuzz encrypted payloads. With that changedPatrick Wildt
the regression test uncovered code paths in the TS and CP payload parser that can trigger access to invalid memory locations. This changes the TS and CP payload parsing to add additional length checks. With hshoexer@ and markus@; OK sthen@
2018-03-16Consistently spell "IPsec" in comments and debug outputs.Martin Pieuchot
From Raf Czlonka, ok sthen@
2018-03-05Outsource enabling/disabling the DPD and keepalive timers for SAs intoPatrick Wildt
their own functions. Makes it easier to extend with other timers that work on established SAs and re-use the functionality in other places. Also delete the timer before adding to fix a warning on config reload in certain circumstances. ok sthen@
2018-01-31Add support for specifying multiple transforms within a single proposal.Patrick Wildt
This gives us more flexibilty for negotiating with other IKEv2 setups. Tested by and ok sthen@
2018-01-24Implement support for specifying multiple proposals. This means we canPatrick Wildt
have a higher flexibility in negotiating with other peers, or even ease migration from one proposal to a more secure one. ok sthen@
2017-12-23Since ikev2_init_recv() is supposed to only handle responses to anPatrick Wildt
exchange that we initiatiated, we are not allowed to respond to such a msg. Also we don't need the DH check in ikev2_sa_initiator_dh() as it's only called when we initiate, so the check would not run, or when we get a Create Child SA response, where an error should only lead to us having another attempt at an exchange. Found by and ok markus@
2017-12-13getsockname(2) needs to be passed the length of the input struct.Patrick Wildt
ok jca@
2017-12-07Change the SA payload parser to parse more than the first proposal. ThisPatrick Wildt
allows us to select one of the peer's proposals (and not only the first). ok sthen@ hshoexer@
2017-12-05When sending out a proposal we create an SA/SPI for the Child SAs if wePatrick Wildt
are an initiator and store the information on the proposal, because we only had one proposal so far. This changes the code to only create one SA on the first proposal and then apply the SPI to all other proposals as well. ok markus@
2017-12-04Remove duplicate check that never could execute because the exact samePatrick Wildt
condition is handled a line before.
2017-12-04Consistently log "malformed payload" instead of "payload malformed", andPatrick Wildt
replace "minimal" with "minimum".
2017-12-04Remove check that is now a duplicate due to recent refactoring.Patrick Wildt
2017-12-04The payloads are layered like onions, so you can validate one layer andPatrick Wildt
then call the next one, which can then validate itself. Thing is, most layers try to run validations on the upper layer, which is not useful and rather confusing. This cleans it up. First change is that the generic payload parser does not anymore pass the length of the whole datagram, including all remaining payloads, but passes only the length of the specific payload to the specific payload parser. Second change is that the payload validators don't check the length of the upper layer, but only verify their own lengths. Diff discussed with hshoexer@ and sthen@ Tested by sthen@
2017-12-04Initialize variable, otherwise the pointer might contain stack garbage.Patrick Wildt
2017-12-03If we wanted to send out more proposals than just one, we need to set aPatrick Wildt
flag in the SA header that there is another proposal coming. The "more" attribute borrows its values, as specified in the RFC, from IKEv1. ok sthen@
2017-12-03The RFC specifies that to accept a proposal, we must select a transformPatrick Wildt
for each transform type. We do some sanity checks, for instance we do require an encryption transform for ESP, but that's not enough. We need to check that for every proposed transform type we have found a matching transform in our own proposal. ok sthen@
2017-12-01The RFC specifies that in an SA payload the proposals must be numberedPatrick Wildt
starting with number 1. Subsequent proposals must be one more than the previous proposal. ok sthen@
2017-12-01Turns out that, as specified in the RFC, the initial Child SA does notPatrick Wildt
do PFS and is assumed to be secured using the DH exchange in the first handshake. Thus there is no KE/N payload in the IKE_AUTH exchange and we must not include a DH group other than None, which essentially means we must not supply any DH transforms in the IKE_AUTH messages. So now we skip adding the DH transforms for initiating and responding to IKE_AUTH messages. ok sthen@
2017-11-30Add support for rejecting IKE SA messages. This means that we can replyPatrick Wildt
to IKE SA INIT messages with no proposal chosen, as we already do for Child SAs. For that the error "adding" is done in a new function shared by both send error handlers. We need two "send error" functions because the init error is unencrypted, while all later ones are not. Now we can add more cases, like Child SA not found or that the DH group is not what we expect. Save the IKE SA INIT responses, even if it's an error message, so we can retransmit it if the response is lost on the way back to the initiator and he tries again. This also helps mitigate DoS attacks as specified in the RFC. Only if it is indeed a new attempt, like after an INVALID KE PAYLOAD response, we can drop the old SA so that iked(8) can attempt to create a new SA. ok sthen@
2017-11-29Print_host is used mainly in printf style functions. So do not return NULLClaudio Jeker
instead return "unknown". OK beck@
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-11-15Reset the OCSP URL on config reload. Otherwise we end up not beingPatrick Wildt
able to disable OCSP without restarting iked. ok beck@ sthen@
2017-11-08Do not accept superfluous arguments.Patrick Wildt
From Klemens Nanni. ok markus@
2017-11-08For IPcomp we need to load explicit ESP-flows for the IPIP or IPCOMPPatrick Wildt
tunneled packets, otherwise every packet between the gateways will be sent into the tunnel (e.g. ICMP, too). ok markus@
2017-10-30In the subjectAltName comparison, the bzero before the while-loop wasPatrick Wildt
lost while applying the diff. This is means sanid could be passed uninitialized to ca_x509_subjectaltname_cmp(), where ibuf_release() could try to release a pointer which is essentially stack garbage. While there I realized that the bzero() in the loop is essentially fatal, since every mismatch leads to a silent leak of ibufs. Since ca_x509_subjectaltname_cmp() releases and initializes the passed iked_id, we can safely call it multiple times after initializing sanid once before the loop. ok markus@
2017-10-27Support multiple subjectAltNames by trying each existing until therePatrick Wildt
is none or until we find one that matches. ok markus@
2017-10-27In the final RFC 5903 the computation for the DH shared secret changed.Patrick Wildt
Instead of the full point, only the X point is included. Unfortunately this is a backwards incompatible change, so older ikeds won't be com- patible with this change. Of course only if you use ECP. Anyway, this change makes us follow the RFC correctly. ok markus@
2017-08-28fix char ** to const char ** conversion warning; ok mikeb@Otto Moerbeek
2017-07-19more depends gc / yacc rules overhaulMarc Espie
okay millert@