Commit Graph

28215 Commits

Author SHA1 Message Date
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
Nicolas Williams
ec2204f435 Use volatile to keep ct_memcmp() ct 2016-02-16 20:49:29 -06:00
Luke Howard
33ce593b6d gss_wrap/gss_unwrap_aead implementation
Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-02-05 18:01:15 -06:00
Brian May
6b5933337b Fix parallel build
Fix problem due to missing makefile dependency on a generated file.

See http://bugs.debian.org/800728 for details

Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-02-05 17:23:39 -06:00
Stefan Metzmacher
7cd40a6105 lib/krb5: allow predefined PAC_{LOGON_NAME,PRIVSVR_CHECKSUM,SERVER_CHECKSUM} elements in _krb5_pac_sign()
A caller may want to specify an explicit order of PAC elements,
e.g. the PAC_UPN_DNS_INFO element should be placed after the PAC_LOGON_NAME
element.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2016-02-02 15:31:18 +01:00
Nicolas Williams
1830d8c876 Appveyor: get past package manifest validation
This is just a hack to get Appveyor builds to complete successfully.
Eventually we should get packages and installers to build correctly, and
even for x86 and x86_64 combined.  But it's early days and this is
useful enough.
2016-01-21 12:43:31 -06:00
Nicolas Williams
a5f13331af Appveyor: workaround perl texinfo 2016-01-21 12:43:31 -06:00
Nicolas Williams
cfd51be7fe Add appveyor.yml for Windows CI via Appveyor
Appveyor is like Travis-CI, but for Windows.

Since it seems impossible to install texinfo, this elides building docs
for now.
2016-01-21 12:43:31 -06:00
Nicolas Williams
1575f4f69a KDC: Don't confuse master process with master 2016-01-21 12:43:31 -06:00
Nicolas Williams
a6e36356b5 KDC: fix C-style 2016-01-21 12:43:30 -06:00
Nicolas Williams
4f87d85d65 Fix Windows build: no fork for kdc 2016-01-20 15:03:30 -06:00
Nicolas Williams
971ccce043 Detect fork et al for kdc 2016-01-20 11:34:41 -06:00
Nicolas Williams
78343d0907 Fix Windows tests: add missing hcrypto export 2016-01-20 11:34:41 -06:00
Nicolas Williams
62f797ed4e Fix Windows build (inc. roken.h before assert.h)
The build was failing at lib/hcrypto/evp-pkcs11.c because roken.h was
being included after <assert.h>.  It's not clear why that would be a
problem.

Here are some of the errors and warnings that resulted from including
<roken.h> after <assert.h> in evp-pkcs11.c:

evp-pkcs11.c                                                                                                                                      C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\ws2def.h(91) : warning C4005: 'AF_IPX' : macro redefinition                           s              C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\winsock.h(460) : see previous definition of 'AF_IPX'
C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\ws2def.h(124) : warning C4005: 'AF_MAX' : macro redefinition
        C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\winsock.h(479) : see previous definition of 'AF_MAX'
C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\ws2def.h(168) : warning C4005: 'SO_DONTLINGER' : macro redefinition
        C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\winsock.h(402) : see previous definition of 'SO_DONTLINGER'
C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\ws2def.h(212) : error C2011: 'sockaddr' : 'struct' type redefinition
        C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\winsock.h(485) : see declaration of 'sockaddr'
C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\ws2def.h(390) : error C2059: syntax error : 'constant'
C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\ws2def.h(524) : warning C4005: 'IN_CLASSA' : macro redefinition
        C:\Program Files\Microsoft SDKs\Windows\v7.1\INCLUDE\winsock.h(287) : see previous definition of 'IN_CLASSA'
2016-01-18 11:05:48 -06:00
Luke Howard
bfd72f9ed5 gssapi: correct OID for GSS_C_PEER_HAS_UPDATED_SPNEGO
restore correct OID for GSS_C_PEER_HAS_UPDATED_SPNEGO, this should have no
ABI implications, it's for internal use only. The current OID was incorrectly
copied in commit dbeeb18a, it should belong to 1.3.6.1.4.1.5322.19 which is
... enterprise(1) padl(5322) gssKrb5Extensions(19). The OID we were camping
on belongs to another party.
2015-12-16 23:26:20 +11:00
Luke Howard
f5b4ef3ed8 gssapi: plug leak in test_context IOV test 2015-12-09 19:05:11 +11:00
Luke Howard
fdf8782db2 hcrypto: PKCS#11 backend
implement a PKCS#11 backend for hcrypto. tested with Solaris 11 and
SoftHSM, this is now the default when building on Solaris.
2015-12-09 11:08:35 +11:00
Luke Howard
494b11f962 hcrypto: fix spelling mistakes in comments 2015-12-09 11:07:29 +11:00
Luke Howard
f789d8403e hx509: explicitly include ref/pkcs11.h
review comment from Nico Williams: explicitly include ref/pkcs11.h to
avoid any conflict with system PKCS#11 header
2015-12-09 11:03:48 +11:00
Luke Howard
0de138a7dc cf: define __EXTENSIONS__ on Solaris
defining __EXTENSIONS__ is necessary to build on Solaris 11
2015-12-09 11:02:28 +11:00
Luke Howard
acad7be65e base: Solaris and AIX atomic increment/exchange
Implement heim_base_atomic_XXX and heim_base_exchange_pointer
for Solaris and AIX. (AIX not tested.)
2015-12-09 11:00:11 +11:00
Luke Howard
ed3e748c75 hx509: update to newer PKCS#11 header
newer PKCS#11 reference header file, sourced from SoftHSM
2015-12-09 10:59:08 +11:00
Luke Howard
54e6dbed29 libedit: Solaris portability fixes
__sun braced curses prototypes no longer compile on Solaris, remove them
2015-12-09 10:57:41 +11:00
Luke Howard
d135020e8f kdc: Fix compile error on OS X
bonjour_kid() was missing the krb5_context parameter name, preventing
compilation on Darwin (where __APPLE__ is defined)
2015-12-09 10:46:38 +11:00
Luke Howard
9aeb08173a add CommonCrypto SHA-384/512 to test_bulk 2015-12-05 00:05:49 +11:00
Luke Howard
87c59d1db2 export CommonCrypto SHA-384/512 implementations 2015-12-05 00:04:24 +11:00
Luke Howard
5ae1ab038c Merge pull request #121 from heimdal/lukeh/cfb8
Merging support for CFB8 in CommonCrypto (note will break support for OS X older than 10.7). CommonCrypto support for SHA-256/384 also added.
2015-12-04 23:59:48 +11:00
Luke Howard
4f9cc8feea add CommonCrypto support for SHA-384 and SHA-512 2015-12-04 23:56:12 +11:00