Commit Graph

468 Commits

Author SHA1 Message Date
Viktor Dukhovni
6b285e67e5 Avoid expr in non-portable comparison
The output of `wc -l` includes leading white-space, and at least
in FreeBSD 11, `expr 1 + "$foo"` fails when "$foo" (captured as
`wc -l` output) has leading whitespace.  Instead, just emit one
more line for "wc" to count.
2017-03-16 11:41:19 -04:00
Nicolas Williams
4c64231430 Misc last newline fixes
Originally by Christos Zoulas.
2017-03-13 18:39:41 -04:00
Quanah Gibson-Mount
7c16ce3457 Minor typo/grammar fixes 2017-03-10 15:47:43 -05:00
Viktor Dukhovni
28b6b96e09 Don't do AFS string-to-key tests when feature is disabled 2017-03-09 20:26:30 -05:00
Viktor Dukhovni
2baa0a00c8 Skip mdb_stat test when the command is not available 2017-03-09 20:20:25 -05:00
Nicolas Williams
9ab5ffa3ba check-iprop: don't fail to kill daemons 2017-01-24 11:08:26 -06:00
Nicolas Williams
d237e8e4d9 Fix check-iprop races 2016-12-22 09:40:14 -06:00
Nicolas Williams
3e65dfbc32 Fix make dist missing files (#228) 2016-12-15 12:15:56 -06:00
Viktor Dukhovni
a51ecdb8db Make leaks-kill.sh a no-op for now 2016-12-07 19:52:54 -06:00
Nicolas Williams
1ed7bd56b1 Fix leaks-kill.sh --check 2016-12-07 19:52:29 -06:00
Nicolas Williams
2027aa11ed Use --detach in tests to avoid waiting 2016-12-07 19:52:29 -06:00
Jelmer Vernooij
650d730d0d Increase timeout when waiting for iprop-slave.
This is required when running on slower platforms. We're hitting the
timeout building on mips.
2016-12-04 17:40:38 -06:00
Nicolas Williams
16b77f7dfa Fix make dist 2016-11-28 21:35:34 -06:00
Nicolas Williams
22790e4508 Test RODC interop fix 2016-11-14 21:29:47 -06:00
Viktor Dukhovni
4b4036c9a6 Implement hierarchical referrals 2016-08-08 16:29:29 -05:00
Viktor Dukhovni
1501740952 Fix transit path validation
Also implement KDC hierarchical transit policy checks.  The "hier_capaths"
parameter defaults to "yes" in [libdefaults] or can be set explicitly in
[realms] per-realm.
2016-08-08 16:29:18 -05:00
Viktor Dukhovni
c3eb3341c2 Implement and test referrals for host:port 2016-02-26 15:43:13 -05:00
Nicolas Williams
8343733562 kadmind: check ACLs for aliases CVE-2016-2400
CVE-2016-2400

kadmind(8) was not checking for 'add' permission to aliases added via
kadm5_modify_principal().  This is a security vulnerability.  The impact
of this vulnerability is mostly minor because most sites that use
kadmind(8) generally grant roughly the same level of permissions to all
administrators.  However, the impact will be higher for sites that grant
modify privileges to large numbers of less-privileged users.

From what we know of existing deployments of Heimdal, it seems very
likely that the impact of this vulnerability will be minor for most
sites.
2016-02-26 01:04:32 -06:00
Nicolas Williams
dbf9750989 Tests: set db-dir so tests don't use /var/heimdal 2016-02-26 01:04:31 -06: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
a94dc50114 Add --with-db-type-preference config param 2016-02-26 00:55:32 -06:00
Nicolas Williams
c6f24e99f0 Revamp cf/db.m4; test LMDB 2016-02-26 00:55:32 -06:00
Andrew Bartlett
960fa481be Add test for incorrect password
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2015-06-17 17:41:25 -05:00
Nicolas Williams
05a919b94b iprop slave: try incremental after complete xfer
The following sequence of events results in slave B having a stale HDB:

 - slave A connects to master, master dumps HDB for the slave
 - kadm5 operations
 - slave B connects to master, master sends previously dumped HDB

slave B won't discover any updates until the next transaction.

The fix is simple: the slave should immediately call ihave() after
receiving a complete HDB.
2015-05-20 10:07:52 -05:00
Love Hörnquist Åstrand
4c98e27eda call hdb_auth_status when password is wrong in the ENC-CHAL case too, thanks Andrew Bartlett for pointing this out 2015-04-28 08:54:24 -07:00
Nicolas Williams
487b6820f6 Revamp name canonicalization code 2015-03-24 11:49:58 -05:00
Nicolas Williams
d9e3e376a3 tests: Add simple key history test for kdc
Use kadmin cpw with the --keepold parameter to create a history list.

Change-Id: I21811c840be0bd1b8dd8dc66e63f88f8da6fac7e
2015-03-14 16:08:23 -04:00
Viktor Dukhovni
c3ddece8d4 Name canon kdc config breaks iprop 2015-03-04 17:04:20 -05:00
Love Hörnquist Åstrand
a220ed39eb try using as-is name_canon_rules 2014-09-09 18:36:57 +02:00
Love Hörnquist Åstrand
44ba0bcd24 no need to make chmod quiet, it supposed to be already because of \ 2014-08-23 19:29:04 -07:00
Love Hörnquist Åstrand
8504dce265 make quiet 2014-08-22 21:26:15 -07:00
Love Hörnquist Åstrand
a84b572747 resurrect password change support again 2014-08-22 20:19:36 -07:00
Love Hörnquist Åstrand
a6e136c739 make quiet 2014-02-18 08:27:00 -08:00
Love Hörnquist Åstrand
6a192f0dce clean files 2014-02-16 11:53:56 -08:00
Love Hörnquist Åstrand
54378de6b4 add an2ln-db.txt 2014-02-16 10:05:24 -08:00
Nicolas Williams
2f7eec7d2c Add very large MIT KDB princ entry for testing
Constructed by doing repeated kadmin.local cpw commands with a policy
with -history 9.
2013-11-20 01:08:22 -06:00
Love Hornquist Astrand
1881980d44 spelling 2013-10-18 10:45:59 +02:00
Love Hornquist Astrand
10f3c8b56e add possible to set rules on what enctypes to use based on glob matching on principal 2013-10-18 10:01:55 +02:00
Love Hornquist Astrand
499affd8fa tet setting policy 2013-10-18 09:06:52 +02:00
Nicolas Williams
36f22356c5 Add [manual] test of kinit cmd
It's not ready to always be run.  First, it's slow.  Second, it tortures
the system.  Third, it doesn't look for signs of failure.  Fourth, if it
did it'd fail: because something about the racing is causing the KDC to
think that the foo principal doesn't exist.
2013-09-12 12:14:41 -05:00
Love Hornquist Astrand
3484432cc5 clean log between test, dump log on failure 2013-07-19 14:53:22 +02:00
Love Hornquist Astrand
fdfe696821 if no db, don't check FAST 2013-06-05 20:33:29 -07:00
Love Hornquist Astrand
81263bc94c update leaks check 2013-04-24 17:59:25 -07:00
Viktor Dukhovni
a825143e73 The k5login_directory parameter and SYSTEM-K5LOGIN[:directory] are supposed to be directories, not path templates with %{luser} substitution
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2013-04-24 16:25:59 -07:00
Love Hornquist Astrand
edae63418e client logging too 2013-02-10 23:20:56 -08:00
Love Hornquist Astrand
da42d01d54 x 2013-02-10 21:12:34 -08:00
Love Hornquist Astrand
1adb5de80d fix logging to be sync 2013-02-10 21:11:53 -08:00
Love Hornquist Astrand
0c2e3d94bf default to open/write/close logging 2012-12-27 13:07:13 +01:00
Love Hornquist Astrand
ee068eaf21 note about = 2012-12-27 12:03:17 +01:00
Love Hornquist Astrand
4ebfd6b818 make sure logs are truncated 2012-10-07 11:11:17 -07:00