]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
6 years agoClean up replay cache tests 960/head
Greg Hudson [Wed, 31 Jul 2019 20:21:46 +0000 (16:21 -0400)] 
Clean up replay cache tests

Remove t_replay.c, which wasn't used or built by default and no longer
works with the simplified replay cache interface.  Add t_rcfile2.c to
the sources and rebuild dependencies.

6 years agoHandle all-zero tags in file2 rcache type
Greg Hudson [Wed, 31 Jul 2019 20:18:11 +0000 (16:18 -0400)] 
Handle all-zero tags in file2 rcache type

In the unlikely case of an all-zero tag, rc_file2.c:store() could
mistake an empty record for a replay.  Check that records from the
file are non-empty (by checking that the timestamp is non-zero) before
comparing them to the tag.

ticket: 8786

6 years agoEliminate qualname.plin 959/head
Greg Hudson [Wed, 31 Jul 2019 03:59:27 +0000 (23:59 -0400)] 
Eliminate qualname.plin

Rewriting the qualname Perl script to use getaddrinfo created an
unchecked dependency on Perl 5.14.  Instead, remove the script and use
the C program in tests/resolve for the kadmin and gssrpc test suites.

6 years agoRemove orphaned KfM code 957/head
Michael Mattioli [Sun, 28 Jul 2019 20:36:30 +0000 (16:36 -0400)] 
Remove orphaned KfM code

Remove the Mac parts of the ccapi code, as ccapi is now only used in
the Windows build.  Remove util/mac.

[ghudson@mit.edu: rewrote commit message]

6 years agoConvert remaining Python scripts to Python 3 958/head
Greg Hudson [Mon, 29 Jul 2019 17:21:46 +0000 (13:21 -0400)] 
Convert remaining Python scripts to Python 3

Commit e23d24beacb73581bbf4351250f3955e6fd44361 missed some Python
scripts, in part because of the "PYTHON = python" line in
src/Makefile.in from commit 7be2ef2b6c8c491781251a5023db48d7690f5fa8.
Remove that line and convert the remaining scripts.  Also fix the
check-pytests-no warning to mention Python 3 instead of Python 2.5.

6 years agoFix Coverity defects in soft-pkcs11 test code 955/head
Greg Hudson [Sat, 20 Jul 2019 04:51:52 +0000 (00:51 -0400)] 
Fix Coverity defects in soft-pkcs11 test code

Nothing in the code removes objects from soft_token.object.obs, so
simplify add_st_object() not to search for an empty slot.  Avoid using
random() by using a counter for session handles and just the array
slot number for object handles.  Add a helper get_rcfilename() to
facilitate checking the result of asprintf().  Properly initialize ap
in sprintf_fill().  Close the file handle in read_conf_file().

6 years agoFix test suite issues affecting Travis images 956/head
Greg Hudson [Fri, 26 Jul 2019 22:33:28 +0000 (18:33 -0400)] 
Fix test suite issues affecting Travis images

In the utilities used by the dejagnu test suites, use
getaddrinfo()/getnameinfo() instead of
gethostbyname()/gethostbyaddr(), as the results can vary when the
local hostname appears in multiple lines in /etc/hosts.

In t_ccselect.py, don't cause an error if the canonicalized local
hostname is "localhost".  The tests will continue to run in this case,
as long as we don't try to create duplicate principals.

In sim_server.c, bind to the wildcard address instead of the resolved
local hostname, to resolve a mysterious problem observed in Travis
where the second of three sim_client send() operations fails with
ECONNREFUSED.

6 years agoCorrect documentation of final profiles 953/head
Michael Mattioli [Sun, 14 Jul 2019 21:35:17 +0000 (17:35 -0400)] 
Correct documentation of final profiles

The documentation for krb5.conf explaining final values is incorrect.
Only sections and subsections may usefully be marked as final, and
final designations only apply to later files, not to the same file.

[ghudson@mit.edu: corrected and shortened documentation; rewrote
commit message]

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

6 years agoAdd profile tests for final nodes
Greg Hudson [Mon, 15 Jul 2019 19:09:30 +0000 (15:09 -0400)] 
Add profile tests for final nodes

6 years agoFilter enctypes in gss_set_allowable_enctypes() 954/head
Greg Hudson [Tue, 16 Jul 2019 04:15:42 +0000 (00:15 -0400)] 
Filter enctypes in gss_set_allowable_enctypes()

Instead of erroring out when any invalid enctypes are present in the
caller's list, filter out the invalid ones and only error if no
enctypes remain.

ticket: 8819

6 years agoDon't error on invalid enctypes in keytab 952/head
Robbie Harwood [Wed, 10 Jul 2019 21:10:16 +0000 (17:10 -0400)] 
Don't error on invalid enctypes in keytab

krb5_ktfile_get_entry() used krb5_c_enctype_compare() to compare
enctypes, in order to share keys between single-DES enctypes.  As
key-sharing between enctypes is no longer done and single-DES support
has been removed, use a simple equality test to match the enctype.
This fixes a bug where krb5_kt_get_entry() would error out if the
keytab contained any entries with invalid enctypes (include single-DES
entries, after commit fb2dada5eb89c4cd4e39dedd6dbb7dbd5e94f8b8) even
if a matching entry is found.

[ghudson@mit.edu: rewrote commit message]

ticket: 8808

6 years agoUpdate edwards25519 code from BoringSSL 944/head
Greg Hudson [Fri, 7 Jun 2019 16:51:36 +0000 (12:51 -0400)] 
Update edwards25519 code from BoringSSL

Bring the SPAKE edwards25519.c code up to date with BoringSSL, adding
edwards25519_fiat.h to contain the Fiat-generated code which BoringSSL
has split out.  The relevant BoringSSL commits are:

  302bb3964ad8cc4fb8540ee4783a936c5515605d
  5590c715e26790d9b60384e1ac092529a19208af
  32e59d2d3264e4e104b355ef73663b8b79ac4093
  899835fad40f50f4c29bf7042b415eb72ad0e7d7
  9847cdd785abae6313412fc5a824b938bef6ba98

The updated code avoids undefined signed left-shift behavior (not a
problem in practice, so far) and compiles to faster code with gcc on
platforms where the 64-bit code cannot be used.

6 years agoFix typos 951/head
Antoine Cœur [Sun, 30 Jun 2019 17:32:16 +0000 (01:32 +0800)] 
Fix typos

6 years agoRemove now-unused checksum functions 950/head
Robbie Harwood [Fri, 28 Jun 2019 17:09:47 +0000 (13:09 -0400)] 
Remove now-unused checksum functions

fb2dada5eb89c4cd4e39dedd6dbb7dbd5e94f8b8 removed all call sites of
krb5int_cbc_checksum(), krb5int_confounder_verify(), and
krb5int_confounder_checksum(), but neglected the functions themselves.

ticket: 8808

6 years agoRemove PKINIT draft 9 ASN.1 code and types 948/head
Greg Hudson [Tue, 18 Jun 2019 15:40:48 +0000 (11:40 -0400)] 
Remove PKINIT draft 9 ASN.1 code and types

ticket: 8817

6 years agoRemove PKINIT draft 9 support
Greg Hudson [Tue, 18 Jun 2019 17:06:44 +0000 (13:06 -0400)] 
Remove PKINIT draft 9 support

PKINIT draft 9 support is required to interoperate with Windows 2000,
Windows XP, and Windows Server 2003, all of which are well beyond
end-of-life.  Remove it.

ticket: 8817 (new)

6 years agoUse imported soft-pkcs11 for tests 949/head
Greg Hudson [Thu, 20 Jun 2019 17:41:57 +0000 (13:41 -0400)] 
Use imported soft-pkcs11 for tests

Update the soft-pkcs11 code for OpenSSL 1.1, fix some warnings,
integrate it into the build system, and use it for the PKINIT tests.

6 years agoAdd soft-pkcs11 source code
Greg Hudson [Thu, 20 Jun 2019 14:45:18 +0000 (10:45 -0400)] 
Add soft-pkcs11 source code

soft-pkcs11 is no longer available upstream and is not generally
packaged in distributions, making it inconvenient to use for tests.
Import the 1.8 source code, detabified and with trailing whitespace
removed but otherwise unmodified.

6 years agoImprove Travis test coverage and simplify config
Greg Hudson [Thu, 20 Jun 2019 02:31:57 +0000 (22:31 -0400)] 
Improve Travis test coverage and simplify config

Specify the xenial (16.04) image, as Travis still sometimes uses 14.04
by default.  Use cmocka from the package repository instead of
building it.  Remove python3-paste as paste is no longer a test
dependency, but add python3-kdcproxy.  Install pyrad via pip3 as the
Ubuntu-packaged version still has the assertion bug.

6 years agoConvert OTP and kdcproxy tests to Python 3
Greg Hudson [Wed, 19 Jun 2019 04:57:30 +0000 (00:57 -0400)] 
Convert OTP and kdcproxy tests to Python 3

Commit e23d24beacb73581bbf4351250f3955e6fd44361 did not convert
t_otp.py or paste-kdcproxy.py.  Convert t_otp.py to Python3.  Rewrite
paste-kdcproxy.py using wsgiref from the standard Python library to
avoid the Paste dependency.

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

6 years agoUse krb5_flags_to_strings() in kproplog 946/head
Greg Hudson [Tue, 11 Jun 2019 15:26:04 +0000 (11:26 -0400)] 
Use krb5_flags_to_strings() in kproplog

Remove the local flags table in kproplog.c and instead use
krb5_flags_to_strings(), as was done for kadmin.c in commit
971fae8285427b27dfd8c9a535a18eb588ee0689.

ticket: 8816

6 years agoVerify PAC client name independently of name-type 945/head
Isaac Boukris [Mon, 10 Jun 2019 12:33:06 +0000 (15:33 +0300)] 
Verify PAC client name independently of name-type

In krb5_pac_verify(), unparse the provided principal name and compare
using strcmp(), instead of parsing pac principal, in order to avoid
relying on the provided name type.

This change is needed for tickets issued with cross-realm S4U2Proxy
(with resource-based constrained delegation), because the final
request uses a cross-TGT as the evidence ticket, so the ticket client
name is taken from the PAC and does not preserve the name type.
Microsoft KDCs use NT-MS-PRINCIPAL as the ticket client name type in
this case, regardless of the original name type.

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

ticket: 8815 (new)

6 years agoUse new pa-data helpers where appropriate 941/head
Greg Hudson [Mon, 3 Jun 2019 21:32:20 +0000 (17:32 -0400)] 
Use new pa-data helpers where appropriate

6 years agoAdd new internal pa-data helpers
Greg Hudson [Mon, 3 Jun 2019 20:12:03 +0000 (16:12 -0400)] 
Add new internal pa-data helpers

Add a new file with five new internal libkrb5 functions to help manage
pa-data lists.  Move krb5int_find_pa_data() from fast.c into the new
file and simplify it slightly.

6 years agoImprove logging documentation 942/head
Greg Hudson [Thu, 6 Jun 2019 15:35:36 +0000 (11:35 -0400)] 
Improve logging documentation

The default severity was removed by commit
6ce8fd4cfa2e9b1e92debd204a5b2ddf053cca55 (ticket 8630) but the example
still talks about it; remove that text.  Add a note about the default
being syslog if nothing else is specified, and a note on how to
disable logging.

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

6 years agoRemove strerror() calls from k5_get_error() 943/head
Greg Hudson [Thu, 6 Jun 2019 15:46:58 +0000 (11:46 -0400)] 
Remove strerror() calls from k5_get_error()

Coverity models strerror() as a function which cannot accept negative
values, even though it has defined behavior on all integers.
k5_get_error() contains code to call strerror_r() and strerror() if
its fptr global is unset, which isn't an expected case in practice.
To silence a large number of Coverity false positives, just return a
fixed string if fptr is null.

6 years agoMake rcache file2 code slightly more robust 940/head
Greg Hudson [Sat, 1 Jun 2019 19:08:24 +0000 (15:08 -0400)] 
Make rcache file2 code slightly more robust

In rc_file2.c:store(), when making note of available records,
explicitly check for an empty record (r1stamp or t2stamp is 0), to
more closely match the check for terminating the search.  This
silences a Coverity false positive, as Coverity does not assume that
now > skew as it would be in practice.

To preserve code readability, shorten some variable names, add an
expired() inline helper function, and add comments.

6 years agoUpdate HTTP links 936/head
Michael Mattioli [Sun, 26 May 2019 15:50:21 +0000 (11:50 -0400)] 
Update HTTP links

Move http links to https where appropriate.  Update links which have
moved.  Remove a couple of links which no longer work and have no
obvious replacement.  Remove a link from a comment in the German
translation which does not appear to be related to the message.

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

6 years agoSimplify and modernize replay cache interface 939/head
Greg Hudson [Sat, 1 Jun 2019 17:37:14 +0000 (13:37 -0400)] 
Simplify and modernize replay cache interface

Remove all of the replay cache methods except for resolve, close, and
store.  Rename the dispatch functions to use a k5_ prefix to indicate
that they are not part of the libkrb5 API.  Remove the unused code for
registering replay cache types at runtime.

Remove the krb5_donot_replay structure, as the only concrete replay
cache type just needs the authenticator checksum.  Identify the
checksum part of the authenticator ciphertext at the dispatch layer.
Handle container allocation at the dispatch layer so that each replay
cache type only needs to work with its data pointer.  Remember the
full name at the dispatch layer to implement a get_name operation.
Consolidate what remains of rcfns.c and rc_conv.c into rc_base.c.

Use k5_rc_default() in preference to krb5_get_server_rcache() since
they now do the same thing.  Remove the sim_client code to create a
replay cache, as the per-message functions use a memory reply cache
now.

6 years agoAdd KRB5RCACHENAME and default_rcache_name 899/head
Greg Hudson [Fri, 17 May 2019 17:45:08 +0000 (13:45 -0400)] 
Add KRB5RCACHENAME and default_rcache_name

In krb5_get_server_rcache(), stop constructing a residual value based
on piece and the euid, and instead resolve default replay cache
(previously an unused operation, as krb5_rc_default() was not part of
the API and was never used).

To determine the default replay cache name, try the KRB5RCACHENAME
environment variable first, and then try KRB5RCACHETYPE for
compatibility.  If neither of those environment variables are set, try
the default_rcache_name profile relation in [libdefaults] before
falling back to "dfl:".

ticket: 8786

6 years agoUse file2 replay cache by default
Greg Hudson [Wed, 15 May 2019 05:01:34 +0000 (01:01 -0400)] 
Use file2 replay cache by default

Remove the existing default replay cache implementation and replace it
with a wrapper around the file2 replay cache code.  Change the
filename to krb5_EUID.rcache2, ignoring the residual (and therefore
the server principal name).  On Windows, use the local appdata
directory if KRB5RCACHEDIR is not set in the environment.

ticket: 8786

6 years agoAdd file2 rcache type
Greg Hudson [Tue, 14 May 2019 16:13:35 +0000 (12:13 -0400)] 
Add file2 rcache type

Add a new replay cache type using a hash-based file format.

ticket: 8786

6 years agoAdd tag to krb5_donot_replay
Greg Hudson [Tue, 19 Feb 2019 06:30:41 +0000 (01:30 -0500)] 
Add tag to krb5_donot_replay

For each use of replay caches, supply a tag based on a ciphertext or
checksum associated with the use.  Stop creating or checking replay
records for unencrypted KRB-CRED messages.

ticket: 8786

6 years agoMake siphash24 available internally
Greg Hudson [Sat, 23 Feb 2019 20:03:34 +0000 (15:03 -0500)] 
Make siphash24 available internally

6 years agoRemove krb5int_c_combine_keys() 938/head
Robbie Harwood [Thu, 18 Apr 2019 21:27:07 +0000 (17:27 -0400)] 
Remove krb5int_c_combine_keys()

This method of combining keys was specified by
draft-ietf-krb-wg-kerberos-sam for DES and 3DES enctypes, and is
otherwise unused.  Remove it.

[ghudson@mit.edu: rewrote commit message]

ticket: 8812

6 years agoRemove support for no-flags SAM-2 preauth
Robbie Harwood [Wed, 17 Apr 2019 21:07:46 +0000 (17:07 -0400)] 
Remove support for no-flags SAM-2 preauth

When neither the send-encrypted-sad nor the use-sad-as-key flag is set
in the SAM-2 challenge, the protocol calls for the AS key to be
combined with the string-to-key of the SAD using a key combination
method which has only been implemented for DES and 3DES enctypes.
Rather than extending key combination, remove support for this case.

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

ticket: 8812 (new)

6 years agoSimplify kdb5_util global argv processing 934/head
Greg Hudson [Wed, 22 May 2019 17:05:15 +0000 (13:05 -0400)] 
Simplify kdb5_util global argv processing

kdb5_util could issue an unexplained error if a command argument
matched a command name, such as when trying to load a dump file named
"dump".  It could also mysteriously work if the command name and its
arguments were misordered, such as "kdb5_util kdb.dump load".

In the main option loop, build cmd_argv without special-casing command
names; then look up cmd_argv[0] after the loop.

ticket: 8806

6 years agoStop double-caching referral tickets 937/head
Greg Hudson [Tue, 28 May 2019 16:16:41 +0000 (12:16 -0400)] 
Stop double-caching referral tickets

Caching referral tickets under two names can generate duplicate cache
entries, and is speculative--if credentials are requested with the
referral realm, there is no good reason to expect a subsequent request
with the canonical realm.  Only cache under the referral realm.

ticket: 8764

6 years agoIn klist, display ticket server if different
Greg Hudson [Tue, 28 May 2019 16:02:00 +0000 (12:02 -0400)] 
In klist, display ticket server if different

If the ticket server differs from the credential server, display it as
an extra field.  This happens most commonly when the credential is
cached under the referral realm.

ticket: 8811 (new)

6 years agoDisplay unsupported enctype names 923/head
Greg Hudson [Tue, 21 May 2019 17:34:39 +0000 (13:34 -0400)] 
Display unsupported enctype names

Add a table of unsupported enctype numbers to enctype_util.c and
consult it in krb5_enctype_to_name().  Treat unsupported enctype
numbers as deprecated in krb5int_c_deprecated_enctype().  In kadmin,
display "UNSUPPORTED:" before invalid enctype names.

ticket: 8808

6 years agoRemove support for single-DES and CRC
Robbie Harwood [Fri, 24 May 2019 17:12:03 +0000 (13:12 -0400)] 
Remove support for single-DES and CRC

Single-DES removal brings us closer to compliance with RFC 6649.
Single-DES was disabled by default starting in release 1.8, and
user-visible deprecation warnings were issued starting in release
1.17.

ticket: 8808

6 years agoUpdate test suite to avoid single-DES enctypes
Robbie Harwood [Fri, 24 May 2019 17:11:55 +0000 (13:11 -0400)] 
Update test suite to avoid single-DES enctypes

Remove the CRC exercise code, since CRC is DES-only.

ticket: 8808

6 years agoRemove the v4 and afs3 salt types
Robbie Harwood [Fri, 24 May 2019 17:11:44 +0000 (13:11 -0400)] 
Remove the v4 and afs3 salt types

In preparation for removing single-DES support, remove the v4 and afs3
salt types.  The afs3 salt type could only be used with single-DES
keys, and the v4 salt type was only useful for single-DES keys from
krb4 databases.

[ghudson@mit.edu: wrote commit message]

ticket: 8808

6 years agoFix Python fallback in configure.ac
Greg Hudson [Tue, 28 May 2019 14:55:56 +0000 (10:55 -0400)] 
Fix Python fallback in configure.ac

Commit 2bd410ecdb366083fe9b4e5f6ac4b741b624230b (ticket 8709)
contained a typo "text" for "test", preventing the Python path check
from falling back from python2 to python.  This is now a fallback from
python3 to python, but the typo remains.  Fix it now.

Based on a patch by Michael Osipov.

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

6 years agoSet a more modern default ksu CMD_PATH 929/head
Robbie Harwood [Tue, 23 Aug 2016 20:32:09 +0000 (16:32 -0400)] 
Set a more modern default ksu CMD_PATH

ksu uses CMD_PATH to expand command names in .k5users.  Include the /usr
tree and .../sbin variants.  Drop nonstandard /local.

ticket: 8807 (new)

6 years agoAdd missing newlines to deprecation warnings
Greg Hudson [Tue, 21 May 2019 16:52:26 +0000 (12:52 -0400)] 
Add missing newlines to deprecation warnings

Commit 8d8e68283b599e680f9fe45eff8af397e827bd6c omitted newlines in
two warning messages sent to stderr.  Add them now.

ticket: 8773

6 years agoSupport 389ds's lockout model 931/head
Robbie Harwood [Tue, 23 Aug 2016 20:47:44 +0000 (16:47 -0400)] 
Support 389ds's lockout model

Handle the attribute 'nsAccountLock' from Netscape derivatives.  Based
on a patch by Nalin Dahyabhai and Simo Sorce.

ticket: 5891

6 years agoUpdate default krb5kdc mkey manual-entry enctype
Robbie Harwood [Mon, 20 May 2019 20:52:57 +0000 (16:52 -0400)] 
Update default krb5kdc mkey manual-entry enctype

Change from the legacy des-cbc-crc to the default for kdb5_util and
kadmind, which is currently aes256-cts-hmac-sha1-96.

6 years agoUpdate ASN.1 SAM tests to use a modern enctype
Robbie Harwood [Tue, 16 Apr 2019 18:16:39 +0000 (14:16 -0400)] 
Update ASN.1 SAM tests to use a modern enctype

6 years agoModernize example enctypes in documentation
Robbie Harwood [Thu, 11 Apr 2019 22:25:41 +0000 (18:25 -0400)] 
Modernize example enctypes in documentation

ticket: 8805 (new)

6 years agoMark the doc/kadm5 tex files as historic
Robbie Harwood [Thu, 11 Apr 2019 22:33:04 +0000 (18:33 -0400)] 
Mark the doc/kadm5 tex files as historic

Remove rcsid.sty and the uses of the \rcsId macro as git does not
perform the keyword expansion necessary to make it work.  Add comments
indicating the historic status of the kadm5 documentation.

[ghudson@mit.edu: fix the tex files instead of marking them as
non-building]

6 years agoRemove dead variable def_kslist from two files
Robbie Harwood [Thu, 2 May 2019 20:57:51 +0000 (16:57 -0400)] 
Remove dead variable def_kslist from two files

def_kslist was part of kdb5_create.c since its addition (commit
edf8b4d8a6a665c2aa150993cd813ea6c5cf12e1) and has always been
irrelevant since the rblock structure is fully initialized in
kdb5_create().

def_klist was copied into kdb5_ldap_realm.c (present in addition at
commit 42d9d6ab320ee3a661fe21472be542acd542d5be).  The global rblock
structure (and therefore the initializer) was removed in commit
9c850f8b62784170a5e42315c1a9552ddcf4ca2b, leaving def_kslist
unreferenced.

Remove def_kslist from both files, and remove the rblock initializer
from kdb5_create.c.

[ghudson@mit.edu: edited commit message]

6 years agoRemove checksum type profile variables 928/head
Robbie Harwood [Mon, 13 May 2019 18:19:57 +0000 (14:19 -0400)] 
Remove checksum type profile variables

Remove support for the krb5.conf relations ap_req_checksum_type,
kdc_req_checksum_type, and safe_checksum_type.  These values were
useful for interoperating with very old KDCs, which should no longer
be deployed.

Additionally, kdc_req_checksum_type was incorrectly documented as only
applying to single-DES keys; in practice it also worked for RC4.  The
other two were not clearly documented, but safe_checksum_type did
allow use of hmac-md5-rc4 for any enctype, and ap_req_checksum_type
did not impose any limitations.

[ghudson@mit.edu: edited commit message]

ticket: 8804 (new)

6 years agoRemove more dead code 922/head
Robbie Harwood [Thu, 9 May 2019 18:07:24 +0000 (14:07 -0400)] 
Remove more dead code

6 years agoImprove error messages from kadmin change_password
Robbie Harwood [Mon, 6 May 2019 17:13:16 +0000 (13:13 -0400)] 
Improve error messages from kadmin change_password

The checks for missing option arguments were dead code, because the
loop condition requires at least two remaining arguments.  Instead
check for at least one argument with a leading "-", and check for too
many or too few arguments after the loop.  Add an initial message for
unrecognized options.

[ghudson@mit.edu: adjusted logic to improve mesages in more cases]

6 years agoSimply OpenSSL PKCS7 decryption code
Robbie Harwood [Mon, 6 May 2019 17:13:06 +0000 (13:13 -0400)] 
Simply OpenSSL PKCS7 decryption code

Fold pkcs7_decrypt() and pkcs7_dataDecode() into a single function,
and make it output the plaintext rather than a BIO.

[ghudson@mit.edu: continued a modernization of pkcs7_dataDecode() into
a larger refactoring]

6 years agoAdd a Travis job to build with OpenSSL crypto 927/head
Robbie Harwood [Mon, 6 May 2019 18:29:53 +0000 (14:29 -0400)] 
Add a Travis job to build with OpenSSL crypto

[ghudson@mit.edu: simplified configure option passing]

6 years agoAvoid alignment warnings in openssl rc4.c
Robbie Harwood [Mon, 6 May 2019 19:14:49 +0000 (15:14 -0400)] 
Avoid alignment warnings in openssl rc4.c

Add a comment to k5_arcfour_init_state() explaining how we stretch the
krb5_data cipher state contract.  Use void * casts when interpreting
the data pointer to avoid alignment warnings.

[ghudson@mit.edu: moved and expanded comment; rewrote commit message]

6 years agoRename hmac() function 926/head
Thomas Klausner [Mon, 6 May 2019 14:03:38 +0000 (16:03 +0200)] 
Rename hmac() function

NetBSD 8's stdlib.h declares a hmac() function; rename ours to avoid a
conflict.

[ghudson@mit.edu: picked a different name and added a comment]

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

6 years agoSimplify SAM-2 as_key handling 924/head
Greg Hudson [Sun, 5 May 2019 22:53:27 +0000 (18:53 -0400)] 
Simplify SAM-2 as_key handling

The ctx->gak_fct() call in sam2_process() used an empty salt instead
of the default salt when the KDC did not supply an explicit salt.
This bug arose when commit bc096a77ffdab283d77c2e0fc1fdd15b9f77eb41
changed the internal contracts around salts but did not adjust the
SAM-2 code.  Commit e9aa891fcdb4c08d39902ab89afb268042b60c86 fixed the
resulting bug, but mistakenly did not adjust the gak_fct call to use
the correct salt.

Later on, the code contains a redundant call to krb5_c_string_to_key()
in the non-USE_SAD_AS_KEY modes, replacing ctx->as_key.  This call was
properly adjusted by commit e9aa891fcdb4c08d39902ab89afb268042b60c86,
so the improper gak_fct call did not manifest as a bug.

Fix the gak_fct call to supply the correct salt, and remove the
redundant string_to_key operation.

6 years agoRemove outdated text in krb5kdc/kadmind man pages 925/head
Greg Hudson [Sun, 5 May 2019 23:32:21 +0000 (19:32 -0400)] 
Remove outdated text in krb5kdc/kadmind man pages

Some init systems, such as systemd, can run daemon processes in the
foreground, so admonishments to let krb5kdc and kadmind background
themselves in normal operation can be confusing.  Remove those
sentences.

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

6 years agoModernize exit path in gss_krb5int_copy_ccache()
Robbie Harwood [Thu, 2 May 2019 18:32:33 +0000 (14:32 -0400)] 
Modernize exit path in gss_krb5int_copy_ccache()

Move to a single lock / single unlock paradigm, and eliminate some
dead code in the old error handling.

6 years agoFix some return code handling bugs
Robbie Harwood [Thu, 2 May 2019 18:05:38 +0000 (14:05 -0400)] 
Fix some return code handling bugs

Fix five cases where return codes could be set (in unlikely cases) but
did not result in error exits.

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

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

6 years agoInitialize some data structure magic fields
Robbie Harwood [Thu, 2 May 2019 17:36:38 +0000 (13:36 -0400)] 
Initialize some data structure magic fields

Static analyzers may complain if they see a data structure copied with
an uninitialized field, even if the copy target won't use the field.
Add magic field initializers in three such places.

[ghudson@mit.edu: rewrote commit message]

6 years agoUse secure_getenv() where appropriate 921/head
Greg Hudson [Wed, 24 Apr 2019 20:19:50 +0000 (16:19 -0400)] 
Use secure_getenv() where appropriate

ticket: 8800

6 years agoAdd secure_getenv() support
Greg Hudson [Wed, 24 Apr 2019 19:56:43 +0000 (15:56 -0400)] 
Add secure_getenv() support

On systems with secure_getenv() (glibc 2.17+) use it directly.  For
the fallback implementation, check the current process uids and gids
in a library initializer, looking at the saved uid and gid where
possible.  Include a comment about more aggressive approaches to
detecting elevated privilege.

ticket: 8800 (new)

6 years agoCheck more errors in OpenSSL crypto backend 919/head
Greg Hudson [Mon, 22 Apr 2019 18:26:42 +0000 (14:26 -0400)] 
Check more errors in OpenSSL crypto backend

In krb5int_hmac_keyblock() and krb5int_pbkdf2_hmac(), check for errors
from previously unchecked OpenSSL function calls and return
KRB5_CRYPTO_INTERNAL if they fail.

HMAC_Init() is deprecated in OpenSSL 1.0 and later; as we are
modifying the call to check for errors, call HMAC_Init_ex() instead.

ticket: 8799 (new)

6 years agoSimplify libreadline configure support 920/head
Greg Hudson [Tue, 23 Apr 2019 16:41:11 +0000 (12:41 -0400)] 
Simplify libreadline configure support

If configure is explicitly asked to build with libreadline, look for
and link against only -lreadline, relying on the platform to resolve
any dependencies.

ticket: 8795

6 years agoFix gss_get_mic_iov() example code 917/head
Greg Hudson [Wed, 17 Apr 2019 05:57:28 +0000 (01:57 -0400)] 
Fix gss_get_mic_iov() example code

The example code for gss_get_mic_iov() using a caller-provided buffer
calls gss_wrap_iov_length() and gss_wrap_iov() instead of
gss_get_mic_iov_length() and gss_get_mic_iov() as intended.  Reported
by Frank Filz.

ticket: 8797
tags: pullup
target_version: 1.17-next

6 years agoFix potential close(-1) in cc_file.c 918/head
Robbie Harwood [Thu, 18 Apr 2019 17:39:37 +0000 (13:39 -0400)] 
Fix potential close(-1) in cc_file.c

As part of error handling in d3b39a8bac6206b5ea78b0bf6a2958c1df0b0dd5,
an error path in delete_cred() may result in close(-1).  While this
shouldn't be a prolblem in practice (just returning EBADF), it does
upset Coverity.

ticket: 8792

6 years agoRemove ovsec_adm_export dump format support 914/head
Robbie Harwood [Tue, 22 Jan 2019 23:34:58 +0000 (18:34 -0500)] 
Remove ovsec_adm_export dump format support

Dumping only suported single-DES principals.  While importing still
functioned, it would only have been useful for extremely old (1.3-era)
KDCs.

ticket: 8798 (new)

6 years agoRemove confvalidator utility
Robbie Harwood [Wed, 3 Apr 2019 18:58:19 +0000 (14:58 -0400)] 
Remove confvalidator utility

This utility has not been maintained with encryption types and salt
changes, which suggests it is unused.

6 years agoDocument default realm for krb5kdc 916/head
Greg Hudson [Tue, 16 Apr 2019 15:11:19 +0000 (11:11 -0400)] 
Document default realm for krb5kdc

Document that if no krb5kdc -r option is specified, the default realm
is served.

ticket: 8796
tags: pullup
target_version: 1.17-next

6 years agoFix config realm change logic in FILE remove_cred 915/head
Greg Hudson [Tue, 16 Apr 2019 14:47:35 +0000 (10:47 -0400)] 
Fix config realm change logic in FILE remove_cred

Use data_eq_string() to check the server realm, and do not check if
cred->server is NULL since it is not expected to be (and
k5_marshal_cred() would have already crashed if it were).

ticket: 8792

6 years agoRemove Kerberos v4 support vestiges from ccapi 913/head
Robbie Harwood [Thu, 4 Apr 2019 18:37:38 +0000 (14:37 -0400)] 
Remove Kerberos v4 support vestiges from ccapi

6 years agoRemove doxygen-generated HTML output for ccapi
Robbie Harwood [Thu, 4 Apr 2019 18:15:58 +0000 (14:15 -0400)] 
Remove doxygen-generated HTML output for ccapi

6 years agoRemove ccapi-related comments in configure.ac
Robbie Harwood [Wed, 3 Apr 2019 20:01:22 +0000 (16:01 -0400)] 
Remove ccapi-related comments in configure.ac

These suggested ccapi is buildable on non-Windows, and empirically it
is not.

6 years agoRemove kadmin RPC support for setting v4 key
Robbie Harwood [Thu, 4 Apr 2019 20:14:46 +0000 (16:14 -0400)] 
Remove kadmin RPC support for setting v4 key

ticket: 8794 (new)

6 years agoRemove srvtab support
Robbie Harwood [Mon, 9 Oct 2017 19:58:33 +0000 (15:58 -0400)] 
Remove srvtab support

Also change internal names from "srvtab" to "keytab" where the old
name was used.

ticket: 8793 (new)

6 years agoImplement krb5_cc_remove_cred for remaining types 911/head
Robbie Harwood [Mon, 1 Apr 2019 18:28:48 +0000 (14:28 -0400)] 
Implement krb5_cc_remove_cred for remaining types

Previously, only KCM and MSLA implemented credential removal.  Add
support for FILE (and therefore DIR), MEMORY, and KEYRING.

The FILE logic is similar Heimdal's implementation, with additional
logic for skipping removed creds during iteration.  In addition to
setting endtime to 0 and changing the realm for config entries as
Heimdal does, we set authtime to -1 to make deleted entries
distinguishable from gssproxy encrypted creds and config entries.

For MEMORY, leave behind empty list elements when removing a cred will
leave behind an empty list element, in case an iterator holds a
pointer to that element.

[ghudson@mit.edu: edited commit message; made minor style and comment
changes; fixed memory leaks detected by asan]

ticket: 8792 (new)

6 years agoClarify header comment for krb5_cc_start_seq_get()
Robbie Harwood [Tue, 2 Apr 2019 18:18:57 +0000 (14:18 -0400)] 
Clarify header comment for krb5_cc_start_seq_get()

Previously this comment seemed to suggest that applications needed to
block all other access to the ccache (including by other processes)
during iteration.

6 years agoAdd SPAKE's t_vectors to .gitignore 910/head
Robbie Harwood [Mon, 1 Apr 2019 15:28:59 +0000 (11:28 -0400)] 
Add SPAKE's t_vectors to .gitignore

6 years agoSuppress krb5_cc_start_seq_get() popups in Leash 909/head
Greg Hudson [Tue, 19 Mar 2019 15:15:26 +0000 (11:15 -0400)] 
Suppress krb5_cc_start_seq_get() popups in Leash

Under some circumstances (perhaps related to a February Windows 10
update), Leash can get past the krb5_cc_get_principal() step when
processing an empty MSLSA ccache, and get a KRB5_CC_NOMATCH error from
krb5_cc_start_seq_get().  Do not display a modal error dialog if this
happens.

ticket: 8790
tags: pullup
target_version: 1.17-next

6 years agoAdd option to build without libkeyutils 905/head
Robert Marshall [Wed, 13 Mar 2019 03:20:06 +0000 (23:20 -0400)] 
Add option to build without libkeyutils

Add a --without-keyutils option to disable the keyring ccache, for
scenarios where minimizing libkrb5 dependencies is important.

[ghudson@mit.edu: moved processing to configure.ac; added error if
explicit --without-keyutils is given and libkeyutils is not found;
nested persistent keyring check for clarity; moved new documentation
to appropriate place and don't mention persistent keyrings; rephrased
commit message]

ticket: 8791 (new)

6 years agoFix memory leak in test KDB module 908/head
Greg Hudson [Tue, 19 Mar 2019 16:22:33 +0000 (12:22 -0400)] 
Fix memory leak in test KDB module

test_get_s4u_x509_principal() needs to free canon before exiting.

6 years agoFix free of auth context memory replay cache 907/head
Greg Hudson [Tue, 19 Mar 2019 15:22:08 +0000 (11:22 -0400)] 
Fix free of auth context memory replay cache

Also fix a memory leak in t_memrcache.c.

ticket: 8785

6 years agoUse zapfreedata() where appropriate 906/head
Greg Hudson [Thu, 14 Mar 2019 15:54:00 +0000 (11:54 -0400)] 
Use zapfreedata() where appropriate

6 years agoAdd zapfreedata() convenience function
Greg Hudson [Thu, 14 Mar 2019 15:26:44 +0000 (11:26 -0400)] 
Add zapfreedata() convenience function

6 years agoAdd tests for S4U2Self with certificate 887/head
Isaac Boukris [Thu, 17 Jan 2019 09:36:46 +0000 (11:36 +0200)] 
Add tests for S4U2Self with certificate

[ghudson@mit.edu: fixed memory leaks in test KDB method]

ticket: 8781

6 years agoAdd KDC support for X.509 S4U2Self requests
Isaac Boukris [Wed, 16 Jan 2019 22:23:25 +0000 (00:23 +0200)] 
Add KDC support for X.509 S4U2Self requests

Add a KDB function krb5_db_get_s4u_x509_principal() and an associated
method in the DAL, bumping the minor version and cleaning up a
leftover comment in the table from major version 6.

When processing an AS-REQ, look up the client principal by certificate
if the request contains a non-empty PA-S4U-X509-USER value.  When
processing an S4U2Self TGS-REQ, allow requests with certificates, and
look up the client principal by certificate if one is presented.

[ghudson@mit.edu: factored out lookup_client() in AS code; rewrote
commit message and some comments; adjusted flow control changes in
kdc_process_s4u_x509_user()]

ticket: 8781 (new)

6 years agoExpand S4U2Self exception in KDC lineage check
Isaac Boukris [Tue, 15 Jan 2019 00:53:25 +0000 (02:53 +0200)] 
Expand S4U2Self exception in KDC lineage check

An S4U2Self TGS-REQ using only a certificate to identify the user will
not include PA-FOR-USER, so we need to check both types when making an
exception in the lineage check.  (S4U2Self requests are allowed to
bypass the lineage check because cross-realm S4U2Self ends with a
backwards cross-realm request to the server realm.)

[ghudson@mit.edu: factored out padata check; deindented the code block
by combining conditionals; rewrote commit message]

ticket: 8780 (new)

6 years agoAdd new kvno protocol transition options
Isaac Boukris [Tue, 8 Jan 2019 05:19:20 +0000 (07:19 +0200)] 
Add new kvno protocol transition options

Add kvno -I to do S4U2Self without treating the principal as an
enterprise name (as -U does).  Add kvno -F to do S4U2Self with an
X.509 certificate.

[ghudson@mit.edu: changed code to read cert in PEM format; updated RST
man page instead of generated nroff file, and regenerated nroff file]

ticket: 8778 (new)

6 years agoFix client code for S4U2Self with certificate
Isaac Boukris [Fri, 11 Jan 2019 08:49:19 +0000 (10:49 +0200)] 
Fix client code for S4U2Self with certificate

During realm identification, don't send the certificate in the AS
request if we have an enterprise name, for consistency with the
Windows LSA API behavior.  If we are using just a certificate, use the
appropriate client principal name type with a single empty data
component.

krb5int_process_tgs_reply() needs to see an S4U2Self padata type in
in_padata to apply the correct logic when verifying the client
principal in the reply.  If we are using only a certificate, we
currently do not pass any in_padata (because we do not send
PA-FOR-USER in this case, and the PA-S4U-X509-USER is constructed via
a callback).  Change the code to place an empty PA-S4U-X509-USER in
in_padata, to be modified by the callback; that way we can reliably
detect the S4U2Self case when processing the reply.

In krb5_get_self_cred_from_kdc(), when constructing an empty client
principal for a cert-only S4U2Self request, properly terminate the
krb5_build_principal_ext() argument list to avoid a crash.  Don't
bother setting the name type as it isn't sent.

Only send the certificate in the first TGS-REQ to the client realm.
To the intermediate and final realms, send the principal name only.
Use the checksum-protected principal name in the first KDC's
PA-S4U-X509-USER response for subsequent requests and to verify the
unprotected client name in the final reply.

After receiving the final reply, check if we had cached credentials
under the discovered client name (unless it's the same as the input
client name) and return the cached credentials if we find them.

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

ticket: 8777

6 years agoUse memory replay cache for DO_TIME auth contexts 901/head
Greg Hudson [Fri, 1 Mar 2019 02:28:43 +0000 (21:28 -0500)] 
Use memory replay cache for DO_TIME auth contexts

Instead of requiring the caller to set up a persistent replay cache
for KRB-PRIV/KRB-SAFE/KRB-CRED messages produced in DO_TIME auth
contexts, use an in-memory replay cache.

Update the API documentation for the affected functions and correct
some inaccuracies.

ticket: 8785 (new)

6 years agoAdd memory replay cache facility
Greg Hudson [Thu, 28 Feb 2019 16:47:26 +0000 (11:47 -0500)] 
Add memory replay cache facility

Add a k5_memrcache type which can efficiently detect replayed tags
without any persistence or inteprocess sharing.  Also add unit tests.

6 years agoDocument the double-colon behavior of DIR ccaches 904/head
Robbie Harwood [Wed, 6 Mar 2019 23:01:50 +0000 (18:01 -0500)] 
Document the double-colon behavior of DIR ccaches

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

6 years agoImprove S4U2Self realm identification internals 890/head
Greg Hudson [Wed, 2 Jan 2019 21:54:28 +0000 (16:54 -0500)] 
Improve S4U2Self realm identification internals

Realm identification for S4U2Self requests ([MS-SFU] 3.1.5.1.1.1) uses
the AS code path with some differences: we might want to include a
subject certificate in pa-data, we want to stop as soon as we get a
reply indicating which realm the client is in, and we want to
communicate that realm to the caller.  The current method of making
these changes is fragile--it uses an optimistic preauth type but does
not actually pre-authenticate, and it assumes that the AS code will
terminate with a predictable error if there is no prompter and a
trivial GAK function.

Instead, add fields to krb5_get_init_creds_context for realm
identification, and support them in the AS state machine, making sure
never to invoke preauth modules.  Add a new library-internal function
k5_identify_realm() to set up an appropriate context, run the state
machine, and copy out the client principal of the last request on
success.

6 years agoUpdate comment in lock_file.c
Greg Hudson [Mon, 4 Mar 2019 21:11:11 +0000 (16:11 -0500)] 
Update comment in lock_file.c

Gnu libc commit 06ab719d30b01da401150068054d3b8ea93dd12f fixed the OFD
locking issue on 32-bit Linux.  We still need to work around the bug
for older versions, but update the comment to note the release in
which the bug was fixed.

6 years agoFix ASN.1 test secure cookie comparison 903/head
Greg Hudson [Mon, 4 Mar 2019 16:07:45 +0000 (11:07 -0500)] 
Fix ASN.1 test secure cookie comparison

One of the comparisons in ktest_equal_secure_cookie() was
tautological.  Use scalar_equal() for consistency with other tests.
Also use scalar_equal() in ktest_equal_kkdcp_message().

6 years agoRename configure.in to configure.ac 902/head
Greg Hudson [Sun, 3 Mar 2019 20:42:04 +0000 (15:42 -0500)] 
Rename configure.in to configure.ac

autotools plans to drop support for the name configure.in.
(automake's NEWS file expresses plans to drop support for it in
autoconf 2.0; autoconf added a warning in commit
560f16b52d3d3db1536d9ca5b863ce9b1a5c9e35, indicating in the commit
message that support will be dropped in a future version.)

ticket: 8788 (new)