Commit Graph

65 Commits

Author SHA1 Message Date
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
367f9ddd7d kadm5: Revert part of 69eee19541 2022-01-14 15:41:32 -06:00
Nicolas Williams
69eee19541 kadm5: Fix warnings 2022-01-14 14:58:59 -06: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
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
7845bda1e0 kadm5: Do not apply new service key delay in get
Using HDB_F_DELAY_NEW_KEYS in kadm5_s_get_principal() breaks OSKT's
expectations.
2020-09-19 21:48:49 -05:00
Nicolas Williams
ff13573ce5 hdb: Do not apply new service key delay to clients
The new [hdb] new_service_key_delay parameter should not apply to
principal entries when used as clients.  Otherwise new passwords would
not take effect immediately, and that would be very confusing.
2020-09-09 21:48:29 -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
c6d0793e63 Do not recover log in kadm5_get_principal() 2019-10-03 15:52:15 -05:00
Jeffrey Altman
db859520b4 lib/kadm5: use krb5_enomem() where possible
Change-Id: I487fbc640a8f793f0aa02ef4c94099e09241d616
2018-12-25 16:57:55 -06:00
Viktor Dukhovni
0ae6147483 Fix kadm5 error cleanup 2016-11-11 01:38:41 -05:00
Jeffrey Altman
1007d104fa lib/kadm5: do not prototype imported _krb5_put_int
The function _krb5_put_int() is a private function exported from
lib/krb5.  Its declaration should come from krb5-private.h.  A local
declaration will not result in the proper import qualifiers on
Windows.

See also: e1a244f Make it possible to include krb5_locl.h in kadm5

Change-Id: I53e7aeea9f2f34cab105f2e331f3c6522847ccfe
2016-04-11 16:01:27 -05:00
Jeffrey Altman
f1d73a8e46 Revert "lib/kadm5: do not prototype imported _krb5_put_int"
krb5_locl.h cannot be included from within lib/kadm5 in the
current UNIX builds.  Reverting this change which is necessary
to properly build on Windows until an alternate solution is
agreed upon.

This reverts commit ffc525aad1.
2016-04-11 14:40:57 -05:00
Jeffrey Altman
ffc525aad1 lib/kadm5: do not prototype imported _krb5_put_int
The function _krb5_put_int() is a private function exported from
lib/krb5.  Its declaration should come from krb5-private.h.  A local
declaration will not result in the proper import qualifiers on
Windows.

Change-Id: I53e7aeea9f2f34cab105f2e331f3c6522847ccfe
2016-04-10 19:04:30 -05:00
Viktor Dukhovni
579393c8b9 Optionally prune old keys when setting new keys.
When new keys are added (typically via kadm5_setkey_principal_3),
truncate the key history to remove old keys, that is keys older than
the newest key which was in effect prior longer ago than the principal's
maximum ticket lifetime.  This feature is controlled via the "[kadmin]"
section's "prune-key-history" boolean parameter, which defaults to false.

Currently this happens only when kadm5_setkey_principal_3()
is called directly on the server, the client API simulates
kadm5_setkey_principal_3() via a get, update, modify sequence that does
not prune the key history.  The plan is to add a new kadm5 protocol RPC
and convert clients to call that instead.

In setkey_principal_3 seal keys after entry key update

Also, for now, don't check the return value of kadm5_log_modify() in
the new kadm5_s_setkey_principal_3().  This has to be addressed more
globally.

Censor stale keys in kadm5_s_get_principal
2016-02-26 15:43:12 -05:00
Nicolas Williams
20df2c8706 Two-phase HDB commit via iprop log, + GC for log
We used to update the iprop log and HDB in different orders depending on
the kadm5 operation, which then led to various race conditions.

The iprop log now functions as a two-phase commit (with roll forward)
log for HDB changes.  The log is auto-truncated, keeping the latest
entries that fit in a configurable maximum number of bytes (defaults to
50MB).  See the log-max-size parameter description in krb5.conf(5).

The iprop log format and the protocol remain backwards-compatible with
earlier versions of Heimdal.  This is NOT a flag-day; there is NO need
to update all the slaves at once with the master, though it is advisable
in general.  Rolling upgrades and downgrades should work.

The sequence of updates is now (with HDB and log open and locked):

a) check that the HDB operation will succeed if attempted,
b) append to iprop log and fsync() it,
c) write to HDB (which should fsync()),
d) mark last log record committed (no fsync in this case).

Every kadm5 write operation recover transactions not yet confirmed as
committed, thus there can be at most one unconfirmed commit on a master
KDC.

Reads via kadm5_get_principal() also attempt to lock the log, and if
successful, recover unconfirmed transactions; readers must have write
access and must win any race to lock the iprop log.

The ipropd-master daemon also attempts to recover unconfirmed
transactions when idle.

The log now starts with a nop record whose payload records the offset of
the logical end of the log: the end of the last confirmed committed
transaction.  This is kown as the "uber record".  Its purpose is
two-fold: act as the confirmation of committed transactions, and provide
an O(1) method of finding the end of the log (i.e., without having to
traverse the entire log front to back).

Two-phase commit makes all kadm5 writes single-operation atomic
transactions (though some kadm5 operations, such as renames of
principals, and changes to principals' aliases, use multiple low-level
HDB write operations, but still all in one transaction).  One can still
hold a lock on the HDB across many operations (e.g., by using the lock
command in a kadmin -l or calling kadm5_lock()) in order to push
multiple transactions in sequence, but this sequence will not be atomic
if the process or host crashes in the middle.

As before, HDB writes which do not go through the kadm5 API are excluded
from all of this, but there should be no such writes.

Lastly, the iprop-log(1) command is enhanced as follows:

 - The dump, last-version, truncate, and replay sub-commands now have an
   option to not lock the log.  This is useful for inspecting a running
   system's log file, especially on slave KDCs.

 - The dump, last-version, truncate, and replay sub-commands now take an
   optional iprop log file positional argument, so that they may be used
   to inspect log files other than the running system's
   configured/default log file.

Extensive code review and some re-writing for clarity by Viktor Dukhovni.
2016-02-26 00:55:33 -06:00
Roland C. Dowdeswell
0da84c0c3a Add require-pwchange flag to HDB and honour it if present in mit-db:. 2012-02-27 10:19:54 +00:00
Nicolas Williams
dfc7ec92fa Make kadm5_lock() and unlock work, and add kadmin commands for them.
The libkadm5 functions hdb_open() and close around all HDB ops.  This
meant the previous implementation of kadm5_lock() and unlock would
always result in a core dump.  Now we hdb_open() for write in
kadm5_lock() and hdb_close() in kadm5_unlock(), with all kadm5_s_*()
functions now not opening nor closing the HDB when the server context
keep_open flag is set.

Also, there's now kadmin(8) lock and unlock commands.  These are there
primarily as a way to test the kadm5_lock()/unlock() operations, but
MIT's kadmin.local also has lock/unlock commands, and these can be
useful for scripting (though they require much care).
2011-07-22 21:07:48 -05:00
Nicolas Williams
e7ea698366 Fixed dumb bug that caused keys to not accumulate in history. 2011-07-22 16:06:01 -05:00
Nicolas Williams
7e0a801e28 Changed decrypt key history logic and added HDB_F_ALL_KVNOS. 2011-07-22 16:05:21 -05:00
Nicolas Williams
a04721b737 Added basic policy support, w/ policy names listed in krb5.conf 2011-07-22 16:05:21 -05:00
Nicolas Williams
b45ac85b65 Add support for fetching old keys via kadm5 API. 2011-07-22 16:04:51 -05:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
965836509b switch to hdb_fetch_kvno 2010-11-28 11:43:02 -08:00
Asanka Herath
b1063ea8fc Initial Windows port 2009-11-24 10:11:14 -08:00
Love Hornquist Astrand
75aebbf616 [HEIMDAL-646] malloc(0) checks for AIX 2009-10-11 17:32:38 -07:00
Love Hornquist Astrand
ff87429593 Make LDAP code fetch less attributes from LDAP server when KDC is asking
Johan Gadsjö did a awesome analysis of the LDAP access pattens
and sent us a patch that reduced the calls the ldap server by 4
times as many. The patch was adopted and change to avoid compile
time depencies and make the determination runtime instead. Thanks!
2009-10-03 13:20:41 -07:00
Love Hörnquist Åstrand
63a9b03afb its ok to not have a password
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25216 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-21 21:37:31 +00:00
Love Hörnquist Åstrand
7afb1de424 catch failure
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25202 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-09 14:21:19 +00:00
Love Hörnquist Åstrand
5d65692492 comment out unsupported options
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25182 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-06 19:01:51 +00:00
Love Hörnquist Åstrand
2767e8f372 Send the PK-INIT acl to the client in TL-data, from Henry B. Hotz.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24039 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-11-12 04:23:03 +00:00
Love Hörnquist Åstrand
8cf907f08a switch to krb5_clear_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23912 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-14 02:55:55 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
8d40c2994b check return value of alloc functions, from Charles Longeau
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21745 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-07-31 16:11:25 +00:00
Love Hörnquist Åstrand
f85c99c51b (kadm5_s_get_principal): use right context
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20299 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-04-11 11:11:46 +00:00
Love Hörnquist Åstrand
aa1680d459 add support to get aliases
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20237 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-02-16 23:54:34 +00:00
Love Hörnquist Åstrand
0e5d5e7f5e Add KRB5_KDB_ALLOW_DIGEST
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17926 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-08-24 10:49:46 +00:00
Love Hörnquist Åstrand
6b69db8936 (kadm5_s_get_principal): Add KRB5_KDB_ALLOW_KERBEROS4
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17650 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-06-14 18:33:02 +00:00
Love Hörnquist Åstrand
b8a9917e8a (kadm5_s_get_principal): Add trusted_for_delegation
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17629 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-06-06 21:29:13 +00:00
Love Hörnquist Åstrand
cb704efeeb Rename u_intXX_t to uintXX_t
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17445 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-05 10:37:46 +00:00
Love Hörnquist Åstrand
eea5f34855 Pass in HDB_F_GET_ANY to all ->hdb fetch to hint what entries we are looking for
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17313 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-04-27 11:18:52 +00:00
Love Hörnquist Åstrand
5f22b44baa Break out the that we request from principal from the entry and pass
it in as a separate argument.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17310 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-04-27 11:09:30 +00:00
Love Hörnquist Åstrand
3148e9f3b0 (kadm5_s_get_principal): memset hdb_entry_ex before use
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16392 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-12-13 11:33:59 +00:00
Love Hörnquist Åstrand
0c2369acd0 Wrap hdb_entry with hdb_entry_ex, patch originally from Andrew Bartlet
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16378 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-12-12 12:40:12 +00:00
Love Hörnquist Åstrand
723085bc25 (kadm5_s_get_principal): clear error string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16041 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-09-08 11:24:45 +00:00
Love Hörnquist Åstrand
1246a22076 Implement KADM5_LAST_PWD_CHANGE.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15909 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-08-11 20:43:43 +00:00
Love Hörnquist Åstrand
dad0c94ffe Expose KADM5_TL_DATA options to the client.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15884 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-08-11 13:29:54 +00:00