]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
5 years agoUse two queues for concurrent t_otp.py daemons 1046/head
Greg Hudson [Wed, 4 Mar 2020 22:18:51 +0000 (17:18 -0500)] 
Use two queues for concurrent t_otp.py daemons

t_otp.py occasionally fails during the #8708 regression test, reading
a true answer instead of the expected false answer during the first
verify() call.  Most likely the daemons are writing their answers to
the shared queue out of order.  Use a separate queue for the second
daemon to ensure correct correlation of results.

5 years agoRefresh manually acquired creds from client keytab 1044/head
Robbie Harwood [Wed, 26 Feb 2020 23:27:17 +0000 (18:27 -0500)] 
Refresh manually acquired creds from client keytab

If a client keytab is present but credentials are acquired manually,
the credentials would not be refreshed because no refresh_time config
var is set in the cache.  Change kg_cred_time_to_refresh() to attempt
a refresh from the client keytab on any credentials which will expire
in the next 30 seconds.

[ghudson@mit.edu: adjused code and added test case]

ticket: 7976

5 years agoFix Linux build error with musl libc 1042/head
TBK [Wed, 26 Feb 2020 20:12:45 +0000 (21:12 +0100)] 
Fix Linux build error with musl libc

Commit bf5953c549a6d279977df69ffe89b2ba51460eaf caused a build failure
on non-glibc Linux build environments.  Change the conditionalization
so that __GLIBC_PREREQ will only be used if it is defined.

[ghudson@mit.edu: simplified conditionals; rewrote commit message]

ticket: 8880 (new)
tags: pullup
target_version: 1.18-next

5 years agoAllow deletion of require_auth with LDAP KDB 1043/head
Greg Hudson [Tue, 25 Feb 2020 16:32:09 +0000 (11:32 -0500)] 
Allow deletion of require_auth with LDAP KDB

In update_ldap_mod_auth_ind(), if there is no string attribute value
for require_auth, check for krbPrincipalAuthInd attributes that might
need to be removed.  (This will only work if the entry is loaded and
then modified, but that is the normal case for an existing entry.)

Move the update_ldap_mod_auth_ind() call inside the tl-data
conditional (which should perhaps be a check for KADM5_TL_DATA in the
mask instead).  A modification which did not intend to update tl-data
should not remove the krbPrincipalAuthInd attributes.

Change get_int_from_tl_data() to to zero its output so that it can't
leave a garbage value behind if it returns 0 (as it does if no
KDB_TL_USER_INFO tl-data is present).

Based on a patch by Glenn Machin.

ticket: 8877
tags: pullup
target_version: 1.18-next
target_version: 1.17-next

5 years agoAllow certauth modules to set hw-authent flag
Greg Hudson [Mon, 24 Feb 2020 20:58:59 +0000 (15:58 -0500)] 
Allow certauth modules to set hw-authent flag

In PKINIT, if a certauth module returns KRB5_CERTAUTH_HWAUTH from its
authorize method, set the hw-authent flag in the ticket.

ticket: 8879 (new)

5 years agoFix AS-REQ checking of KDB-modified indicators 1040/head
Greg Hudson [Wed, 19 Feb 2020 20:36:38 +0000 (15:36 -0500)] 
Fix AS-REQ checking of KDB-modified indicators

Commit 7196c03f18f14695abeb5ae4923004469b172f0f (ticket 8823) gave the
KDB the ability to modify auth indicators, but it happens after the
asserted indicators are checked against the server principal
requirements.  In finish_process_as_req(), move the call to
check_indicators() after the call to handle_authdata() so that the
final indicator list is checked.

For the test case, add string attribute functionality to the test KDB
module, and fix a bug where test_get_principal() would return failure
if a principal has no keys.  Also add a test case for AS-REQ
enforcement of normally asserted auth indicators.

ticket: 8876 (new)
tags: pullup
target_version: 1.18-next

5 years agoReplace gssrpc tests with a Python script 1039/head
Greg Hudson [Sun, 16 Feb 2020 01:34:23 +0000 (20:34 -0500)] 
Replace gssrpc tests with a Python script

Replace the dejagnu RPC test framework with a short Python script to
do the same tests as fullrun.exp and gsserr.exp.  Modify the server
test program to facilitate use by k5test.py.

expire.exp, together with a comment in the client test program, was
designed to test a libdb2 btree bug via the gssrpc server-side
authentication code.  That code was subsequently changed not to use
libdb2, before it was merged into the main krb5 tree (in revision 1.23
of svc_auth_gssapi.c, according to the changelog removed in commit
2a43d772be1e45faa8e488d436b6e867371563fb).  Remove the comment and do
not replace that test sequence.

5 years agoRun CI builds on pull requests
Greg Hudson [Tue, 18 Feb 2020 00:09:17 +0000 (19:09 -0500)] 
Run CI builds on pull requests

5 years agoUse GitHub Actions for CI 1038/head
Michael Mattioli [Tue, 26 Nov 2019 02:28:57 +0000 (21:28 -0500)] 
Use GitHub Actions for CI

Use Github Actions instead of Travis and AppVeyor.

In the Windows installer config, add support for Visual Studio 2019
(aka 16.0).

[ghudson@mit.edu: switched to Ubuntu 18.04 for Linux builds; removed
macOS build job for now; added more packages to avoid skipping tests;
made it easier to see skipped tests and to see files not cleaned;
added make install command; adjusted Windows build path]

5 years agoAlways use S4U2Proxy second ticket parsed authdata
Isaac Boukris [Thu, 30 Jan 2020 18:38:44 +0000 (19:38 +0100)] 
Always use S4U2Proxy second ticket parsed authdata

When the KDC handles an S4U2Proxy request, if the KDB module returned
parsed authdata for the header ticket and not for the second ticket,
we could erroneously pass the header ticket's parsed authdata to
handle_authdata().  Make sure we always pass the parsed authdata for
the second ticket.

[ghudson@mit.edu: added comment; rewrote commit message]

ticket: 8874 (new)
tags: pullup
target_version: 1.18

5 years agoDon't assume OpenSSL failures are memory errors 1035/head
Robbie Harwood [Wed, 5 Feb 2020 17:56:00 +0000 (12:56 -0500)] 
Don't assume OpenSSL failures are memory errors

More recent versions of OpenSSL can fail for other reasons.  Indicate
a crypto-related error occurred rather than a memory error to aid
debugging.

ticket: 8873 (new)
tags: pullup
target_version: 1.18
target_version: 1.17-next

5 years agoRefactor KDC authdata list management helpers 1036/head
Greg Hudson [Wed, 5 Feb 2020 23:46:11 +0000 (18:46 -0500)] 
Refactor KDC authdata list management helpers

Remove the unused concat_authorization_data().  Split merge_authdata()
into two helpers, one to destructively merge without filtering and one
to add copied elements while filtering out KDC-only authdata types.
Remove context parameters where they aren't needed (taking advantage
of knowledge that some libkrb5 functions don't use their context
parameters).

5 years agoTest that PAC is the first authdata element 1033/head
Isaac Boukris [Sat, 1 Feb 2020 12:21:39 +0000 (13:21 +0100)] 
Test that PAC is the first authdata element

In the test KDB module, set the PAC as the first authdata element.  In
adata.c, add PAC service verification and verify that a PAC does not
appear in authdata elements after the first.

[ghudson@mit.edu: minor style changes; edited commit message]

ticket: 8872

5 years agoPut KDB authdata first
Isaac Boukris [Sat, 1 Feb 2020 15:13:30 +0000 (16:13 +0100)] 
Put KDB authdata first

Windows services, as well as some versions of Samba, may refuse
tickets if the PAC is not in the first AD-IF-RELEVANT container.  In
fetch_kdb_authdata(), change the merge order so that authdata from the
KDB module appears first.

[ghudson@mit.edu: added comment and clarified commit message]

ticket: 8872 (new)
tags: pullup
target_version: 1.18
target_version: 1.17-next

5 years agoRemove private mutators for context enctypes 1028/head
Robbie Harwood [Thu, 23 Jan 2020 18:09:00 +0000 (13:09 -0500)] 
Remove private mutators for context enctypes

krb5_set_default_in_tkt_ktypes() and krb5_set_default_tgs_ktypes() are
not part of the API and are only used in test programs, so remove
them.  Also remove the now-unused in_tkt_etypes field from
krb5_context.  Update test suite consumers.

Fix a minor bug wherein the etinfo executable would not correctly
print its usage text.

[ghudson@mit.edu: adapted some tests rather than remove them]

5 years agoZero length fields when freeing object contents 1031/head
Isaac Boukris [Sun, 26 Jan 2020 20:49:47 +0000 (21:49 +0100)] 
Zero length fields when freeing object contents

In krb5_free_data_contents() and krb5_free_checksum_contents(), zero
the length as well as the data pointer to leave the object in a valid
state.  Add asserts to existing test harnesses to verify the new
behavior.

In the krb5 GSS mech's kg_checksum_channel_bindings(), remove the code
to reallocate the checksum with xmalloc(), as it relied on
krb5_free_checksum_contents() leaving the object in an invalid state.
This code was added in commit a30fb4c4400f13a2690df7ef910b7ac0ccbcf194
to match an xfree() call, but commit
29337e7c7b796685fb6a03466d32147e17aa2d16 replaced that xfree() with a
krb5_free_checksum_contents().  (In addition, the xmalloc and xfree
wrappers never evolved to do anything beyond malloc and free.)

In kpropd's recv_database(), don't free outbuf until we are done using
its length.

[ghudson@mit.edu: rewrote commit message; edited doxygen comment
changes to mention version]

ticket: 8871 (new)

5 years agoHonor transited-policy-checked flag in servers 1030/head
Greg Hudson [Fri, 24 Jan 2020 15:25:18 +0000 (10:25 -0500)] 
Honor transited-policy-checked flag in servers

For consistency with Heimdal and simplicity of server configuration,
do not check the transited field in krb5_rd_req() if the
transited-policy-checked flag is set in the ticket.

Add a cross-realm test using the gcred and rdreq harnesses to test
server transited processing.  Also fix the KDC capaths case so that
the client actually doesn't know the path to the server realm.  In
k5test.py, adjust _cfg_merge() to remove keys mapped to None in the
second dictionary (instead of mapping them to None in the result), so
that deleting whole sections works.  Remove the corresponding check
for None in _write_cfg_section() as it is no longer needed.

ticket: 8870 (new)
tags: pullup
target_version: 1.18

5 years agoFurther simplify test KDB module authdata code 1029/head
Greg Hudson [Thu, 23 Jan 2020 19:49:24 +0000 (14:49 -0500)] 
Further simplify test KDB module authdata code

Commit 94f7c9705879500b1dc8dda8592490efce05688f simplified the
generation of authdata elements, but left behind some unnecessary
conditionalization when assembling the elements into a list, causing a
Coverity defect.  Further simplify the code.

ticket: 8868

5 years agoApply permitted_enctypes to KDC request enctypes 1025/head
Robbie Harwood [Tue, 14 Jan 2020 19:23:00 +0000 (14:23 -0500)] 
Apply permitted_enctypes to KDC request enctypes

permitted_enctypes was initially intended only to restrict the
processing of AP requests (and was later applied to KDB key data
searches so that the KDC wouldn't issue a ticket it would refuse to
accept).  Because the documentation was never clear about its scope,
many configurations assume that permitted_enctypes also applies to
clients.

In light of the existing configurations, take the simple way out and
use permitted_enctypes as the default for default_tkt_enctypes and
default_tgs_enctypes.  Update the documentation, add a test to
explicitly check the new behavior, and remove now-unnecessary
configuration from the test suite.

[ghudson@mit.edu: unrolled helper function; edited documentation and
commit message; simplified test case]

ticket: 8869 (new)
tags: pullup
target_version: 1.18

5 years agoAdd tests for cross-realm RBCD request authdata 1027/head
Isaac Boukris [Sat, 18 Jan 2020 01:54:32 +0000 (02:54 +0100)] 
Add tests for cross-realm RBCD request authdata

ticket: 8866

5 years agoAllow cross-realm RBCD with PAC and other authdata
Isaac Boukris [Wed, 15 Jan 2020 10:14:00 +0000 (11:14 +0100)] 
Allow cross-realm RBCD with PAC and other authdata

For cross-realm S4U2Proxy requests, require a PAC to be present to
bypass signedpath verification, but do not require it to be the only
authdata element.  For within-realm requests, add and verify
signedpath authdata regardless of the presence of a PAC.

Simplify the test KDB authdata module and the existing RBCD tests as
we no longer need a way to suppress the test module's KDB authdata.

[ghudson@mit.edu: rewrote commit message; reordered a condition for
efficiency]

ticket: 8868 (new)
tags: pullup
target_version: 1.18

5 years agoFix KDC crash in handle_signticket
Isaac Boukris [Wed, 15 Jan 2020 12:54:44 +0000 (13:54 +0100)] 
Fix KDC crash in handle_signticket

Commit d47f7dba3779c9e36e1dedaac830dac1dd248fb3 changed the parameters
passed to sign_authdata() for S4U2Proxy requests so that client is the
entry for the impersonated client (not the impersonator), and added a
new parameter for the impersonator entry.  It should have changed the
call to handle_signticket() to use the impersonator entry.  Fix the
handle_signticket() call, and change some parameter names to more
clearly indicate the flow of subject_server from process_tgs_req() to
handle_authdata() to its helpers.

[ghudson@mit.edu: edited commit message]

ticket: 8867 (new)
tags: pullup
target_version: 1.18

5 years agoAdd tests for S4U request-authdata handling 1013/head
Isaac Boukris [Thu, 12 Dec 2019 02:20:44 +0000 (03:20 +0100)] 
Add tests for S4U request-authdata handling

In adata.c, look up the server in the keytab by ticket->server (which
has the canonicalized realm), to allow testing of cross-realm RBCD
(although unused for now).

In s4u2proxy.c, set KRB5_GC_CANONICALIZE to support RBCD, and add an
authdata request option.  Add an s4u2self test harness with authdata
request option.

[ghudson@mit.edu: minor code simplifications; edited commit message]

ticket: 8866

5 years agoFix S4U client authdata handling
Isaac Boukris [Thu, 12 Dec 2019 02:40:04 +0000 (03:40 +0100)] 
Fix S4U client authdata handling

Only send client authdata in the initial request, and note
request authdata in out_creds.

ticket: 8866 (new)
tags: pullup
target_version: 1.18

5 years agoFix error handling in gssint_mechglue_init() 1023/head
Greg Hudson [Sat, 11 Jan 2020 04:47:34 +0000 (23:47 -0500)] 
Fix error handling in gssint_mechglue_init()

In the unlikely event that one of the functions called by
gssint_mechglue_init() returns an error, return that error to the
caller rather than continuing on and discarding the error status.
Returning success when some of the operations failed could fool the
library finalizer into thinking that initialization completed.
Reported by Spencer Malone.

ticket: 8864 (new)
tags: pullup
target_version: 1.18
target_version: 1.17-next

5 years agoRestrict test KDB to local principals 1024/head
Isaac Boukris [Sun, 12 Jan 2020 17:57:10 +0000 (18:57 +0100)] 
Restrict test KDB to local principals

Ignoring the lookup realm for principal matching could cause the test
KDB module to successfully look up entries (with the correct key data)
for principals that a real KDB wouldn't have, such as krbtgt/B@A
within realm C.  Add a realm check to test_get_principal(), allowing
only local principal names or incoming cross-TGS names.

[ghudson@mit.edu: changed error code; rewrote commit message]

5 years agoCheck cross-realm TGT name for RBCD requests
Isaac Boukris [Sun, 12 Jan 2020 16:32:09 +0000 (17:32 +0100)] 
Check cross-realm TGT name for RBCD requests

ticket: 8865 (new)
tags: pullup
target_version: 1.18

5 years agoUpdates for krb5-1.19-prerelease
Greg Hudson [Wed, 8 Jan 2020 19:45:27 +0000 (14:45 -0500)] 
Updates for krb5-1.19-prerelease

5 years agoUpdate features list for 1.18
Greg Hudson [Wed, 8 Jan 2020 19:20:15 +0000 (14:20 -0500)] 
Update features list for 1.18

5 years agoFix LDAP policy enforcement of pw_expiration 1016/head
Robbie Harwood [Tue, 17 Dec 2019 22:37:41 +0000 (17:37 -0500)] 
Fix LDAP policy enforcement of pw_expiration

In the LDAP backend, the change mask is used to determine what LDAP
attributes to update.  As a result, password expiration was not set
from policy when running during addprinc, among other issues.
However, when the mask did not contain KADM5_PRINCIPAL, pw_expiration
would be applied regardless, which meant that (for instance) changing
the password would cause the password application to be applied.

Remove the check for KADM5_PRINCIPAL, and fix the mask to contain
KADM5_PW_EXPIRATION where appropriate.  Add a regression test to
t_kdb.py.

[ghudson@mit.edu: also set KADM5_ATTRIBUTES for randkey and setkey
since they both unset KRB5_KDB_REQUIRES_PWCHANGE; edited comments and
commit message]

ticket: 8861 (new)
tags: pullup
target_version: 1.17-next

5 years agoAllow kprop over NATs 1022/head
Greg Hudson [Fri, 3 Jan 2020 23:17:09 +0000 (18:17 -0500)] 
Allow kprop over NATs

In kpropd, don't set a remote address in the auth context, so that
propagation can work if the client address is changed by a NAT.

ticket: 8860 (new)

5 years agoFix handling of invalid CAMMAC service verifier 1021/head
Jeffrey Arbuckle [Sun, 22 Dec 2019 03:59:20 +0000 (22:59 -0500)] 
Fix handling of invalid CAMMAC service verifier

In extract_cammacs(), avoid a null dereference if the CAMMAC service
verifier is invalid or the CAMMAC is empty.

ticket: 8856
tags: pullup
target_version: 1.17-next

5 years agoWork around macOS SIP in the test suite 1020/head
Greg Hudson [Thu, 19 Dec 2019 18:52:32 +0000 (13:52 -0500)] 
Work around macOS SIP in the test suite

In macOS 10.11 and later with System Integrity Protection enabled,
system programs (including the shell) purge DYLD_LIBRARY_PATH from the
environment at startup.  As a result, any part of "make check" which
runs via a shell script must explicitly restore the runtime
environment.  Add a common rule for runenv.sh, and create and source
it where shell scripts are run.  Dejagnu's runtest is a shell script,
so create a tcl file for the kadmin and RPC unit tests and source it
from unix.exp.  Avoid using the shell to run commands in several
places.  Use return_trace=True for tests that previously indirected
through /usr/bin/env.

Do not include <malloc.h> in t_parse_host_string.c, as it does not
exist on macOS and is not needed.

Skip the iprop tests on macOS when SIP is enabled, as signal
restrictions appear to prevent the kpropd child process from informing
the parent process that a full resync has completed.

In net-server.c, set SO_REUSEPORT as well as SO_REUSEADDR on listener
sockets.  Otherwise the krb5kdc processes run by the test suite
sometimes fail to start with "address in use" errors.

In configure.ac, only generate po/Makefile if we will descend into it.

5 years agoAdd return_trace option to k5test.py
Greg Hudson [Tue, 7 Jan 2020 20:05:08 +0000 (15:05 -0500)] 
Add return_trace option to k5test.py

If return_trace=True is specified when running a command in a Python
test, collect the trace output and return it in a tuple with the
regular output.

5 years agoMake IPv6 pktinfo work on macOS
Greg Hudson [Fri, 20 Dec 2019 21:26:22 +0000 (16:26 -0500)] 
Make IPv6 pktinfo work on macOS

Define __APPLE_USE_RFC_3542 to expose the definition of IPV6_PKTINFO
on macOS.

ticket: 8349

5 years agoFix xdr_bytes() strict-aliasing violations 1012/head
Greg Hudson [Tue, 10 Dec 2019 17:06:05 +0000 (12:06 -0500)] 
Fix xdr_bytes() strict-aliasing violations

When xdr_bytes() is used for a gss_buffer_desc object, a temporary
character pointer must be used for the data value to avoid a strict
aliasing violation.

When xdr_bytes() is used for a krb5_keyblock object, a temporary
character pointer must also be used, even though the data pointer is
of type unsigned char *, to avoid a clang warning on macOS due to the
"#pragma pack" declaration in krb5.h.

5 years agoAdd NegoEx assertion to squash defect
Greg Hudson [Mon, 9 Dec 2019 16:42:47 +0000 (11:42 -0500)] 
Add NegoEx assertion to squash defect

Coverity sees negoex_init() test whether input_token is null before
parsing messages, then dereference input_token in verify_checksum().
Of course verify_checksum() will not find a checksum message if no
messages were parsed.  Add an assert to squash the false positive
forward-null defect.

5 years agoFix error return case in serialization code
Greg Hudson [Mon, 9 Dec 2019 16:33:57 +0000 (11:33 -0500)] 
Fix error return case in serialization code

One of the changes in commit 81e47875e3de0e52fbb11d61ef30a9406497af73
unintentionally caused the return value of profile_ser_externalize()
to be ignored.

5 years agoRemove KRB5_KDB_FLAG_ALIAS_OK 1018/head
Isaac Boukris [Wed, 25 Dec 2019 23:23:21 +0000 (00:23 +0100)] 
Remove KRB5_KDB_FLAG_ALIAS_OK

It is simpler and more consistent with Windows to let the KDB module
always return aliases, and use KDC logic (already present) to decide
whether to use the requested or canonical principal name in the
ticket.

With the removal of this flag, "kinit alias" (without the -C flag)
against the LDAP KDB module will issue a ticket for the alias name,
instead of failing with a "client not found" error.

[ghudson@mit.edu: edited comments; wrote commit message]

ticket: 8859 (new)

5 years agoDo not always canonicalize enterprise principals
Isaac Boukris [Sat, 2 Nov 2019 12:32:32 +0000 (13:32 +0100)] 
Do not always canonicalize enterprise principals

When processing an AS request in the KDC, do not assume
KRB5_KDB_FLAG_CANONICALIZE for enterprise client names.  This change
allows the KDB module to only canonicalize enterprise client names if
the canonicalize flag was set on the request, as Windows does.  The
KDB module may check the principal type and apply canonicalization as
appropriate.

[ghudson@mit.edu: edited comments; rewrote commit message]

ticket: 8858 (new)

5 years agoDon't warn in kadmin when no policy is specified 1019/head
Robbie Harwood [Thu, 19 Dec 2019 22:49:05 +0000 (17:49 -0500)] 
Don't warn in kadmin when no policy is specified

Not having policy defined is a normal occurrence.  While it's a useful
message to log in case it's unexpected, the current form is
unnecessarily alarmist.

ticket: 8857 (new)

5 years agoRemove unused kadmin and RPC test scripts 1015/head
Greg Hudson [Thu, 19 Dec 2019 07:29:11 +0000 (02:29 -0500)] 
Remove unused kadmin and RPC test scripts

5 years agoSimplify keytab creation in kadmin and RPC tests
Greg Hudson [Thu, 19 Dec 2019 07:25:15 +0000 (02:25 -0500)] 
Simplify keytab creation in kadmin and RPC tests

In init_db and init.exp, do not create an ovsec_adm.keytab; kadmind
has authenticated directly against the KDB since commit
416d9a774090ee78c30a844025887bd2b9e79d16.  Since we no longer create
ovsec_adkm principals, perform the deletion and recreation tests with
kadmin/ principals.

In helpers.exp, use kadmin to create the server keytab file, instead
of using make-host-keytab.pl.

Remove environment variable settings for make-host-keytab.pl from
scripts that no longer use it.

5 years agoIn mkrel, build documentation with python3
Greg Hudson [Wed, 11 Dec 2019 17:09:27 +0000 (12:09 -0500)] 
In mkrel, build documentation with python3

After commit 95830231758de259abbbccedbac01613f578768a, the
documentation cannot be built with Python 2.  Run make with
"PYTHON=python3" to ensure that we use Python 3.

5 years agoAdd NegoEx tests 980/head
Greg Hudson [Fri, 27 Sep 2019 15:04:45 +0000 (11:04 -0400)] 
Add NegoEx tests

Add a mock NegoEx-only GSS module, a test program which establishes a
SPNEGO context, and a Python script to exercise a variety of NegoEx
negotiation scenarios.

ticket: 8851

5 years agoImplement NegoEx
Luke Howard [Wed, 26 Dec 2018 11:52:18 +0000 (22:52 +1100)] 
Implement NegoEx

Implement draft-zhu-negoex.  Mechanisms supporting the NegoEx GSS
extensions will be negotiated only through NegoEx, unless they assert
the GSS_C_MA_NEGOEX_AND_SPNEGO mech attribute, in which case they may
also be negotiated directly via SPNEGO.

ticket: 8851

5 years agoQualify short hostnames when not using DNS 1010/head
Greg Hudson [Sat, 30 Nov 2019 01:39:38 +0000 (20:39 -0500)] 
Qualify short hostnames when not using DNS

When DNS forward canonicalization is turned off or fails, qualify
single-component hostnames with the first DNS search domain.  Add the
qualify_shortname relation to override this suffix.

For one of the tests we need to disable qualification, which is
accomplished with an empty value.  Adjust k5test.py to correctly emit
empty values when writing profiles.

ticket: 8855 (new)

5 years agoImprove type safety of serialization code 1011/head
Greg Hudson [Tue, 3 Dec 2019 20:32:29 +0000 (15:32 -0500)] 
Improve type safety of serialization code

Remove the serialization table from krb5_context, the functions to
find and register serializers, and the polymorphic serialization
functions.  Instead, directly call per-type serialization functions
for the type of object we need to serialize.

Remove the krb5_context parameter from most serialization functions as
the interfaces are not public and the context is not needed.

Remove the ccache, keytab, and rcache serialization handlers as they
were not used.

In t_ser.c, repeat the externalize-internalize-reexternalize logic for
each type, but simplify the code by aborting on failure and removing
the verbose flag.

The krb5_context and krb5_keyblock sizing functions both reported an
extra four bytes.  The new test program does not tolerate that
inconsistency, so fix them.

5 years agoVarious gssalloc fixes 1008/head
Greg Hudson [Sat, 23 Nov 2019 16:42:59 +0000 (11:42 -0500)] 
Various gssalloc fixes

The DEBUG_GSSALLOC version of gssalloc_realloc() must add the sentinel
size to the byte count.

The mechglue gss_decapsulate_token(), gss_encapsulate_token(), and
gss_export_sec_context() must use gssalloc_malloc() to allocate
output buffers.

The krb5 mech's gss_export_name_composite() and gss_pseudo_random()
implementations must use gssalloc_malloc() to allocate output buffers.

SPNEGO's gss_display_status() implementation must use gssalloc for the
output buffer.

The sample GSS server must use gss_release_buffer() to free the result
of gss_export_sec_context().

ticket: 8852 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

5 years agoInstall gssapi/gssapi_alloc.h properly 1002/head
Greg Hudson [Sun, 17 Nov 2019 02:41:32 +0000 (21:41 -0500)] 
Install gssapi/gssapi_alloc.h properly

Release 1.10 added gssapi_alloc.h, but only added it to "make install"
for Windows, not to the wix installer or to the regular install.

ticket: 8849 (new)

5 years agoSimplify SPNEGO get_available_mechs() 1006/head
Luke Howard [Thu, 21 Nov 2019 22:45:46 +0000 (17:45 -0500)] 
Simplify SPNEGO get_available_mechs()

Exclude all negotiation mechanisms when getting the set of available
mechs, avoiding the need to make a copy and specifically exclude
SPNEGO.

[ghudson@mit.edu: extracted this from a larger commit and wrote commit
message]

5 years agoFactor out mechglue union context creation 1003/head
Greg Hudson [Tue, 19 Nov 2019 20:02:04 +0000 (15:02 -0500)] 
Factor out mechglue union context creation

Add a helper function gssint_create_union_context() and use it in the
four mechglue functions which create a context.  In
gss_import_sec_context(), create the union context later and eliminate
the cleanup label.

5 years agoFix gss_set_sec_context_option() context creation
Luke Howard [Tue, 19 Nov 2019 18:00:50 +0000 (13:00 -0500)] 
Fix gss_set_sec_context_option() context creation

If gss_set_sec_context_option() creates a union context object, it
must set the loopback pointer.

[ghudson@mit.edu: extracted this from a larger commit and wrote commit
message]

ticket: 8850 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

5 years agoFix kadmin addprinc -randkey -kvno 1001/head
Greg Hudson [Sun, 17 Nov 2019 00:54:51 +0000 (19:54 -0500)] 
Fix kadmin addprinc -randkey -kvno

Commit f07bca9fc94a5cf2e3c0f58226c7973a4b86b7a9 made addprinc -randkey
use a single RPC request, but the server-side handling always creates
the random keys with kvno 1.  If a kvno is specified in the RPC
request, set the kvno of the key data after creating it.  Reported by
Andreas Ladanyi.

ticket: 8848
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

5 years agoUse k5-buf.h integer helpers where appropriate 1000/head
Greg Hudson [Wed, 13 Nov 2019 05:53:56 +0000 (00:53 -0500)] 
Use k5-buf.h integer helpers where appropriate

5 years agoAdd k5-buf.h helpers for serializing integers
Greg Hudson [Wed, 13 Nov 2019 05:53:24 +0000 (00:53 -0500)] 
Add k5-buf.h helpers for serializing integers

5 years agoFix SPNEGO fallback context handling 998/head
Greg Hudson [Mon, 11 Nov 2019 17:25:41 +0000 (12:25 -0500)] 
Fix SPNEGO fallback context handling

In init_ctx_call_init(), if gss_init_sec_context() fails while
producing the first SPNEGO initiator token, we remove the first
candidate mechanism from sc->mech_set and try again.  If
sc->ctx_handle is present after the error (more likely after commit
56f7b1bc95a2a3eeb420e069e7655fb181ade5cf), we must clear it before
falling back or it will cause subsequent attempts to fail.

ticket: 8846 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

5 years agoUpdate test suite cert message digest to sha256 999/head
Robbie Harwood [Tue, 12 Nov 2019 18:38:59 +0000 (13:38 -0500)] 
Update test suite cert message digest to sha256

Certain openssl configurations (such as Debian testing) will fail out
the sha1 certificates with errors like "ssl.SSLError: [SSL:
CA_MD_TOO_WEAK] ca md too weak (_ssl.c:3833)" or similar.  Also update
the certs in question.

5 years agoFix minor errors in softpkcs11 997/head
Robbie Harwood [Fri, 8 Nov 2019 19:28:56 +0000 (14:28 -0500)] 
Fix minor errors in softpkcs11

Fix a printf type mismatch in attributes_match() reported by Coverity,
and a possible uninitizlied use of key_type in add_certificate()
reported by clang.

[ghudson@mit.edu: squashed commits and rewrote commit message]

5 years agoAdd enforce_ok_as_delegate setting 995/head
Viktor Dukhovni [Wed, 6 Nov 2019 03:51:53 +0000 (03:51 +0000)] 
Add enforce_ok_as_delegate setting

If this flag is set to true, then GSSAPI credential delegation will be
disabled when the "ok-as-delegate" flag is not set in the service
ticket.

Rebuild krb5.conf.man.

[ghudson@mit.edu: edited comments and documentation]

ticket: 8847 (new)

5 years agoFix SPNEGO output parameter bugs 996/head
Greg Hudson [Thu, 7 Nov 2019 04:02:51 +0000 (23:02 -0500)] 
Fix SPNEGO output parameter bugs

When accepting, do not leak a name if the underlying mech reports a
src_name twice.  Record mech_type and delegated_cred_handle and report
them to the caller at the final SPNEGO step, not when the underlying
mech reports them.

When initiating or accepting, report ret_flags at every step, and
filter out PROT_READY as required by RFC 4178 section 3.1.  Report a
time_rec value at the final step even if we didn't call into the
underlying mech, using a call to gss_context_time() if necessary.

In the mechglue, initialize ret_flags and time_rec for both
gss_initialize_sec_context() and gss_accept_sec_context().

ticket: 8845

5 years agoRestrict SPNEGO acceptor mechs by cred acquisition 994/head
Greg Hudson [Tue, 5 Nov 2019 21:51:02 +0000 (16:51 -0500)] 
Restrict SPNEGO acceptor mechs by cred acquisition

When the default cred is used, the SPNEGO initiator restricts the list
of negotiable mechanisms to those we can acquire a cred for, so that
we don't propose a mech we know can't work.  The acceptor should do
the same.

ticket: 8844

5 years agoSimplify AS request time handling in KDC 993/head
Greg Hudson [Wed, 23 Oct 2019 22:31:05 +0000 (18:31 -0400)] 
Simplify AS request time handling in KDC

The kdc_time and authtime fields of struct as_req_state are redundant
and can be condensed to just kdc_time.  Copying the times structure
from enc_tkt_reply to reply_encpart already sets the authtime field to
kdc_time, so there is no need to repeat that assignment.

Also remove two prototypes for functions which never existed in the
mainline KDC code.

5 years agoRecord start time of AS requests earlier in KDC
Andreas Schneider [Thu, 19 Sep 2019 14:34:36 +0000 (16:34 +0200)] 
Record start time of AS requests earlier in KDC

In process_as_req(), get the current time before any KDB lookups, so
that KDB modules can more correctly audit how long the processing of
an AS request takes.

[ghudson@mit.edu: rewrote commit message]

ticket: 8842 (new)

5 years agoAllow client canonicalization in non-krbtgt AS-REP 986/head
Isaac Boukris [Tue, 15 Oct 2019 17:41:49 +0000 (20:41 +0300)] 
Allow client canonicalization in non-krbtgt AS-REP

If a caller makes an AS-REQ with the canonicalize flag set (or with an
enterprise client principal or the anonymous flag), always allow the
KDC to change the client principal.  Continue to restrict server name
changes to requests for TGS principals.

Also remove the conditional for setting canon_ok for fully anonymous
requests.  Both kinds of anonymous requests change the client
principal or realm, but neither kind changes the server principal or
realm, so this logic is no longer needed now that canon_ok only
applies to server name changes.

[ghudson@mit.edu: clarified commit message; removed anonymous PKINIT
clause]

ticket: 8843 (new)

5 years agoWork around glibc bug 11941 (dlclose assertion) 992/head
Greg Hudson [Wed, 23 Oct 2019 04:48:25 +0000 (00:48 -0400)] 
Work around glibc bug 11941 (dlclose assertion)

When building against glibc 2.24 or earlier, suppress calls to
dlclose() to prevent the assertion failure "_dl_close: Assertion
`map->l_init_called' failed" at process exit.  We need this workaround
to enable automated tests that load GSSAPI modules.

ticket: 7135

5 years agoFix gssalloc_realloc() on Windows 990/head
Greg Hudson [Mon, 21 Oct 2019 14:29:35 +0000 (10:29 -0400)] 
Fix gssalloc_realloc() on Windows

gss_inquire_sec_context_by_oid(GSS_C_INQ_SSPI_SESSION_KEY) fails on
Windows because generic_gss_add_buffer_set_member() relies on the
ability to realloc() a null pointer.  Unlike realloc(), HeapReAlloc()
requires an input pointer that (from the MSDN documentation) "is
returned by an earlier call to the HeapAlloc or HeapReAlloc function".
So gssalloc_realloc() must test for null inputs and call HeapAlloc()
instead.

Reported by Eric Pauly.

ticket: 8735
tags: pullup
target_version: 1.17-next

5 years agoImprove argument validation in some GSS APIs 988/head
Greg Hudson [Thu, 17 Oct 2019 04:52:04 +0000 (00:52 -0400)] 
Improve argument validation in some GSS APIs

The prevailing discpline of public GSS APIs is to set output
parameters to default values, then validate input parameters.  Some
more recent APIs did not do this consistently, leading to the
possibility of minor_status retaining its previous value or similar
issues.

5 years agoFix minor leak when loading GSS mechanisms 987/head
Greg Hudson [Wed, 16 Oct 2019 19:16:54 +0000 (15:16 -0400)] 
Fix minor leak when loading GSS mechanisms

When gssint_get_mechanism() loads a GSS mech, it must clear errinfo if
krb5int_open_plugin() or krb5int_get_plugin_func() returns an error.

5 years agoAccept GSS mechs which don't supply attributes 985/head
Greg Hudson [Sun, 6 Oct 2019 22:35:50 +0000 (18:35 -0400)] 
Accept GSS mechs which don't supply attributes

If gss_inquire_attrs_for_mech() is called for a mechanism which does
not implement it, the call will succeed with mech_attrs set to
GSS_C_NO_OID_SET (as is explicitly allowed by RFC 5587).
generic_gss_test_oid_set_member() returns an error on this value,
causing gss_accept_sec_context() to erroneously deny the mechanism
when no verifier credential handle is supplied.  Change
allow_mech_by_default() to explicitly check for no mech attribute set.

ticket: 8840 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

5 years agoFix missing field in /etc/gss/mech documentation 984/head
Greg Hudson [Sun, 6 Oct 2019 22:26:03 +0000 (18:26 -0400)] 
Fix missing field in /etc/gss/mech documentation

/etc/gss/mech lines begin with a name field, but this field was not
included in the format documentation.

ticket: 8839 (new)
tags: pullup
target_version: 1.17-next

5 years agoFix t_otp.py for pyrad 2.2 991/head
Greg Hudson [Mon, 21 Oct 2019 17:56:55 +0000 (13:56 -0400)] 
Fix t_otp.py for pyrad 2.2

pyrad 2.2 throws a KeyError exception in DecodePacket if any
attributes from the packet are not defined in the dictionary.  Add a
dictionary entry for Service-Type so this doesn't happen.

ticket: 8841 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next

5 years agoFix typo in default GSS mech config documentation
Greg Hudson [Sun, 6 Oct 2019 22:06:50 +0000 (18:06 -0400)] 
Fix typo in default GSS mech config documentation

Commit 2977b8e88002fc928a0ff3757098b34ca83645ef documented the wrong
default GSS mechanism config filename.  Reported by Dilyan Palauzov.

ticket: 8833

5 years agoLog unknown enctypes as unsupported in KDC 982/head
Greg Hudson [Fri, 27 Sep 2019 20:55:37 +0000 (16:55 -0400)] 
Log unknown enctypes as unsupported in KDC

Commit 8d8e68283b599e680f9fe45eff8af397e827bd6c logs both invalid and
deprecated enctypes as "DEPRECATED:".  An invalid enctype might be too
old or marginal to be supported (like single-DES) or too new to be
recognized.  For clarity, prefix invalid enctypes with "UNSUPPORTED:"
instead.

ticket: 8773

5 years agoRemove some outdated iprop documentation 978/head
Greg Hudson [Mon, 23 Sep 2019 20:59:05 +0000 (16:59 -0400)] 
Remove some outdated iprop documentation

Commit 969331732b62e73d1e073ff3ad87bf1774ee9fd1 (ticket 7369) removed
the code to return UPDATE_BUSY if the database was modified within the
last ten seconds, but did not remove the corresponding documentation
text.  Remove it now.

ticket: 8835 (new)
tags: pullup
target_version: 1.17-next

5 years agoFix KDC crash when logging PKINIT enctypes 981/head
Greg Hudson [Wed, 25 Sep 2019 16:57:56 +0000 (12:57 -0400)] 
Fix KDC crash when logging PKINIT enctypes

Commit a649279727490687d54becad91fde8cf7429d951 introduced a KDC crash
bug due to transposed strlcpy() arguments.  Fix the argument order.

This bug does not affect any MIT krb5 release, but affects the Fedora
krb5 packages due to backports.  CVE-2019-14844 has been issued as a
result.

ticket: 8772

5 years agoFollow-up on krb5_gss_duplicate_name() null check
Greg Hudson [Tue, 24 Sep 2019 05:47:18 +0000 (01:47 -0400)] 
Follow-up on krb5_gss_duplicate_name() null check

Commit 9fd7bc179f0bd74fc83c1edf0247dcfd87fc73e6 missed a second null
check, so the forward-null defect was not squashed.  Remove that one
as well.

5 years agoCorrect a typo in database documentation 977/head
Дилян Палаузов [Sun, 22 Sep 2019 11:58:44 +0000 (11:58 +0000)] 
Correct a typo in database documentation

5 years agoUpdate supported_enctypes documentation 976/head
Robbie Harwood [Fri, 20 Sep 2019 17:09:04 +0000 (13:09 -0400)] 
Update supported_enctypes documentation

In commit 38a31852c3e58f6e2f6b3b035a87f817d1db5537, the aes-sha1
enctypes became the only defaults, but the documentation was not
updated.

ticket: 8834 (new)
tags: pullup
target_version: 1.17-next

5 years agoUpdate LDAP KDB module documentation 974/head
Greg Hudson [Tue, 10 Sep 2019 05:12:43 +0000 (01:12 -0400)] 
Update LDAP KDB module documentation

Remove ldapbackend.rst, as it is largely redundant with conf_ldap.rst.

Simplify conf_ldap.rst, using kerberos.openldap.ldif (added by ticket
8529) and removing unnecessary command arguments.  Mention the
possibility of using SASL authentication (added by ticket 7944) as an
alternative to binding with DN and password.  Remove unnecessary
access rights.

In kdc_conf.rst, remove ldap_servers from the list of relations read
from [dbdefaults], as it is only read from the realm's database
configuration section.

In kdb5_ldap_util.rst, document "-r" as a global parameter, as it
applies in some fashion to all commands.  Make the same changes to the
kdb5_ldap_util usage message, and make it fit within 80 columns.

Reported by Dilyan Palauzov.

ticket: 8831 (new)
tags: pullup
target_version: 1.17-next

5 years agoAdd environment variable for GSS mech config 975/head
Greg Hudson [Mon, 16 Sep 2019 18:36:32 +0000 (14:36 -0400)] 
Add environment variable for GSS mech config

If the environment variable GSS_MECH_CONFIG is set (and the process is
not privileged), read it instead of /etc/gss/mech or files within
/etc/gss/mech.d.

Set GSS_MECH_CONFIG in test frameworks so that system configuration
does not interfere with tests.

Fix documentation to indicate that the default mech config file is in
sysconfdir, not necessarily /etc.

ticket: 8833 (new)

5 years agoFix doc build
Greg Hudson [Thu, 12 Sep 2019 16:05:45 +0000 (12:05 -0400)] 
Fix doc build

Commit c426ef2ca2ba45dbf96f5380cf7d153ec0679424 added
KRB5_PADATA_PAC_OPTIONS to krb5.hin, but did not put it in an API
index, causing a documentation build failure.  Add it now.

ticket: 8479

5 years agoRemove null check in krb5_gss_duplicate_name() 973/head
Robbie Harwood [Fri, 30 Aug 2019 15:19:52 +0000 (11:19 -0400)] 
Remove null check in krb5_gss_duplicate_name()

Within the krb5 mechanism, we require minor_status to be writable
without checking.  Remove the null check in krb5_gss_duplicate_name()
to squash a forward-null defect.

5 years agoSquash apparent forward-null in clnttcp_create()
Robbie Harwood [Fri, 30 Aug 2019 15:16:58 +0000 (11:16 -0400)] 
Squash apparent forward-null in clnttcp_create()

clnttcp_create() only allows raddr to be NULL if *sockp is set.
Static analyzers cannot know this, so can report a forward null
defect.  Add an raddr check before calling connect() to squash the
defect.

[ghudson@mit.edu: rewrote commit message]

5 years agoAdd tests for local and cross-realm RBCD requests 912/head
Isaac Boukris [Sun, 12 May 2019 11:20:29 +0000 (11:20 +0000)] 
Add tests for local and cross-realm RBCD requests

Add fake PAC generation and verification facilities to the test KDB
module, and implement the get_authdata_info() and
allowed_to_delegate_from() methods.  In t_s4u.py, construct realms
using the test KDB module and test a variety of RBCD scenarios.

ticket: 8479

5 years agoAdd minimal cross-realm support to test KDB module
Greg Hudson [Thu, 22 Aug 2019 16:38:14 +0000 (12:38 -0400)] 
Add minimal cross-realm support to test KDB module

Cross-realm is already possible with the test KDB module, but because
the lookup realm is not included in the profile query or key
derivation, inbound cross-TGTs are implicit and use the same keys as
the local TGT, potentially obscuring bugs.  Add the lookup realm to
key derivation so that they use different keys.

5 years agoFix authdata signatures for non-TGT AS-REQs
Isaac Boukris [Mon, 24 Jun 2019 10:06:38 +0000 (13:06 +0300)] 
Fix authdata signatures for non-TGT AS-REQs

PACs (as well as anything wrapped in CAMMAC) should be signed using
the local TGT key.  Cross-realm TGS requests, ticket renewal and
validation requests, and non-TGT AS requests currently do not pass the
local TGT DB entry or its key to sign_authdata(), forcing the KDB
module to do a redundant lookup in order to properly sign PACs.

Rename the existing krbtgt and krbtgt_key parameters to header_server
and header_key, to better indicate that they are for the header ticket
server.  For AS requests, pass NULL for these parameters instead of
passing a duplicate of server/server_key.

Add local_tgt and local_tgt_key parameters for the realm's local TGT
and its first key.

[ghudson@mit.edu: rewrote commit message]

ticket: 8829 (new)

5 years agoAdd API to get client account name from PAC
Isaac Boukris [Wed, 7 Aug 2019 19:39:10 +0000 (19:39 +0000)] 
Add API to get client account name from PAC

Add a krb5_pac_get_client_info() API to interpret the PAC_CLIENT_INFO
buffer of a PAC.  This API is needed by KDB plugin modules to set the
reply client for cross-realm RBCD requests.

[ghudson@mit.edu: added doxygen comment; clarified commit message]

ticket: 8828 (new)

5 years agoAdd KDC support for RBCD requests
Isaac Boukris [Wed, 7 Aug 2019 19:41:25 +0000 (19:41 +0000)] 
Add KDC support for RBCD requests

Add two new KDB methods to support resource-based constrained
delegation.  The get_authdata_info method extracts the client
principal for the authdata (necessary for cross-realm RBCD requests as
the evidence ticket is a cross-realm TGT with the requested client's
authdata), and also returns an opaque pointer for consumption by other
KDB methods.  The allowed_to_delegate_from method performs a
constrained delegation policy check on the principal entry of the
target principal.

Add the server principal and abstract authdata representation to the
sign_authdata method.  Also pass the second ticket server as
header_server since we pass the authorization data from the second
ticket, and pass the impersonated client (if it is in the local realm)
as client instead of the impersonator.

Add core KDC code for RBCD requests.  For local RBCD requests
(impersonator and target in the same realm), KDC handling is similar
to existing constrained delegation support.  The evidence ticket is
not required to be forwardable, and allowed_to_delegate_from is used
in preference to check_allowed_to_delegate.

For cross-realm RBCD requests, the KDC could be in the impersonator
realm, the target realm, or in a transit realm between the two.  In
the transit realm case, the request looks like a regular cross-realm
request for a krbtgt service except for the information in the PAC, so
this case is handled by the KDB module sign_authdata() method.

[ghudson@mit.edu: made style and documentation edits; edited commit
message]

ticket: 8479

5 years agoAdd KDC support functions for PA-PAC-OPTIONS
Isaac Boukris [Sat, 3 Aug 2019 21:57:14 +0000 (21:57 +0000)] 
Add KDC support functions for PA-PAC-OPTIONS

Add helper functions kdc_get_pa_pac_options() and
kdc_add_pa_pac_options(), to retrieve PA-PAC-OPTIONS values from
request padata and to set a PA-PAC-OPTIONS value in encrypted padata.
Don't actually call kdc_add_pa_pac_options() yet.

[ghudson@mit.edu: rewrote commit message; minor style edits]

ticket: 8479

5 years agoS4U2Proxy evidence tickets needn't be forwardable
Isaac Boukris [Tue, 12 Mar 2019 19:59:55 +0000 (21:59 +0200)] 
S4U2Proxy evidence tickets needn't be forwardable

With the introduction of resource-based constrained delegation, the
absence of the forwardable flag no longer implies that a ticket cannot
be used for constrained delegation requests.

Instead, we should check in the PAC to see if the user is marked as
sensitive, and error out in that case rather than making a failed
request.  But we don't always have access to the PAC and we currently
do not have the code to retrieve this attribute from the PAC.

Since krb5_get_credentials_for_proxy() no longer needs to look at the
decrypted ticket, change kvno to not require a keytab for constrained
delegation.

[ghudson@mit.edu: made minor style changes and commit message edits;
updated documentation]

ticket: 8479

5 years agoAdd RBCD client support
Isaac Boukris [Thu, 20 Jun 2019 05:00:06 +0000 (05:00 +0000)] 
Add RBCD client support

When making S4U2Proxy requests, include a PA-PAC-OPTIONS pa-data
element advertising resource-based constrained delegation support.  If
the KDC returns a referral TGT for the initial request and advertises
RBCD support, chase referrals to the target realm with both a regular
and proxy TGT, and make an S4U2Proxy request to the target realm with
the proxy TGT as evidence ticket.

Because cross-realm S4U2Proxy requests must use referrals, an explicit
foreign realm in the server name cannot be honored.  In the GSSAPI
krb5 mech, if a host-based server name is used, omit the realm (if one
was obtained from [domain_realm] or similar) when calling
krb5_get_credentials() for constrained delegation.

[ghudson@mit.edu: rewrote commit message; made style changes]

ticket: 8479

5 years agoMove S4U2Proxy client code to s4u_creds.c
Isaac Boukris [Sun, 16 Jun 2019 21:21:38 +0000 (00:21 +0300)] 
Move S4U2Proxy client code to s4u_creds.c

Add an internal libkrb5 interface k5_get_proxy_cred_from_kdc(), which
implements S4U2Proxy requests synchronously.  Call it from
krb5_get_credentials() if constrained delegation is requested.

[ghudson@mit.edu: rewrote commit message; made style changes]

ticket: 8479

5 years agoSimplify krb5_dbe_def_search_enctype() 972/head
Greg Hudson [Thu, 22 Aug 2019 20:19:12 +0000 (16:19 -0400)] 
Simplify krb5_dbe_def_search_enctype()

Key data is now sorted in descending kvno order (since commit
44ad57d8d38efc944f64536354435f5b721c0ee0) and key enctypes can be
compared with a simple equality test (since single-DES support was
removed in commit fb2dada5eb89c4cd4e39dedd6dbb7dbd5e94f8b8).  Use
these assumptions to simplify krb5_dbe_def_search_enctype().

The rewrite contains one probably-unnoticeable bugfix: if enctype,
salttype, and kvno are all given as -1 in a repeated search, yield all
key entries of permitted enctype, not just entries of the maximum
kvno.

5 years agoAllow the KDB to see and modify auth indicators 965/head
Greg Hudson [Wed, 7 Aug 2019 21:51:17 +0000 (17:51 -0400)] 
Allow the KDB to see and modify auth indicators

Amend the sign_authdata method signature to include a modifiable
auth_indicators array.  Bump the DAL major version and the libkdb5
soname.  Add a test case using the test KDB module.

ticket: 8823 (new)

5 years agoTrack first local TGT key in KDC code 971/head
Greg Hudson [Thu, 22 Aug 2019 06:04:28 +0000 (02:04 -0400)] 
Track first local TGT key in KDC code

Decrypt the first local TGT key in get_local_tgt() and save it in the
AS and TGS processing functions.  (As we now sort key data by
descending kvno, this is guaranteed to be the most recent key.)  Pass
this key to the authdata and FAST cookie functions to simplify cookie
encryption and authdata signing.  Decryption and verification
functions must still sometimes decrypt earlier keys to process tickets
predating the last local TGT key rollover.

5 years agoChange definition of KRB5_KDB_FLAG_CROSS_REALM 970/head
Isaac Boukris [Sat, 17 Aug 2019 22:59:25 +0000 (22:59 +0000)] 
Change definition of KRB5_KDB_FLAG_CROSS_REALM

Set the CROSS_REALM flag if the header ticket was issued by a
different realm, instead of when the client is part of a different
realm.  The affected corner cases are:

* In the final request of a cross-realm S4U2Self request, the header
  ticket client is local but the header ticket was issued by a
  different realm.  The CROSS_REALM flag will now be set in this case.

* If a foreign client renews or validates a locally issued ticket, the
  CROSS_REALM flag will no longer be set.

* If a foreign client requests a local TGT and then uses it to make a
  request, the CROSS_REALM flag will no longer be set.

Also add a new flag KRB5_KDB_FLAG_ISSUING_REFERRAL, which is set when
the KDC decides to issue a referral or alternate TGT.  Use the new
flag meanings to simplify S4U2Self processing.

[ghudson@mit.edu: edited comments and commit messages]

ticket: 8827 (new)

5 years agoRemove KRB5_KDB_XREALM_NON_TRANSITIVE code
Greg Hudson [Mon, 19 Aug 2019 04:51:07 +0000 (00:51 -0400)] 
Remove KRB5_KDB_XREALM_NON_TRANSITIVE code

validate_transit_path() was introduced in the mskrb-integ merge, but
the flag it enforces has no documentation and no kadmin support.
Remove the function and the flag.  Also remove the
KRB5_KDB_TICKET_GRANTING_SERVICE flag which has no associated code.

5 years agoImprove daemon checking in Python test scripts 966/head
Greg Hudson [Fri, 9 Aug 2019 05:17:54 +0000 (01:17 -0400)] 
Improve daemon checking in Python test scripts

If a daemon exits early and we detect it with check_daemon(), avoid
trying to terminate it again as the process entry will have been
reaped.  Check all daemons on successful exit and exit with an error
if any daemons exited early.

Also remove a piece of Python 2.5 compatibility code which is no
longer relevant with Python 3.

5 years agoDon't skip past zero byte in profile parsing 968/head
Greg Hudson [Wed, 14 Aug 2019 15:46:14 +0000 (11:46 -0400)] 
Don't skip past zero byte in profile parsing

In parse_quoted_string(), only process an escape sequence if there is
a second character after the backlash, to avoid reading past the
terminating zero byte.  Reported by Lutz Justen.

ticket: 8825 (new)
tags: pullup
target_version: 1.17-next
target_version: 1.16-next