Commit Graph

28242 Commits

Author SHA1 Message Date
Nicolas Williams
644b45939e kadmind: fix leak 2016-02-29 19:13:12 -06:00
Nicolas Williams
69eb97a92d kdc: num_kdc_procs < 1 -> use NCPUs 2016-02-29 19:13:12 -06:00
Nicolas Williams
97425a44a2 hx509/crypto.c: fix invalid pointer deref 2016-02-29 19:13:11 -06:00
Nicolas Williams
1236238cde kadm5/log.c: missing error checking 2016-02-29 19:13:11 -06:00
Nicolas Williams
8394778f92 master: quieten static analyzers 2016-02-29 19:13:11 -06:00
Nicolas Williams
2734102cc7 slave: quieten static analyzer false positives 2016-02-29 19:13:11 -06:00
Nicolas Williams
2415a5ee1d ipropd-slave: missing error check 2016-02-29 19:13:11 -06:00
Nicolas Williams
cfd9d59a15 ipropd-master: missing error check 2016-02-29 19:13:10 -06:00
Nicolas Williams
e625bb6ef6 Remove busted precheck in create_s.c 2016-02-29 19:13:10 -06:00
Nicolas Williams
2b5ddafab5 HDB sqlite backend: fix error NULL deref 2016-02-29 19:13:10 -06:00
Nicolas Williams
6cc69e0b1f Shut up VC 2016-02-29 19:13:10 -06:00
Nicolas Williams
c350ca6f6e iprop-log: fix logically dead warnx() 2016-02-29 19:13:09 -06:00
Nicolas Williams
b3db07d5f0 krb5_storage_free(NULL) should work 2016-02-29 19:13:09 -06:00
Viktor Dukhovni
9f0e64d5b8 Revert inadvertent change 2016-02-28 20:34:26 -05:00
Nicolas Williams
2d9f7257b9 Also build setkey3_s on Windows 2016-02-26 22:23:54 -06:00
Nicolas Williams
7442787f03 Fix leak in check_aliases() 2016-02-26 21:29:05 -06:00
Nicolas Williams
1976e012b8 Automatically upgrade iprop logs to add uber rec
We need the uber record all the time now, actually, except when merely
inspecting a log file.  This is important as we depend on replaying
entries written to the log in order to complete the HDB writes, and if
we don't have an uber record we can't do this step.

Also, log_init() should cleanup on error.
2016-02-26 19:10:14 -06:00
Nicolas Williams
eabb2821c6 setkey_principal_3(): use the new HDB/log protocol
The addition of kadm5_setkey_principal_3(), and the associated
kadm5_s_setkey_principal_3() missed the revamp for two-phase commit.
2016-02-26 15:05:34 -06:00
Viktor Dukhovni
8fe294d0d7 Add SO_KEEPALIVE to iprop clients (slaves) 2016-02-26 15:43:13 -05:00
Viktor Dukhovni
54d37fdba6 Fix memory leak 2016-02-26 15:43:13 -05:00
Viktor Dukhovni
c3eb3341c2 Implement and test referrals for host:port 2016-02-26 15:43:13 -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
047daa077a Windows: build lib/hdb/hdb-mdb.c (LMDB) 2016-02-26 12:08:30 -06:00
Nicolas Williams
a388514712 Windows: fix two-phase commit docs 2016-02-26 12:08:05 -06:00
Nicolas Williams
f261ed4f58 Fix ipropd_slave: no EDQUOT on WIN32 2016-02-26 11:42:01 -06: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
50a45a946d Fix more HDB SQLite3 issues
Fix some issues reported by Jeffrey Hutzelman.
2016-02-26 01:04:32 -06:00
Nicolas Williams
5867aa6873 hdb-sqlite: fix error code confusion 2016-02-26 01:04:32 -06:00
Nicolas Williams
b4cf4de807 Fix warnings (clang 3.6) 2016-02-26 01:04:31 -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
ebc1ad34ba ipropd-master/slave: enhancements and bug fixes
- fix int/uint confusion and use unsigned integral types for time
 - improve messages
 - add --verbose option
 - attempt transaction recovery in ipropd-master during idle times
 - begin hardening daemons against dying at the slightest provocation
 - better recovery from various errors
 - daemons now restart automatically in most of the many error cases
   where the daemons still die
2016-02-26 00:59:04 -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
d774aeda38 ipropd-master: add missing ret = 2016-02-26 00:55:33 -06:00
Nicolas Williams
ab42f2882f Update valgrind suppressions 2016-02-26 00:55:33 -06:00
Nicolas Williams
7eb9b46f5b Document HDB backends 2016-02-26 00:55:33 -06:00
Nicolas Williams
16275048b8 Prefer LMDB to Berkeley DB 2016-02-26 00:55:32 -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
76c26281a7 Fix sqlite HDB backend SQLITE_BUSY bug 2016-02-26 00:55:32 -06:00
Nicolas Williams
fbc87e46fd Fix sqlite HDB backend init bug 2016-02-26 00:55:31 -06:00
Nicolas Williams
7df165003a Fix iprop-log dump leak 2016-02-26 00:55:31 -06:00
Nicolas Williams
5ee7209f6e kadmin init: init iprop log 2016-02-26 00:55:31 -06:00
Nicolas Williams
d1fcf3dc67 ipropd_master: fix dump bug 2016-02-26 00:55:31 -06:00
Nicolas Williams
96859fe687 maybe-valgrind.sh: don't --trace-children=yes 2016-02-26 00:55:31 -06:00
Nicolas Williams
abafa0a0a0 krb5_storage_free(): preserve errno 2016-02-26 00:55:30 -06:00
Nicolas Williams
996d4c5db3 Add krb5_ret/store_[u]int64() 2016-02-26 00:55:30 -06:00
Nicolas Williams
0271b171e5 Add bswap64() 2016-02-16 20:49:33 -06:00
Nicolas Williams
76965a2a14 Add missing initialization of mandatory 2016-02-16 20:49:32 -06:00
Nicolas Williams
b1af99aa81 Fix memleak in lib/kadm5/set_keys.c 2016-02-16 20:49:32 -06:00
Nicolas Williams
e4b61df46f Test parse_time() with minutes 2016-02-16 20:49:31 -06:00