summaryrefslogtreecommitdiff
path: root/sbin/iked
AgeCommit message (Collapse)Author
2023-11-10Always prefer group from initial KE payload as responder if supported.Tobias Heider
from markus@
2023-09-02Make sure cert_type is not 0 to prevent leak of certid->id_buf.Tobias Heider
Found by David Linder ok patrick@
2023-09-02Remove unneccessary id == NULL check after dereferencing it. id can neverTobias Heider
be NULL here. Found by tb@
2023-08-14Improve error message when if_indextoname() fails.Tobias Heider
2023-08-14Add explicit NULL checks for sa_cp_addr and sa_cp_addr6.Tobias Heider
2023-08-11Add iked support for route based sec(4) tunnels.Tobias Heider
To use sec(4) instead of policy based tunnels, create a sec(4) interface and add 'iface secXX' to your policy config. sec(4) interfaces also support auto configuration for dynamic client IPs via 'request any' like all other interfaces. The config won't work without traffic selectors, 'from any to any' should work for now but I plan to make this optional in the future. ok dlg@
2023-08-04Convert calls to ibuf_length() where it is clear that the ibuf is notClaudio Jeker
NULL to ibuf_size(). In some cases it is clear that the ibuf pointer should just be checked for NULL since afterwards a new ibuf is allocated in its place. OK tb@
2023-07-28Implement print_hexbuf() to hexdump the contents of an ibuf.Claudio Jeker
OK tb@
2023-07-28Use ibuf_data() instead of accessing the ibuf buf pointer directly.Claudio Jeker
Also convert some ibuf_add(() calls to ibuf_add_buf() where appropriate. OK tobhe@ tb@
2023-07-18Kill ibuf_cat() since there is now ibuf_add_buf() in the official API.Claudio Jeker
OK tb@ tobhe@
2023-07-16Merge ibuf_get() with ibuf_getdata() and rename it to ibuf_getdata().Claudio Jeker
Also replace a ibuf_reserve() call with ibuf_add_zero() and remove a buf->buf == NULL check in ibuf_length() since it is not necessary. OK tobhe@ tb@
2023-06-28Add support to verify X509 chain from CERT payloads.Tobias Heider
Encode cert and intermediate CAs in new cert bundle object, so the information can be passed to the ca process in one step. Pass untrusted intermediates to X509_verify_cert(). From markus@
2023-06-28Don't call daemon() after proc_init(), otherwise the child processesGerhard Roth
would lose their parent. ok tobhe@
2023-06-25remove ca_sslinit()Omar Polo
it's a noop; nowadays both LibreSSL and OpenSSL libcrypto and libssl initialize themselves automatically before doing anything. spotted by tb, ok tb tobhe
2023-06-19Improve the ibuf API by adding these functions:Claudio Jeker
Functions extending ibuf_add to work with more specific data types ibuf_add_buf, ibuf_add_zero, ibuf_add_n8, ibuf_add_n16, ibuf_add_n32, ibuf_add_n64 Functions replacing ibuf_seek where data at a specific offset is modified ibuf_set, ibuf_set_n8, ibuf_set_n16, ibuf_set_n32, ibuf_set_n64 Functions to check, get and set the filedescriptor stored on the ibuf ibuf_fd_avail, ibuf_fd_get, ibuf_fd_set and ibuf_data() to access the data buffer, to be used together with ibuf_size() On top of this add an optimized imsg_compose_ibuf() where an ibuf is wrapped into an imsg in an efficent way. Finally remove msgbuf_drain since it is not used by anything outside of the ibuf code. Because of this removal bump the major of libutil. Remove ibuf_data() in iked since the same function is now provided by libutil. OK tb@
2023-06-17Fix leak of key.id_buf in pubkey auth case.Tobias Heider
from markus
2023-06-16Now that print_host() is unused, rename it to print_addr() and simplify.Theo Buehler
ok claudio tobhe
2023-06-14Replace the last few print_host() calls with print_addr() ones.Claudio Jeker
In most cases print_host(addr, buf, buflen) can be replaced with strlcpy(buf, print_addr(addr), buflen). Some code was never fully adjusted to the full power of print_host() and there are remnants of times well before print_host() supported multiple internal buffers. With and OK tb@
2023-06-13iked: introduce and use print_addr()Theo Buehler
The vast majority of print_host() callers cast the first argument (usually a sockaddr_storage *) to (struct sockaddr *) and pass both a NULL buffer and 0 length. Cast and useless arguments lead to awkward line wrapping in many places. Clean this up by introducing a helper. Make this helper take a void pointer, so all casts go away. ok claudio kn tobhe
2023-06-13Fix FILE leak in error path.Claudio Jeker
If flowf is NULL then fclose(spif) must be called. Split up the error check from if (spif == NULL || flowf == NULL) to individual checks since that is easier to read. Noticed by markus@, OK tb@
2023-06-12Use stdio open_memstream(3) to build up log strings instead of trying toClaudio Jeker
abuse ibufs for that. Using stdio for this has the benefit of using any stdio function to build up strings including fprintf(). With and OK tb@
2023-06-06Use same pattern to work with offset by using a uint8_t pointer thatClaudio Jeker
is loaded with ibuf_data(). This is by no means better but allows to switch ibuf_data() to return void *. OK tb@
2023-06-06Use ibuf_seek() instead of ibuf_data() + offset constructs. Effect isClaudio Jeker
the same in these cases. OK tb@
2023-05-30Replace the one use of ibuf_prepend() using a similar ibuf_new() + ibuf_cat()Claudio Jeker
method but instead of overwriting ibuf internals replace the buf a level up. Users of ikev2_msg_send() are not allowed to hold and reuse a pointer to msg_data (which is another footgun to disarm at some point). OK tb@
2023-05-23Replace ibuf_advance() with ibuf_reserve().Claudio Jeker
OK tobhe@ tb@ kn@
2023-05-23Replace ibuf_release() with ibuf_free() since the former just calls the latterClaudio Jeker
OK kn@ tb@
2023-05-23There is no need to ibuf_zero() or memset() any buffers.Claudio Jeker
More cleanup will follow. OK tobhe@
2023-04-19remove duplicate includesJonathan Gray
2023-03-30i2d_ECDSA_SIG() may return a negative value in case of error.Alexander Bluhm
Do no use this as length in iked(8) _dsa_verify_prepare(). OK tobhe@ tb@
2023-03-10Fix possible leak of spibuf and flowbuf in error case.Tobias Heider
ok patrick@ bluhm@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2023-03-05Fix clean process shutdown by storing env globally like vmd and httpd doTobias Heider
instead of getting it from p_ps. The old approach does not work anymore after the recent fork + exec update. ok patrick@
2023-03-04Sync proc.c from vmd(8) to enabled fork + exec for all processes. This givesTobias Heider
each process a fresh and unique address space to further improve randomization of ASLR and stack protector. ok bluhm@ patrick@
2023-02-15proc_ispeer() is not used anywhere anymore so remove it everywhere.Tobias Heider
ok florian@ bluhm@ ok for vmd mlarkin@
2023-02-10Add support for configuring multiple name servers as roadwarriorTobias Heider
client. This allows us to have a fallback in case one connection fails. Tested by Ryan Kavanagh ok patrick@
2023-02-08iked: remove another unused variableTheo Buehler
It is not entirely obvious if some logic was forgotten or if that variable was added for debug logging or... Be that as it may, as tobhe points out, this variable has been unused since the initial import of iked. The logic seems sound without it, so it has never served a purpose and can go. ok tobhe
2023-02-08iked: garbage collect an unused counter variable to make clang 15 happierTheo Buehler
ok tobhe
2022-12-06Print size_t with %zu.Tobias Heider
ok patrick@
2022-12-04Rename sun to s_un for portability.Tobias Heider
ok patrick@
2022-12-03Consistently use uintXX_t from <stdint.h> instead of u_intXX_t.Tobias Heider
2022-12-03Include endian.h where needed for betohXX functions.Tobias Heider
2022-11-30Switch idiom of d2i_ECDSA_SIG() invocationTheo Buehler
Instead of the discouraged obj = NULL; d2i_ECDSA_SIG(&obj, ...); use the recommended obj = d2i_ECDSA_SIG(NULL, ...);. While it makes no difference here, it's better practice. suggested by & ok markus
2022-11-26Bump to 7.2Tobias Heider
2022-11-18Revert my last two changes.Moritz Buhl
If csa_bundled is set, exactly two csas exist and they point to each other. Therefore childsa_free already sets the bundled csa pointer to NULL and it shouldn't be done after calling childsa_free. ok tobhe@
2022-11-13Make sure csa->csa_bundled is NULL after freeing to prevent aMoritz Buhl
possible use after free. ok tobhe@
2022-11-11Make sure csa->csa_bundled is NULL after freeing to prevent aMoritz Buhl
possible use after free. ok tobhe@
2022-11-11In case of an invalid SA resp is passed to ikev2_msg_cleanup withoutMoritz Buhl
initialization where the msg_parent field is accessed. ok tobhe
2022-11-07Free objects that were dynamically allocated in libcrypto with OPENSSL_free().Tobias Heider
When linking against libressl, OPENSSL_malloc() is just a wrapper around malloc() so regular free() is safe. Other implementations allow switching to a different allocator where free() could result in a possible heap corruption. Report and initial fix by dropk1ck (gh #92) ok tb@
2022-11-06Fix out-of-order string operations resulting in a wrongly calculatedTobias Heider
string size that could lead to a buffer overflow in ikev2_print_id(). Found by and fix from dropk1ck on github (issue #90) ok patrick@ mbuhl@
2022-10-24Fix DH group lookup when checking if PFS is required. Compare IDTobias Heider
directly instead of calling group_get() and leaking the result. ok markus@