Commit Graph

31179 Commits

Author SHA1 Message Date
oysteikt f8cc75b9c6 Set up nix tooling 2026-07-22 15:26:22 +09:00
oysteikt 69e74be224 kadmind: add support for systemd socket activation
Adds support for systemd's fd-passing socket activation, letting systemd
listen for connections before starting the service. This might enable
quicker startup on systems with dependent services, since they will now
only need to wait for the socket, which holds connections until kdc is
finished starting up. It also enables use of the `PrivateNetwork`
directive, sandboxing kadmind into it's own network namespace.
2026-07-22 15:14:09 +09:00
oysteikt f6ec5e5f9a kpasswd: add support for systemd socket activation
Adds support for systemd's fd-passing socket activation, letting systemd
listen for connections before starting the service. This might enable
quicker startup on systems with dependent services, since they will now
only need to wait for the socket, which holds connections until kdc is
finished starting up. It also enables use of the `PrivateNetwork`
directive, sandboxing kpasswd into it's own network namespace.
2026-07-22 15:14:09 +09:00
oysteikt 049748c182 kdc: add support for systemd socket activation
Adds support for systemd's fd-passing socket activation, letting systemd
listen for connections before starting the service. This might enable
quicker startup on systems with dependent services, since they will now
only need to wait for the socket, which holds connections until kdc is
finished starting up. It also enables use of the `PrivateNetwork`
directive, sandboxing KDC into it's own network namespace.
2026-07-22 15:14:08 +09:00
oysteikt 85b816b5bc kadmind: add sd_notify start/stop signals
This commit adds optional integration with systemd's state
notifification system.

When built with libsystemd, kadmind notifies systemd once it is
ready to serve and when it begins a clean shutdown, as well as
publishing a status line reporting the number of accepted connections.
2026-07-22 15:10:16 +09:00
oysteikt b795025613 kpasswd: add sd_notify start/stop signals
This commit adds optional integration with systemd's state
notifification system.

When built with libsystemd, kpasswdd notifies systemd once it is
ready to serve and when it begins a clean shutdown, as well as
publishing a status line reporting how many password change requests
have been processed.
2026-07-22 15:10:15 +09:00
oysteikt 4cba7c91d1 kdc: add sd_notify start/stop signals
This commit adds optional integration with systemd's state
notifification system.

When built with libsystemd, the KDC notifies systemd once it is
ready to serve and when it begins a clean shutdown, as well as
publishing a status line reporting how many worker processes are
running.
2026-07-22 15:10:15 +09:00
Roland C. Dowdeswell 6bb4ff842d lib/roken: fix hex digit table initializer 2026-07-06 09:06:35 -05:00
Daniil Sarafannikov 5b90bc8285 roken:strsep_copy: Fix out-of-bounds write in strsep_copy
In case len < (size_t)(*stringp - save) and len > 0
access to buf[l] leads to out-of-bounds write as
l = len and len means the length of buffer.

Change evaluation of l: only len - 1 elements of
buffer can be used for memcpy and terminator
should be written to buf[len - 1] (in case l = len - 1).
Also, this value of l is not used when len == 0,
so we calculate it only when len > 0.

Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Daniil Sarafannikov <sarafannikovda@sgu.ru>
2026-06-30 10:19:03 +01:00
Nicolas Williams 22e73b6fcb Better fix for #1399 2026-06-30 10:16:16 +01:00
Linar Galimov ac1c2d05bc krb5: Fix a double free when running into ENOMEM
In cred_delete(), sp is freed after returning from krb5_storage_to_data().
Between this point and the subsequent assignment to sp via krb_storage_emem()
there are two jumps to out, both are executed in an ENOMEM scenario: malloc fail
for cred_data_in_file and krb5_principal_set_realm() fail. In out, sp is freed
again.

This patch fixes the issue by freeing sp right before the krb5_storage_emem()
call.

Signed-off-by: Linar Galimov <galimovlz@sgu.ru>
Signed-off-by: Dmitry Mikhalchenko <tascad@altlinux.org>
2026-06-23 15:34:32 +01:00
Roland C. Dowdeswell 37f93f85dd gss-token: add local user authorization check 2026-06-22 18:43:44 +01:00
Daniil Sarafannikov 6386d8ff82 kdc: Fix possible double free of ac pointer
This fixes possible double free of ac pointer. In the function
'krb5_auth_con_free' pointer ac (auth_context) is freed. In case
'ac != NULL', 'ac != tgs_ac', 'ac->remote_subkey == NULL' this
function is called twice (when logging "FAST AP-REQ remote subkey
missing" and at label 'out').

Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Daniil Sarafannikov <sarafannikovda@sgu.ru>
2026-06-19 13:00:22 -05:00
mikhailofff afc4c486a1 lib/asn1: fix USE_AFTER_FREE in der_print_hex_heim_integer
Set *p to NULL on asprintf failure to prevent a dangling pointer
and subsequent USE_AFTER_FREE when the caller ignores ENOMEM.

Pair-Programmed-With: Dmitry Mikhalchenko <tascad@altlinux.org>
Signed-off-by: Egor Mikhailov <mikhailovev@sgu.ru>
2026-06-18 17:23:24 -05:00
Roland C. Dowdeswell 9df6b9e13a GHA: add Debian i386 build 2026-06-16 11:02:29 -05:00
Roland C. Dowdeswell 13d0215c54 configure: pass year2038 flags in CPPFLAGS 2026-06-16 11:02:29 -05:00
Roland C. Dowdeswell 759f9f228b NEWS: mention 32-bit time_t ASN.1 clamp 2026-06-16 11:02:29 -05:00
Roland C. Dowdeswell 5ac91f2dc9 hx509: preserve received certificate encodings
Keep the original DER encoding around when decoding certificates so hx509_cert_binary() does not rewrite certificates unnecessarily.

Add regression coverage for direct certificate binary output and keyless stores.
2026-06-16 11:02:29 -05:00
Roland C. Dowdeswell d67a2c36c4 tests: avoid ephemeral port range
On our MacOS X CI job, provjobd2 sometimes held local TCP port 49195,
colliding with check-iprop.  And so we move all listening ports in the
test setup out of the ephemeral port ranges on Linux and Mac.
2026-06-16 09:46:42 -05:00
Roland C. Dowdeswell 9cf1b20313 asn1: clamp far-future times on 32-bit time_t
Compute DER generalized time conversion in uint64_t and clamp to the
local time_t range before returning.  This avoids wrapping far-future
ASN.1 times on 32-bit time_t platforms.  We do not address time_t
being a non-integral type.
2026-06-15 14:09:41 -05:00
Roland C. Dowdeswell 97b07c5632 krb5: skip vanished keyring ccache keys 2026-06-10 17:26:54 -05:00
Roland C. Dowdeswell 8a0fc8d032 Add credential cache coverage tests 2026-06-10 17:26:54 -05:00
Roland C. Dowdeswell 34ab0b7c77 asn1: fix open type alignment on ILP32
Do not assume that the open-type payload needs 8-byte alignment.
Align to pointer size instead, which avoids reading the wrong location
on ILP32 layouts.
2026-06-10 10:38:43 -05:00
Roland C. Dowdeswell 9bb80f4747 hx509: choose certificate time encoding portably
Select UTCTime versus GeneralizedTime with a helper that only performs
the 2050 comparison when the local time_t range can represent that value.
This avoids ILP32 type-limit problems while preserving GeneralizedTime
output on 64-bit and unsigned 32-bit time_t platforms.
2026-06-10 09:59:13 -05:00
Roland C. Dowdeswell 5ebe5b4582 asn1: compare int32 default values safely
Move the int32 ptr comparison into a helper that first checks
whether the encoded pointer-sized default is representable as int32_t.
This avoids ILP32 type-limit warnings.
2026-06-10 09:57:03 -05:00
Roland C. Dowdeswell f609aae209 krb5: avoid time-difference overflow
Use krb5_time_abs() rather than subtracting time_t values before passing the result to labs().  On signed 32-bit time_t platforms, subtracting far-apart times can overflow before labs() sees the value.
2026-06-10 09:39:19 -05:00
Nicolas Williams fdeb3e6e4e Revert "README.md: Drop Coveralls badge (not updating)"
This reverts commit 2b2c71a7c1 as Coveralls
should now update.
2026-06-08 13:40:12 -05:00
Nicolas Williams 16a8e31d34 GHA: Build coverage for master branch too 2026-06-08 13:40:12 -05:00
Roland C. Dowdeswell cdc82913d5 kdc: typos in MAX_TIME macros 2026-06-08 11:38:31 -05:00
Pino Toscano 2194be6c92 asn1: Include <errno.h> before using/checking bits from it
Commit 232c936ea3 added a fallback ENOTSUP
definition. The check itself and the fallback definition rely on
<errno.h> to be included already, so in case it was not (depending on
the platform) then there will be a wrong definition of ENOTSUP.

Instead of rely on <errno.h> to be included before including a
generated header from this tool, include it manually. This way both
the ENOTSUP check and its fallback definition (if ever) will always
work.
2026-06-06 23:54:47 +01:00
Ihar Hrachyshka 2594691dfd Define HAVE_DB_185_H if db_185.h is present 2026-06-06 23:46:07 +01:00
Roland C. Dowdeswell a735b65b70 gssapi: avoid putenv use-after-free in store_cred
Fixes #1163
2026-06-06 23:38:21 +01:00
Roy Marples 1f0f31c954 roken: Don't define any global vars in the pidfile namespace.
Newer util.h from NetBSD defines pidfile_path() which conflicts
here.
2026-05-30 12:06:31 -05:00
Roland C. Dowdeswell e1ab030717 kdc: reject kx509 requests when disabled
Fixes #1378.
2026-05-28 21:30:06 -05:00
Roland C. Dowdeswell 421c40c73e kadm5: make ipropd-master listen on IPv6
Fixes #1330.
2026-05-27 14:11:04 -05:00
Roland C. Dowdeswell de7aa57362 treewide: fix many null dereference reports
Add defensive handling for several NULL allocation and formatting paths reported across issues #820-#829.

Fixes #820, fixes #821, fixes #822, fixes #823, fixes #825, fixes #828
2026-05-27 13:47:41 -05:00
Roland C. Dowdeswell 9a9da70626 krb5: clean up get_cred_kdc on send context failure
Fixes #1207
2026-05-27 12:12:03 -05:00
Roland C. Dowdeswell e3a59b65d3 kadmin: generate stronger random passwords
Generate 12 random bytes and encode them with Heimdal base64url, producing
16-character random passwords with 96 bits of entropy.

This avoids punctuation and quoting issues while still raising generated
password entropy substantially from the old roughly 55-bit generator.

Fixes #1145
2026-05-27 12:06:14 -05:00
Roland C. Dowdeswell 98d6fcacb4 krb5: fix ap_req_nofail documentation
Fixes #1371
2026-05-27 11:56:23 -05:00
Roland C. Dowdeswell 4f147f5e1b doc: trim krb5_verify_user xrefs
Fixes #1127
2026-05-27 16:01:16 +01:00
Roland C. Dowdeswell ef3860d6c3 doc: clean up krb5_init_context man page
Fixes #1125
2026-05-27 15:42:57 +01:00
Alexey Shapovalov 20d4e914e3 gss: Fix NULL minor_status arguments 2026-05-27 14:30:27 +01:00
Florian Best cdd22b6061 refactor(changepw): replace select() with poll()
Issue #1338
2026-05-27 14:16:23 +01:00
Florian Best 73acb1df8e refactor(send_to_kdc): replace select() with poll()
Issue #1338
2026-05-27 14:16:23 +01:00
Roland C. Dowdeswell abec12ef7f ipropd-slave: get a TGT before authenticating
Do not request an iprop/<master> initial ticket directly. With
name_canon_rules = as-is: this can leave the acquired credential
mismatched with what krb5_sendauth() later asks for. Get a normal TGT
and let sendauth acquire the service ticket.

Fixes #1332.
2026-05-26 17:20:15 -05:00
Roland C. Dowdeswell 2e3bb95430 Add KDC-free GSS tests 2026-05-25 20:18:06 -05:00
Roland C. Dowdeswell a66cb84e70 In krb5.conf make underscores and dashes equivalent 2026-05-25 20:14:36 -05:00
Roland C. Dowdeswell e89417f2a1 tests: cover MEMORY ccache cursor invalidation for #547 2026-05-25 20:09:20 -05:00
Roland C. Dowdeswell a105e8e117 tests: cover MEMORY gss_store_cred storage for #132 2026-05-25 20:01:05 -05:00
Roland C. Dowdeswell 56b55e7c9b add CI/CD for libedit and readline 2026-05-25 20:00:24 -05:00