60 Commits

Author SHA1 Message Date
abb9a46ccc kadmin: Add missing error check in init() 2022-01-18 15:41:43 -06:00
0f843189a4 kadmin: Check for errors in init 2022-01-17 00:45:37 -06:00
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
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
be3836d4ca Revert "kadmin: do not assign passwords at realm initialization"
This reverts commit 83def5bc18. Not passing all
tests, will resubmit as pull request.
2018-12-27 16:42:36 +11:00
83def5bc18 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 16:27:16 +11:00
ffd0dda237 Fix iprop against legacy master with full log
When the master's log has all entries from version 1 to now, and no
uber entry (legacy master), then new slaves will not pull version 1,
because their uber record has version 1.

The fix is to force the uber version to 0 always, and avoid adding a
truncate nop when doing a full prop.  The uber record now records the
database version even in the absence of any other log entries so that
we know what to pull going forward.
2016-06-09 01:03:10 -04:00
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
5ee7209f6e kadmin init: init iprop log 2016-02-26 00:55:31 -06:00
1a562410c9 dup of ok for the fast cookie 2011-11-13 10:01:41 -08:00
086477a9b5 disable operation ofn fast cookie principal 2011-07-24 21:31:48 -07:00
0941d6dbce add constant for WELLKNOWN:ORG.H5L realm 2011-07-24 21:29:27 -07:00
46f285bcc9 encode fast state in the fast cookie 2011-07-24 21:16:42 -07:00
e307a6f350 init max_life and max_rlife 2010-11-27 11:04:55 -08:00
433b1d5073 drop RCSID 2010-03-16 12:52:58 -07:00
368536bc08 add password/bare options 2009-11-21 23:53:26 -08:00
b7b88769b9 fix spelling
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25290 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-06-24 18:07:48 +00:00
fb66afbaa2 create WELLKNOWN/ANONYMOUS
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24570 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-04 22:02:43 +00:00
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
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
652da91adb Rename u_intXX_t to uintXX_t
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17447 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-05 10:52:01 +00:00
819d3ee297 (create_random_entry): create principal with random password even
though its disabled. From Andrew Bartlet <abartlet@samba.org>


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16040 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-09-08 11:06:09 +00:00
fec66b3327 (init): Don't disable forwardable for kadmin/changepw.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15064 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-05-03 11:11:54 +00:00
5836537f76 argument number checks are now done by slc
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-05 11:41:22 +00:00
d970c48c81 print error messages to stderr; change all in-string quoting to use "
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14021 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-04 15:09:42 +00:00
cf22688e0c check for local mode
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14008 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-27 17:33:33 +00:00
9929f779ec move kadmin-commands.h from kadmin_locl.h so kadmind does not depend on it
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14000 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-27 15:04:07 +00:00
d7f9fac88e convert to use slc; also add stash subcommand
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13970 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-21 19:19:45 +00:00
c8fbd4db8a x
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13411 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-02-29 06:59:25 +00:00
be1b8d4459 (create_random_entry): print error message on failure
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13410 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-02-29 06:56:22 +00:00
0540f13b86 prefix all struct HDB elements with hdb_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12880 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-09-19 00:25:35 +00:00
0949f5042e check return value from edit_deltat
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11554 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-12-03 14:08:17 +00:00
99b7bcc31d add --help
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11553 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-12-03 14:04:50 +00:00
9f0aeca967 complain if there's no realm name specified
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9045 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-09-10 19:20:16 +00:00
91aadd63bd (usage): print init-usage and not add-dito
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8970 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-08-18 05:17:45 +00:00
fb884f7343 (init): also create `kadmin/hprop'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8727 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-07-21 01:25:05 +00:00
d46f9a6cbd (init): create changepw/kerberos with disallow-tgt and pwchange
attributes


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8088 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-04-02 21:26:44 +00:00
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
c2d13adb19 types
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7365 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-11-13 04:13:26 +00:00
031dacdae9 (init): also create `changepw/kerberos'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6918 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-09-10 13:10:35 +00:00
7c846975b0 update with new names of functions in util
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6847 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-08-19 20:32:05 +00:00
a5e0e1f850 (create_random_entry): more correct setting of mask
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6279 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-23 06:44:19 +00:00
f74027c877 (init): initialize realm_max_life and realm_max_rlife
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6205 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-11 13:15:17 +00:00
dba18eafe8 (init): new arguments realm-max-ticket-life and
realm-max-renewable-life


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6127 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-04 18:40:57 +00:00
388dbc5217 (create_random_entry): free the entry
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5757 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-03-25 03:35:20 +00:00
d6ac21cd4d Max-life and max-renew can, infact, be zero.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4500 ec53bebd-3082-4978-b11e-865c3cabbd6b
1998-03-01 04:05:06 +00:00
5620f021e1 (init): create `default'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4228 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-12-23 00:37:21 +00:00
ed56208dec Change to use kadm5 api.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4034 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-11-16 11:01:21 +00:00
ae31038985 adapt to new hdb interface
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3628 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-10-16 04:14:00 +00:00
7cc76266cf add `replace' arg to db->store
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3293 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-08-30 19:31:44 +00:00