53 Commits

Author SHA1 Message Date
Nicolas Williams
1aa0a495c2 tests: Use kadmin w/ here-document to speed up tests 2024-01-16 16:28:35 -06:00
Nicolas Williams
016373931d tests: Kill daemons on ^C 2024-01-16 16:28:35 -06:00
Nicolas Williams
06ba7b1597 test: When kdc fails to start, show the log
This is an attempt to find out why the GitHub Actions OS X build is
failing.
2022-01-20 14:32:17 -06:00
Nicolas Williams
0e09fa7fde iprop: Support hierarchical iprop 2020-09-18 14:31:43 -05:00
Nicolas Williams
1482309565 iprop: Use test port for testing 2019-12-20 16:52:00 -06:00
Nicolas Williams
c6d0793e63 Do not recover log in kadm5_get_principal() 2019-10-03 15:52:15 -05:00
Viktor Dukhovni
8a0186c5b9 Fix missing wait_for in check-iprop 2017-05-28 16:58:02 -05:00
Viktor Dukhovni
c02af7b3bb Avoid another potential check-iprop race.
Though a race was never observed, the re-sync, slave DB deletion,
master changes and restart did not take into account late changes
in the master before slave down.
2017-04-18 16:54:48 -05:00
Viktor Dukhovni
69bb29ea29 Fix check-iprop race
Creation of a random key HDB entry takes 3 updates, not one.  Instead of
hard-coding this magic count, wait for the appearance of the expected
entry with no "invalid" flag among its attributes.
2017-04-18 10:04:56 -05:00
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
Quanah Gibson-Mount
7c16ce3457 Minor typo/grammar fixes 2017-03-10 15:47:43 -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
2027aa11ed Use --detach in tests to avoid waiting 2016-12-07 19:52:29 -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
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 Hornquist Astrand
1881980d44 spelling 2013-10-18 10:45:59 +02:00
Love Hornquist Astrand
499affd8fa tet setting policy 2013-10-18 09:06:52 +02:00
Love Hornquist Astrand
4ebfd6b818 make sure logs are truncated 2012-10-07 11:11:17 -07:00
Love Hornquist Astrand
baf748fb8e catch better slave message now that iprop is more verbose 2012-10-01 09:36:11 -07:00
Viktor Dukhovni
1b3f1b57b4 Don't forget to sleep in 3DES del_enctype test.
On NetBSD /bin/sh with vfork() is noticeably faster than /bin/bash,
and in particular the reader manages to read the the database before
slave replication completes.
2012-05-28 16:13:14 +01:00
Nicolas Williams
839ab87c10 Regression test iprop of key rollover and del_enctype 2012-03-15 18:57:35 -05:00
Love Hörnquist Åstrand
bf37778dbd make ipropd_slave tell its status in a status file
The ipropd_slave will log its status to /var/heimdal/ipropd-slave-status
if its connecting, up to date, or disconnected.

The master will now also confirm to slaves that are are in fact up to date
if they just restart, before there was no confirmation, the slave just didn't
get any deltas.
2012-02-15 20:59:54 -08:00
Love Hornquist Astrand
86da42df1d abstract out --no-afslog and --no-unlog 2010-06-01 14:42:16 -07:00
Love Hornquist Astrand
72908828b1 remove $Id$ 2009-09-21 10:36:37 -07:00
Love Hornquist Astrand
f4e14830cc drop unused vars 2009-09-07 16:26:04 -07:00
Love Hornquist Astrand
73802775b0 EGREP is defined by setup-env 2009-09-07 15:09:24 -07:00
Love Hornquist Astrand
012c91539e clean message log to make sure the right "ipropd-slave started" message is captured 2009-09-07 15:08:21 -07:00
Love Hornquist Astrand
3b878f5a81 migrate to ${env_setup} 2009-09-07 13:21:21 -07:00
Love Hörnquist Åstrand
3a556b7090 more malloc debug
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25091 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-04 17:10:29 +00:00
Love Hörnquist Åstrand
b24a5a246f add malloc logging
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25086 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-04 17:09:27 +00:00
Love Hörnquist Åstrand
f6b70dd805 disable master down test, since that doesn't work if we kill -9
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24998 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-29 09:04:40 +00:00
Love Hörnquist Åstrand
65f7254b34 use leaks-kill
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24997 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-29 09:04:30 +00:00
Love Hörnquist Åstrand
d93ac20298 kill -9 to make store its dead
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24993 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-29 09:03:47 +00:00
Love Hörnquist Åstrand
4ddaad680a check master downing down
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23937 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-10-18 23:56:15 +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
ac6a35b3c1 use full hostname to avoid realm resolving errors
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23244 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-06-01 22:28:32 +00:00
Love Hörnquist Åstrand
c9890e979e Sleep some before checking that the slave got the update.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21944 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-10-02 20:07:50 +00:00
Love Hörnquist Åstrand
f54a6734fa try /bin/pwd first.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21886 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-09 07:24:21 +00:00
Love Hörnquist Åstrand
09e7580155 Don't run this test in AFS since AFS is missing unix sockets.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21883 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-09 07:18:44 +00:00
Love Hörnquist Åstrand
829606ee46 Make quiet about killing master and slave.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21879 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-09 04:10:19 +00:00
Love Hörnquist Åstrand
4d53f8f577 trap kill output, silence picky tail.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21875 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-09 02:44:29 +00:00
Love Hörnquist Åstrand
290a0e419c use wait-kdc.sh for all diffrent places we start ipropd-{master,slave}.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21871 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-08 13:12:46 +00:00
Love Hörnquist Åstrand
eae0276720 move emptying of messages.log to same space as all other checks.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21850 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-08 06:57:28 +00:00
Love Hörnquist Åstrand
bde88e03ac Use wait-kdc.sh to wait for ipropd-{master,slave}.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21842 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-08 06:53:04 +00:00
Love Hörnquist Åstrand
f2df45620f dump more info.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21838 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-08 06:45:04 +00:00
Love Hörnquist Åstrand
da9d982415 Checking master going backward, create iprop-stats.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21836 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-08-08 06:39:26 +00:00