Commit Graph

1699 Commits

Author SHA1 Message Date
Isaac Boukris
30d16fd151 krb5tgs: use string representation in logs
Found by binary printouts in logs.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-14 16:59:45 -06:00
Isaac Boukris
751f561604 Correct S4U2Self spelling in a comment
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-14 16:59:44 -06:00
Olly Betts
7ad6c01a8d Fix assorted typos 2018-12-14 17:30:14 -05:00
Luke Howard
73fde33757 KCM: restore support for Solaris doors IPC mechanism (#379)
This patch restores support for the Solaris doors IPC mechanism, removed
from KCM when lib/ipc was added.
2018-05-13 15:31:13 +10:00
Viktor Dukhovni
8ec4f23701 Hide principal names in errors with FAST 2017-12-05 19:01:04 -05:00
Viktor Dukhovni
1a6a6e462d Security: Avoid NULL structure pointer member dereference
This can happen in the error path when processing malformed AS
requests with a NULL client name.  Bug originally introduced on
Fri Feb 13 09:26:01 2015 +0100 in commit:

    a873e21d7c

    kdc: base _kdc_fast_mk_error() on krb5_mk_error_ext()

Original patch by Jeffrey Altman <jaltman@secure-endpoints.com>
2017-12-05 18:49:50 -05:00
Viktor Dukhovni
e014662651 Further improve kdc child process management
- Simplify child process creation rate limit by moving
  select_sleep() to happen right after the parent fork().

- Consider child pid table slots to be empty if the pid is
  non-positive, rather than just -1 or just 0.

- Log warnings should we ever spawn a child with no free
  slot to track it, or reap a child that does not match
  a tracked slot.
2017-10-30 18:39:23 -04:00
Viktor Dukhovni
d2130e3312 Handle long lines in dump files 2017-10-11 17:13:07 -05:00
Quanah Gibson-Mount
e7879208e4 Fixes https://github.com/heimdal/heimdal/issues/310, use PF_UNIX instead
of PF_LOCAL
2017-09-25 18:31:42 -05:00
Stefan Metzmacher
a79b59ba27 kdc: fix dh->q allocation check in get_dh_param()
Thanks to Doug Nazar <nazard@nazar.ca> for spotting this!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12986

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2017-09-25 18:10:29 -05:00
Jeffrey Altman
237cd892d9 kdc: unused pid element is (pid_t)-1 not zero
When the termination of a child process is observed by reap_kid() it
clears the pids[] element by assigning it the invalid pid value
(pid_t)-1. However, start_kdc() assumes that the unused pid[[] element
value is 0.  As a result, each pid[] element's associated child process
can only be restarted once since start_kdc() will not be able to locate
an unused element.

This change alters start_kdc() to initialize all elements of pids[] to
(pid_t)-1 and use that as the marker for unused elements.  By doing so
start_kdc() can properly record child process pids and indefinitely
restart child processes as necessary.

Change-Id: Ia93c9284ab21289994eca7fc9cf1278be7c00683
2017-07-27 22:03:51 -05:00
Viktor Dukhovni
3910c23378 Retain ret != 0 when capaths finds no match. 2017-07-12 07:27:31 -04:00
Jeffrey Altman
6f3ab01c75 check return copy_Realm, copy_PrincipalName, copy_EncryptionKey
The ASN.1 functions copy_Realm(), copy_PrincipalName() and
copy_EncryptionKey() can fail.  Check the return and perform error
handling as appropriate.

Change-Id: I2b3629d19db96eb41d1cd554cef1dca99745e753
2017-04-29 15:24:42 -04:00
Jeffrey Altman
12afd9c4b7 include field separators in comparison
When comparing the first component of a multi-component
string that uses a field separator (e.g., '/' or ':'), be sure
to include the separator in the comparison to ensure that the
comparison does not succeed due to a prefix match.

Change-Id: Ieec3e73cb015a83bb652ec11cd7d83e57755c3d2
2017-04-29 01:05:59 -04:00
Viktor Dukhovni
b1e699103f Fix transit path validation CVE-2017-6594
Commit f469fc6 (2010-10-02) inadvertently caused the previous hop realm
to not be added to the transit path of issued tickets.  This may, in
some cases, enable bypass of capath policy in Heimdal versions 1.5
through 7.2.

Note, this may break sites that rely on the bug.  With the bug some
incomplete [capaths] worked, that should not have.  These may now break
authentication in some cross-realm configurations.
2017-04-13 18:06:39 -05:00
Jeffrey Altman
ebae52f3cc kdc: de_http stricter parsing
In de_http() treat any sequence of '%' not followed by two hex digits
as invalid.

Change-Id: I812665c1a2806f8daba06d267bbee57287aa2314
2017-03-13 19:17:29 -04:00
Jeffrey Altman
ec39b832ff kdc: fix kx509 service principal match
Each KDC is a kx509 server.  The service principal must be of the
form

  kca_service/<localhost.domain>@<DEFAULT_REALM>

where localhost.domain is the hostname returned by gethostname()
and <DEFAULT_REALM> is one of the realms for which the KDC has a service
principal "kca_service/<localhost.domain>".

The matching code was broken by a5e77c578e
when krb5_sname_to_principal() began to always return a referral
principal.

Since the second component is a host name update the default principal
type for service "kca_service" to be KRB5_NT_SRV_HST.

Change-Id: I6bd5f90b674ebb7220d8efafa6d339fdc21e1a07
2017-01-27 00:37:08 -05:00
Jeffrey Altman
303c62533f kdc: _kdc_do_kx509 fix use after free error
In _kdc_do_kx509() do not free 'principal' until after its last
use.  Move declaration to top of function and free it during the
common exit processing.

Introduced by 10a5976e45.

Change-Id: Iaf000eb090b0fa523f04a4864c6b17058d922995
2017-01-13 15:00:46 -05:00
Viktor Dukhovni
7dc4481ed2 Avoid interposing pidfile(), use rk_pidfile() instead 2016-12-19 19:10:49 -05:00
Nicolas Williams
5f2e4fb368 kdc: add --testing option for leak testing
The kdc nowadays forks and restarts worker children.  This is nice, but
for leak checking in tests on OS X with leak(1) we really need the
worker to be the one process.
2016-12-06 22:44:23 -06:00
Nicolas Williams
f38089257b Misc fixes (coverity) 2016-11-20 17:43:51 -06:00
Jeffrey Altman
a1d3ab05c4 kdc: start_kdc avoid warning
The prior structure of the code was safe but can appear otherwise to
static analyzers since the assignment to pids[i] occurs after exitting
the for() loop.

While here use calloc() instead of malloc()/memset().

Change-Id: I8455aa259fd8c7c17778827937ec26127fe0785c
2016-11-19 09:57:14 -05:00
Jeffrey Altman
348c425686 kdc: tgs_build_reply remove unused variable
tgt_realm is assigned a value but is never used in tgs_build_reply().

Change-Id: I882a127f40947b9c8755af5c28f1b19d66263b4c
2016-11-19 02:01:42 -05:00
Jeffrey Altman
cdf5d324e3 kdc: _kdc_fast_unwrap_request leaks 'buf'
Change-Id: If4d3852112dadc331db1d3601b2c7bd6b3129429
2016-11-18 23:59:47 -05:00
Jeffrey Altman
a3e95f16b7 krb5: _kdc_encode_reply leaks 'buf' if early exit
Change-Id: I9e94535cd974ba463f813982325440a4ad8ba217
2016-11-18 23:53:53 -05:00
Nicolas Williams
953dc07391 Round #1 of scan-build warnings cleanup 2016-11-15 21:27:20 -06:00
Nicolas Williams
9e2b696190 Make kdc name type strictness configurable 2016-11-14 21:29:47 -06:00
Jeffrey Altman
020f2c733e kdc: principals of type NT-UNKNOWN can be anonymous
The _kdc_is_anonymous() helper function must take into account
that principals of type NT-UNKNOWN can match any other principal
type including NT-WELLKNOWN.

Change-Id: I6085b9471f6f1d662119e359491bbdce629ef048
2016-11-14 21:29:47 -06:00
Matthieu Hautreux
6c0306843d krb5tgs: let TGS_REQ with NULL caddr returns an addessless ticket
When processing a request, current tgs_make_reply uses the requested
set of addrs of the request to establish the set of addresses to
associate with the ticket in reply.

However, when the request input set of addrs is NULL, it reverts to
using the TGT set of addresses instead. As a result, it is not
possible to acquire an addressless TGS (or forwarded TGT) using a
TGT that is addressed.

This patch remove the fallback ensuring that a TGS_REQ with a set
of addrs set to NULL enables to acquire an addressless ticket.
2016-11-08 15:31:00 -05:00
Luke Howard
7b720cf61c krb5: implement draft-ietf-kitten-aes-cts-hmac-sha2-07 2016-10-08 08:17:11 +02:00
Viktor Dukhovni
09c4e516bf Further polish and docs for hierarchical capaths 2016-08-10 21:09:15 -04:00
Viktor Dukhovni
4b4036c9a6 Implement hierarchical referrals 2016-08-08 16:29:29 -05: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
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
Viktor Dukhovni
529a91d69a MacOS/X fixes 2016-06-09 01:13:14 -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
b01d527a35 Merge pull request #171 from jelmer/parallel
Fix parallel builds.
2016-05-14 22:28:25 +12:00
Uri Simchoni
f227586b80 tgs_build_reply: fix signed-unsigned mismatch
A KVNO is unsigned and this is reflected in the internal
interfaces. However, for compatibility reasons its encoding
is signed and this creates a pointer mismatch when passing a
kvno pointer to _kdc_db_fetch.

Signed-off-by: Uri Simchoni <uri@samba.org>
2016-05-08 07:58:11 +03:00
Viktor Dukhovni
1017a594ef Use OpenSSL include path as needed
For consistency make "-I" part of the macro value set by autoconf.

For now, don't attempt to handle OpenSSL rpath in cf/crypto.m4.
That's much easier by just setting LDFLAGS when running configure.
Otherwise too many Makefiles to edit and libtool and automake do
their best to undo the rpath.
2016-05-07 05:29:12 -04:00
Jelmer Vernooij
a460601ee3 Properly fix parallel builds. 2016-04-20 12:15:27 +00:00
Jeffrey Altman
ce4fd05b12 fixup pkinit-ec.c (kdc and lib/krb5) includes
All source files must start with

  include <config.h>
  include <roken.h>

when krb5_locl.h or kdc_locl.h are includes, they must come before
other Heimdal include files.

Do not include stdint.h when roken.h is included.
Do not include config.h more than once.

Change-Id: I0baecb5d48317996f48b1a6c41b051f42f2fde61
2016-04-17 17:10:08 -05:00
Nicolas Williams
1103fb19df Fix re-definition of keyex enum 2016-04-16 16:58:08 -05:00
Nicolas Williams
490337f4f9 Make OpenSSL an hcrypto backend proper
This adds a new backend for libhcrypto: the OpenSSL backend.

Now libhcrypto has these backends:

 - hcrypto itself (i.e., the algorithms coded in lib/hcrypto)
 - Common Crypto (OS X)
 - PKCS#11 (specifically for Solaris, but not Solaris-specific)
 - Windows CNG (Windows)
 - OpenSSL (generic)

The ./configure --with-openssl=... option no longer disables the use of
hcrypto.  Instead it enables the use of OpenSSL as a (and the default)
backend in libhcrypto.  The libhcrypto framework is now always used.

OpenSSL should no longer be used directly within Heimdal, except in the
OpenSSL hcrypto backend itself, and files where elliptic curve (EC)
crypto is needed.

Because libhcrypto's EC support is incomplete, we can only use OpenSSL
for EC.  Currently that means separating all EC-using code so that it
does not use hcrypto, thus the libhx509/hxtool and PKINIT EC code has
been moved out of the files it used to be in.
2016-04-15 00:16:17 -05:00
Nicolas Williams
69eb97a92d kdc: num_kdc_procs < 1 -> use NCPUs 2016-02-29 19:13:12 -06:00
Viktor Dukhovni
54d37fdba6 Fix memory leak 2016-02-26 15:43:13 -05:00
Nicolas Williams
b4cf4de807 Fix warnings (clang 3.6) 2016-02-26 01:04:31 -06:00
Nicolas Williams
c6f24e99f0 Revamp cf/db.m4; test LMDB 2016-02-26 00:55:32 -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
Nicolas Williams
1575f4f69a KDC: Don't confuse master process with master 2016-01-21 12:43:31 -06:00