Commit Graph

18 Commits

Author SHA1 Message Date
Radoslav Bodo
f3f06fcba9 kadmin selective prune of historic key for principal 2018-12-31 14:17:10 -06:00
Luke Howard
410d96f480 kadmin: do not assign passwords at realm initialization
Since c6bf100b password quality checks have been moved out of kadmindd and into
libkadm5. This means that all password changes are subject to quality checks,
if enforce_on_admin_set is true (the default). In rare instances it could be
possible for realm initialization to fail because the randomly generated
passwords do not pass the password quality test. Fix this by creating
principals with no password or key, rather than with a random password.

Random *keys* continue to be set immediately after the principal is created,
and before DISALLOW_ALL_TIX is unset, so there should be no functionality or
security implications from this change. It is safe to call a server-side API
such as kadm5_s_create_principal_with_key() as local_flag is asserted to be
true.
2018-12-27 17:11:27 +11: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
Nicolas Williams
db72e66eb9 kadm5: Add functions to check for bogus keys
Introduce kadm5_all_keys_are_bogus() and kadm5_some_keys_are_bogus()
which will be used in later changes.

Change-Id: I3a07ffe07bee7d6eb17c3d2eae91c107e0bac255
2015-03-14 16:08:34 -04:00
Roland C. Dowdeswell
12b24ad876 Add a server side implementation of kadm5_create_principal_3(). 2012-02-24 18:56:30 +00:00
Nicolas Williams
9adb40a06e Forgot to export the kadm5 policy functions. 2011-07-22 16:07:06 -05:00
Nicolas Williams
0d90e0c4d0 Complete --keepold support and fix crasher in kadmin cpw -r --keepold. 2011-07-22 16:07:06 -05:00
Nicolas Williams
558a8d05a6 Forgot to export kadm5_store_principal_ent_nokeys(). 2011-07-22 16:07:06 -05:00
Nicolas Williams
4b0245d096 Export the new kadm5 functions. 2011-07-22 16:07:05 -05:00
Nicolas Williams
6e04b05e9d Initial support for kadm5_randkey_principal_3(), needed by krb5_admin.
NOT TESTED YET.
2011-07-22 16:04:52 -05:00
Love Hörnquist Åstrand
3b2ec2fdb6 add kadm5_s_chpass_principal_cond;
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21916 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 11:14:36 +00:00
Love Hörnquist Åstrand
4764c9bdae export _kadm5_privs_to_string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21915 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 11:07:19 +00:00
Love Hörnquist Åstrand
f9245690d2 add _kadm5_s_get_db
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21914 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 11:06:18 +00:00
Love Hörnquist Åstrand
bdb68687c6 kadm5_s_init_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21913 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 10:39:18 +00:00
Love Hörnquist Åstrand
f8f32783a1 export _kadm5_unmarshal_params
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21911 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 10:32:42 +00:00
Love Hörnquist Åstrand
51e9c4301d export _kadm5_acl_check_permission
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21910 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 10:32:22 +00:00
Love Hörnquist Åstrand
831e5b33ff export kadm5_log_ symbols.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21909 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-16 10:17:03 +00:00
Love Hörnquist Åstrand
d4854ae456 version script fro kadm5 server libary.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21777 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-01 06:41:51 +00:00