Commit Graph

947 Commits

Author SHA1 Message Date
Jeffrey Altman
fb52fd1c53 kadmin: kadmind_dispatch do not write to 'out' on error
1b213c1082 ("kadmind: Add missing
error checks") altered the behavior of kadmin_dispatch() such that
it unconditionally called

  krb5_storage_to_data(rsp, out);

Previously kadmin_dispatch() only wrote to 'out' on success.
Doing so is important because 'rsp' might be NULL on error.

Change-Id: I2688a5c47db0f94d955971e785037c578d3f3fa4
2022-01-21 00:25:15 -05:00
Jeffrey Altman
4ffd190b08 kadmin: kadmind_dispatch fix handling of HEIM_ERR_EOF error
1b213c1082 ("kadmind: Add missing
error checks") altered the scope of the

   if (ret == HEIM_ERR_EOF)
      ret = 0;

treatment of HEIM_ERR_EOF as a success code.  Prior to that
commit HEIM_ERR_EOF meant success only when reading the 'keepold'
value.  It indicated a premature failure if returned when reading
'princ' or 'n_key_data'.

This change corrects the scope of HEIM_ERR_EOF indicating success.

Change-Id: If5463b47dc3eabee6fa2f8e717147f02adc1586c
2022-01-20 23:43:06 -05:00
Nicolas Williams
1b213c1082 kadmind: Add missing error checks 2022-01-19 16:33:37 -06:00
Nicolas Williams
abb9a46ccc kadmin: Add missing error check in init() 2022-01-18 15:41:43 -06:00
Jeffrey Altman
51575264d4 kadmin: read_words pass correct type to sizeof
(char *) not (char **).

Change-Id: I2c34fa5b0ea9f81b08451ed1b4a816684b7ab638
2022-01-17 22:36:29 -05:00
Nicolas Williams
0f843189a4 kadmin: Check for errors in init 2022-01-17 00:45:37 -06:00
Jeffrey Altman
63f9fc172c kadmin: kadmind_dispatch free 'ks_tuple' before overwriting
Change-Id: I8719c610a34ca128cc8a0b3d7f94dafc26b21e01
2022-01-17 00:16:27 -05:00
Nicolas Williams
d974c37a90 kadmin: Remove dead code in add_one_namespace() 2022-01-16 23:08:32 -06:00
Jeffrey Altman
231aa68895 kadmin: add_one_namespace do not leak princ_ent
princ_ent must be saved to princ.principal early in order to
ensure that it is not leaked.

Change-Id: Ic74b48f434c727401c00e6fdcaecead988fe4263
2022-01-16 23:42:21 -05:00
Jeffrey Altman
54adba6023 kadmin: format_field KRB5_TL_ETYPES do not leak enctype string
Change-Id: I745216c334c038f55711c27f7885d8f96f656e79
2022-01-16 23:32:10 -05:00
Jeffrey Altman
f341fa7721 prevent unintended sign extension errors
When an unsigned char is shifted << 24 bits its type will be
promoted to signed 32-bits.   If the value is then assigned to
an unsigned 64-bit value sign extension will occur.

Prevent the unwanted sign extension by explicitly casting the
value to unsigned long before shifting.

Change-Id: Iabeac0f17dc3229a2dc89abe71960a8ffbf523f8
2022-01-16 00:23:05 -05:00
Jeffrey Altman
a84186653c kadmin: list_princs zero get_opt structure before use
Not all fields are assigned to.  Initialize the structure
to zero before use.

Change-Id: I2cfc60baaf8bf80389950a373c2a82f600a71aa2
2022-01-15 22:28:42 -05:00
Luke Howard
0e8c4ccc6e hdb: eliminate hdb_entry_ex
Remove hdb_entry_ex and revert to the original design of hdb_entry (except with
an additional context member in hdb_entry which is managed by the free_entry
method in HDB).
2022-01-15 18:54:57 +11:00
Luke Howard
c5551775e2 hdb: decorate HDB_entry with context member
Decorate HDB_entry with context and move free_entry callback into HDB structure
itself. Requires updating hdb_free_entry() signature to include HDB parameter.
A follow-up commit will consolidate hdb_entry_ex (which has a single hdb_entry
member) into hdb_entry.
2022-01-15 18:54:57 +11:00
Nicolas Williams
fc964cd545 klist: Fix warnings 2022-01-14 17:59:49 -06:00
Nicolas Williams
c607135a03 Use fallthrough statement attribute (moar) 2022-01-14 16:53:34 -06:00
Nicolas Williams
ddc6113610 Use fallthrough statement attribute 2022-01-14 16:32:58 -06:00
Nicolas Williams
b7bf5ca6e8 kadmin: Fix warnings 2022-01-14 14:59:02 -06:00
Nicolas Williams
d833ce4cbc hdb: Namespace referrals
Add a new method for issuing referrals for entire namespaces of hostnames.

An alias of the form WELLKNOWN/HOSTBASED-NAMESPACE/service/namespace-fqdn@REALM
will cause all requests for host-based principals in the given namespace to be
referred to the given realm.
2022-01-02 21:40:17 +11:00
Luke Howard
0165633964 hdb: add no-auth-data-reqd flag to HDB entry
Add a new flag, no-auth-data-reqd, to the HDB entry which indicates that a PAC
should not be included on issued service tickets.
2021-12-23 13:52:12 +11:00
Nicolas Williams
2a9b57cdad kadmin: Add command aliases to man page 2021-10-30 15:21:54 -05:00
Nicolas Williams
ba98690a0a kadmin: Add add_alias, del_alias 2021-10-11 13:58:15 -05:00
Luke Howard
49f3f5bd99 kdc: support for GSS-API pre-authentication
Add support for GSS-API pre-authentication to the KDC, using a simplified
variation of draft-perez-krb-wg-gss-preauth-02 that encodes GSS-API context
tokens directly in PADATA, and uses FX-COOKIE for state management.

More information on the protocol and implementation may be found in
lib/gssapi/preauth/README.md.
2021-08-12 17:37:01 +10:00
Nicolas Williams
8ac3452fd7 kadmin: Add missing attributes; sort units
Sorting the units fixes a bug introduced in:

    ae8908bf8 kadmin: Add disallow-client attribute

that I had fixed via:

    f6ac4ee86 roken: Fix parse flags bug

which wasn't a bug at all.
2021-06-22 14:47:38 -05:00
Nicolas Williams
ae8908bf81 kadmin: Add disallow-client attribute
This is useful for services that need not be clients.  For example, an
untrusted service that need only accept authentication from clients,
but not initiate authentication to other services.
2021-06-22 13:01:24 -05:00
Nicolas Williams
ea83f068e9 kadm5/kadmin: Add read-only mode
Now we can have read-only kadmind instances.
2020-09-08 00:25:40 -05:00
Nicolas Williams
5447b81fb1 hdb: Move virtual principals into HDB layer
This is a large commit that adds several features:

 - Revamps and moves virtual host-based service principal functionality
   from kdc/ to lib/hdb/ so that it may be automatically visible to
   lib/kadm5/, as well as kadmin(1)/kadmind(8) and ktutil(1).

   The changes are backwards-incompatible.

 - Completes support for documenting a service principal's supported
   enctypes in its HDB entry independently of its long-term keys.  This
   will reduce HDB bloat by not requiring that service principals have
   more long-term keys than they need just to document the service's
   supported enctypes.

 - Adds support for storing krb5.conf content in principals' HDB
   entries.  This may eventually be used for causing Heimdal KDC
   services to reconfigure primary/secondary roles automatically by
   discovering the configured primary in an HDB entry for the realm.

   For now this will be used to help reduce the amount of configuration
   needed by clients of an upcoming HTTP binding of the kadmin service.
2020-09-08 00:25:36 -05:00
Nicolas Williams
e17f78c738 kadmin: Allow negative time offsets 2020-09-07 22:15:52 -05:00
Nicolas Williams
7d50445d1b Generic: Fix warnings (fallthrough mosty) 2020-09-07 22:04:59 -05:00
Jeffrey Altman
28b9283709 kadmin: enable keepalive mode on incoming sockets
Change-Id: I07d0e0c866f1081002b3e20ca9198055f98fe7d1
2020-07-24 01:32:34 -04:00
Nicolas Williams
03a08825d0 kadmin: fix leak 2020-04-24 16:02:35 -05:00
Nicolas Williams
dd762e53d1 kadmin: Improve ext_keytab usage 2019-12-06 18:32:15 -06:00
Nicolas Williams
1ae941af9b roken_detach_prep() should return fd 2019-10-03 13:09:18 -05:00
Nicolas Williams
5859bc3bdf kadmin: add --hdb / -H argument
Makes it possible to

 $ kadmin -l -H /tmp/hdb init FOO.EXAMPLE

rather than being able to only init /var/heimdal/heimdal.
2019-10-03 13:09:18 -05:00
Quanah Gibson-Mount
290d7e75f2 Fixes #536 - Note that this can cause unexpected behavior with certain
backends

When running with verify-password-quality and a back-end that stores
history (such as heimdal-history) this command can cause an update to
the database meaning the password can no longer be used with this
principal in the future
2019-05-30 20:11:58 -04:00
Quanah Gibson-Mount
9de4da0dcc Fixes #532 - Note that all does not include get-keys
Update the kadmind(8) man page to note that the "all" option for ACLs
does not include the "get-keys" option.
2019-05-30 20:11:03 -04:00
Quanah Gibson-Mount
4371af9e75 Fixes issue#535 - verify-password-quality
At one point in time, the configuration option was named
"password-quality" but this was later changed to
"verify-password-quality".  Update the kadmin(1) man page to reflect
this change.
2019-05-30 20:09:53 -04:00
Nicolas Williams
c2b106def5 Fix wrong keepold default in kadmin and ktutil 2019-01-09 00:14:11 -06:00
Jeffrey Altman
b025f20eb4 kadmin: kadmind_dispatch incompatible pointer warning
warning: incompatible pointer types passing 'int *' to parameter
  of type 'size_t *' (aka 'unsigned long *') [-Wincompatible-pointer-types]

Change-Id: Id75b1b1c9b46b63ab61134f4f91b7c2909d87077
2019-01-04 01:47:11 -05:00
Jeffrey Altman
750cfc092c fix 00c590e4ff
Change-Id: I73623d71842086374ae58c6e751395fd6925a704
2019-01-04 01:41:23 -05:00
Jeffrey Altman
9119136967 fix memory leaks
Change-Id: I18ad15dc802842324b3712f3f7833953434b1cf1
2019-01-04 01:22:20 -05:00
Jeffrey Altman
00c590e4ff fix null pointer dereference errors
Change-Id: I82a849afe9f432a1084ad2505ce88b1fe4d3d3af
2019-01-04 01:02:59 -05:00
Nicolas Williams
d5536d4dd3 Fix wrong context bugs in kadmin randkey 2019-01-03 22:26:31 -06:00
Jeffrey Altman
e787bd1bc1 kadmin: kadmin_dispatch free krb5_principals at function exit
Change-Id: Ic50a17abf10c7055574de2236cdf1d1469375d8b
2019-01-02 20:19:23 -06:00
Jeffrey Altman
092cd5e838 kadmin: kadmin_dispatch out of memory handling
Coverity determined that a NULL pointer segmentation fault could occur
if krb5_storage_emem() fails.  Use krb5_enomem() to set an error message
on the context and do not perform further krb5_storage operations.

Change-Id: I9587208e46c184bb061443a44581a32dd722de33
2019-01-02 20:19:23 -06:00
Nicolas Williams
ff7a969c32 Begin documenting [password_quality] configuration 2019-01-02 17:29:08 -06:00
Nicolas Williams
d8394c65b7 Add new kadmin/ktutil --keep* and --enctypes opts
- Add --keepold/keepallold/pruneall options to various kadmin/ktutil
   commands.  Default behavior to "prune old keys".

 - When setting keys for a service, we need to specify enctypes for it:

    - Always use kadm5_randkey_principal_3() instead of the older
      kadm5_randkey_principal().

    - Add krb5_string_to_keysalts2(), like MIT's krb5_string_to_keysalts(),
      but with a context, and simpler.

    - Add --enctypes options to various kadmin/ktutil commands.

    - Add [libdefaults] supported_enctypes param with enctype[:salttype]
      list.

    - Add [realms] realm supported_enctypes param with enctype[:salttype]
      list.

      Default to aes128-cts-hmac-sha1-96:normal.
2019-01-02 17:29:08 -06:00
Nicolas Williams
43a911eedc Fix bug in kadmin check warning message 2019-01-02 13:56:04 -05:00
Radoslav Bodo
f3f06fcba9 kadmin selective prune of historic key for principal 2018-12-31 14:17:10 -06:00
Luke Howard
014f16883c libhcrypto: UI_UTIL_FLAG_VERIFY_SILENT 2018-12-30 15:39:49 -06:00