Commit Graph

28242 Commits

Author SHA1 Message Date
Luke Howard
7b720cf61c krb5: implement draft-ietf-kitten-aes-cts-hmac-sha2-07 2016-10-08 08:17:11 +02:00
Uri Simchoni
a3bece16c7 lib/krb5: keep a copy of config etypes in the context
When reading configuration file, keep an extra copy of
the encryption types, and use this when resetting the
encryption types to default.

GSSAPI always resets the enctypes to default before obtaining
a TGS, because the enctypes might have previously altered,
so this prevents changing the etypes from the configured ones
to the full set of supported etypes.

Signed-off-by: Uri Simchoni <uri@samba.org>
2016-09-30 08:37:06 -07:00
Jeffrey Altman
a16a9cc939 Merge pull request #203 from sdigit/patch-1
Fix typo in rand-fortuna.c
2016-09-19 16:36:59 -05:00
Sean Davis
316387f619 Fix typo in rand-fortuna.c
`__GNUC__` was written as `__GUNC__`, which could have interesting results as it'll never be defined.
2016-09-19 16:06:03 -05:00
Benjamin Kaduk
aa87e08cc7 Use C99 designated initializers in a couple places
Some portions of libhcrypto are reused by other projects in
diverse environments, including within operating system kernel modules.
In some such build environments, hardening measures such as grsecurity
can (randomly) reorder structure elements, so as to make it harder
for an attacker to determine the offset from a known field's address
to a different field that is needed for an attack.

However, doing so requires the use of C99 designated initializers
to make the source code compatible with such structure rearrangement,
as opposed to the "traditional" C aggregate type initializers, which
just list fields in order.  This feature is also available as a
GCC extension since early versions of GCC.  However, it is not
provided by many common versions of visual studio (and presumably
also not by the vendor compiler for various commercial Unixes),
so the traditional initializers must remain, behind a conditional.
__GNUC__ or __STDC_VERSION__ >= 199901 should be enough to get
most cases with support for designated initializers, at least
for now.

Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-09-01 17:38:47 -05:00
Nicolas Williams
44dec510fd Update to SQLite3 3.14
Newer versions of SQLite3 have a number of new features that are
desirable to users who host other DBs in the same file as the HDB (for
example), as well as performance and bug fixes.

We should consider switching the SQLite3 backend for HDB to WITHOUT
ROWID tables for performance reasons.  We should also consider using
foreign keys instead of triggers.  Making any such changes requires care
to permit both, upgrade and downgrade.

We might want to use the SQLite3 session extension for a SQLite3-
specific, low-level replication (iprop).  Given conflict resultion code,
or a sufficiently normalized schema, the session extension would make it
easy to create a multi-master replication system, not unlike what one
would expect of an LDAP setup, though with none of the atomicity that
LDAP is supposed to provide (specifically, O_EXCL semantics for creates
and predicates for updates) unless we were to add a locking protocol.

Note that as of 3.14, the session extension is mutually exclusive of
WITHOUT ROWID tables.
2016-08-11 14:53:25 -05:00
Nicolas Williams
01c2d5b801 Add lib/sqlite/README 2016-08-11 11:26:41 -05:00
Viktor Dukhovni
09c4e516bf Further polish and docs for hierarchical capaths 2016-08-10 21:09:15 -04:00
Nicolas Williams
76c596ceb8 Complete support for --disable-afs-support 2016-08-10 19:51:11 -05:00
Jeffrey Altman
3e6fb5bb41 Merge pull request #196 from DavidMulder/disable_afs_fix
Properly define the NO_AFS AM_CONDITIONAL
2016-08-10 00:22:03 -05:00
Viktor Dukhovni
b39a4f7c78 Update old_version after timeout
On a low update rate master, if we don't update old_version after
processing a poll timeout, we will generate spurious warnings about
missed (change) signals every time the timer expires, and will
needlessly contact the slaves.
2016-08-09 21:02:44 -04:00
Viktor Dukhovni
fc4e52174c Silence possible compiler warning
Reported by David Mulder, PR 195.
2016-08-09 20:57:04 -04:00
Viktor Dukhovni
99dfbda161 Add missing error check in krb5_check_transited
Reported by David Mulder, PR 195.
2016-08-09 20:52:58 -04:00
David Mulder
4f0a8e7d13 Properly define the NO_AFS AM_CONDITIONAL 2016-08-09 12:19:10 -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
Nicolas Williams
0561396c0a Add how-to-test example to kimpersonate.8 2016-08-08 14:14:04 -05:00
Nicolas Williams
ab61e1d395 Add --add and --referral options to kimpersonate 2016-08-08 14:14:04 -05:00
Nicolas Williams
345333c40a Document kimpersonate --ccache option 2016-08-08 14:14:04 -05:00
Nicolas Williams
41b6c829f7 Fix missing .El in krb5.conf.5 2016-08-08 14:14:04 -05:00
Nicolas Williams
6d1571a3c4 Fix --disable-afs-support disable lib/kafs 2016-08-04 18:51:23 -05:00
Jeffrey Altman
f027fc834d Merge pull request #190 from DavidMulder/windows_code_ifdefs
The evp-w32.h header should not be included on all platforms
2016-08-02 18:30:21 -04:00
David Mulder
2bee5966ab The evp-w32.h header should not be included on all platforms 2016-08-02 16:12:46 -06:00
Jeffrey Altman
f0f24fdbb2 Merge pull request #188 from DavidMulder/disable_afs
--disable-afs-support doesn't really disable afs
2016-08-02 16:50:15 -04:00
David Mulder
d8080162ea --disable-afs-support doesn't really disable afs 2016-08-02 12:58:26 -06:00
Love Hörnquist Åstrand
c7ed0b719d Merge pull request #185 from emaste/master
Remove duplicate symbols from libroken version-script.map
2016-07-21 21:02:11 +02:00
Ed Maste
8ef0071d96 Remove duplicate symbols from libhx509 version-script.map
Commit 7758a5d0 (r21331) added semiprivate function
_hx509_request_to_pkcs10 twice.
2016-07-21 14:39:37 -04:00
Ed Maste
54e85ad099 Remove duplicate symbols from libroken version-script.map
Commit efed5633 (r24759) prefixed some symbols with rk_, but
introduced 6 duplicate symbols in the version script (because the
rk_-prefixed versions of the symbols were already present).
2016-07-21 14:36:59 -04:00
Jeffrey Altman
6234073499 add missing principal types
Add the WELLKNOWN and NT-HST-DOMAIN principal types to the nametype
table and asn.1

Change-Id: Ife9c3860f375bac1a06152b0d261c63ec071a763
2016-07-17 00:44:50 -04:00
Viktor Dukhovni
2d32982ed4 Fix slave boostrap from incomplete master log
When the master's log does not contain the complete history, slaves
that bootstrap from scratch encountered a loop, because the master
falsely assumed a race with log truncation.
2016-07-07 23:00:29 -04:00
Jeffrey Altman
f32fd2d56d kdc: fix AD -> Heimdal x-realm trusts again
The HDB_F_ALL_KVNOS flag is not getting set in _kdc_db_fetch() if
kvno_ptr == NULL.  Fix the conditional to ensure that one of
HDB_F_ALL_KVNOS or HDB_F_KVNO_SPECIFIED is set in the flags field.

Prior to this change cross-realm TGS_REQ failed with KRB5_GENERIC_ERROR
and e-text "encryption key has bad length".  With this change, the
cross-realm TGS_REQ succeeds.

Change-Id: I4216137a192032544dfbdada12b5c377603ca4b6
2016-06-23 13:36:31 -04:00
Mikhail T
9f6baf00f6 lib/krb5: Implement krb5_c_random_make_octets correctly
The function, found in lib/krb5/mit_glue.c, is currently using
krb5_generate_random_keyblock(). This compiles because warning-level is
not high enough, but does not work. At runtime the
krb5_generate_random_keyblock() interprets the second argument as the
krb5_enctype (rather than a length of anything) and tries to verify it.

When the length does not match any known enctype, as usually happens, the
function fails and returns an error. If the length happened to correspond
to an enctype, the function would likely crash due to misinterpreting its
third argument as a valid krb5_keyblock.

The change uses krb5_generate_random_block() instead. This function does
not return anything -- upon detecting failure it will cause the entire
application to exist instead...

Change-Id: I865a360037a513ce91abc7abba1dc554f844b464
2016-06-18 17:35:16 -04:00
Jeffrey Altman
b7cf5e7caf lib/krb5: do not fail set_config_files due to parse error
Follow Apple's lead and do not fail krb5_set_config_files() simply
because one of the files in the profile list fails to parse correctly.
Doing so can lead to hard to find failures and could lead to an end
user shooting themselves in the foot and no longer be able to login
to their system to fix it.

Parse as many of the files as we can.  Only fail krb5_set_config_files()
if init_context_from_config_file() fails.

Change-Id: I122664c6d707a5f926643808ba414bf4f681f8b8
2016-06-16 16:38:17 -04:00
Jeffrey Altman
cfc5b42bb1 Merge pull request #179 from abhinav-upadhyay/fix_month
Fix typo: Sepember -> September
2016-06-10 13:54:17 -05:00
Abhinav Upadhyay
1f89ce4973 Fix typo: Sepember -> September 2016-06-11 00:18:59 +05:30
Viktor Dukhovni
74f598e159 Set uber record nominal version when truncating
It needs to match the version of the last record saved and have a
reasonable timestamp.
2016-06-09 08:30:59 -04:00
Viktor Dukhovni
a5237e6940 Fix handling of uber record nominal version
When flushing the uber record, retain the current log version.  When the
uber record is the only (thus last) record in the log, return its nominal
version as the last version, not 0.  Upgrade the log if the current uber
record version number is not 0.
2016-06-09 07:04:01 -04:00
Nicolas Williams
316e0d2184 Store the canonical client princ in ipropd-slave
Otherwise we risk storing a name with the referral (empty) realm name,
which will then cause various knock-on effects, such as thinking that
the start_realm is "", and failing to find matching credentials in the
ccache.
2016-06-09 01:13:15 -04:00
Viktor Dukhovni
840dc40574 Refine name canonicalization
When storing credentials whose ticket principal is not equal to the
requested principal, store the ticket under both names not only when
the original realm is the referral realm, but more generally for any
difference at all.  This matches MIT behaviour.

Allow explicit name_canon rules to specify a realm to go with the
canonicalized hostname, if that realm is empty the effect is the
same "use-referrals"

Also fix segfault when no creds and debugging
2016-06-09 01:13:15 -04:00
Nicolas Williams
812b01b4ed Fix KDC segfault with OS X plugins
At least one "windc" plugin provided by OS X lacks a client_access()
entry point and caused the KDC to crash.  The KDC now checks for each
entry point in "windc" plugins and either falls back on alternative
default functionality or fails more gracefully than by crashing.
2016-06-09 01:13:15 -04:00
Nicolas Williams
2623cee389 Do not search system paths for non-ccapi plugins
On OS X anyways, since Heimdal cannot be built to replace the system
Kerberos implementation in OS X (even though it's based on Heimdal).

Heimdal plugins other than the CCAPI plugins have private ABIs with
strong coupling to the internals of the Heimdal libraries, thus using
system plugins in a non-system Heimdal is likely to end in tears (e.g.,
segfaults).

This means, for example, that OS X's plugins for PAC creation and
verification cannot be used by Heimdal.
2016-06-09 01:13:14 -04:00
Viktor Dukhovni
529a91d69a MacOS/X fixes 2016-06-09 01:13:14 -04:00
Viktor Dukhovni
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
Viktor Dukhovni
7d9fcb46b9 Ensure newly allocated ccache handles are zeroed
Otherwise, type-independent fields such as `initialized` have
uninitialized values, and incorrect behaviour may result.
2016-06-02 02:40:50 -04:00
Patrik Lundin
abad8d5700 kdc: fix _kdc_db_fetch when non-zero kvno specified
Prior change 83011252d7 which fixed
cross-realm trusts from AD to Heimdal removed the assignment of
'*kvno_ptr' to 'kvno' in the case where a non-zero key version
number is supplied by the caller.  This breaks cross-realm trusts
from Heimdal to another realm.

This change restores the missing assignment.

Change-Id: Ic041d9d797ba4c8c0c567da55066ba5d3d1874bb
2016-05-20 09:02:33 -04:00
Andrew Bartlett
5ddff2c532 Merge pull request #176 from urisimchoni/signed-kvno
Revert "KVNOs are krb5uint32 in RFC4120, make it so"
2016-05-17 19:05:20 +12:00
Andrew Bartlett
7ad8c26d27 Merge pull request #177 from jelmer/reproducible
Don't put system architecture in generated headers.
2016-05-16 11:09:11 +12:00
Jelmer Vernooij
0113798b18 Don't put system architecture in generated headers.
Including HOST causes the build to be unreproducible.
2016-05-15 23:04:49 +00:00
Andrew Bartlett
2ff110cfa6 Merge pull request #154 from metze-samba/heimdal-for-upstream
lib/krb5: allow predefined PAC_{LOGON_NAME,PRIVSVR_CHECKSUM,SERVER_CH…
2016-05-14 22:32:13 +12:00
Andrew Bartlett
b01d527a35 Merge pull request #171 from jelmer/parallel
Fix parallel builds.
2016-05-14 22:28:25 +12:00