Commit Graph

28910 Commits

Author SHA1 Message Date
Luke Howard
f17e48f613 gssapi: gss_compare_name() both ways (#503)
In the case that one name has no MNs and the second name only has an MN, then
the order in which the two names are passed in matters, but it shouldn't. Run
the comparison both ways.
2019-01-03 16:27:31 +11:00
Nicolas Williams
1aedba7d6f Travis: cat failure logs, show core backtraces (fix #499) 2019-01-02 22:44:42 -06:00
Luke Howard
57df2ff1cc gssapi: ntlm mech should use _gss_ntlm_copy_cred() to dup cred 2019-01-02 20:23:18 -06:00
Jeffrey Altman
e787bd1bc1 kadmin: kadmin_dispatch free krb5_principals at function exit
Change-Id: Ic50a17abf10c7055574de2236cdf1d1469375d8b
2019-01-02 20:19:23 -06:00
Jeffrey Altman
092cd5e838 kadmin: kadmin_dispatch out of memory handling
Coverity determined that a NULL pointer segmentation fault could occur
if krb5_storage_emem() fails.  Use krb5_enomem() to set an error message
on the context and do not perform further krb5_storage operations.

Change-Id: I9587208e46c184bb061443a44581a32dd722de33
2019-01-02 20:19:23 -06:00
Nicolas Williams
ff7a969c32 Begin documenting [password_quality] configuration 2019-01-02 17:29:08 -06:00
Nicolas Williams
d8394c65b7 Add new kadmin/ktutil --keep* and --enctypes opts
- Add --keepold/keepallold/pruneall options to various kadmin/ktutil
   commands.  Default behavior to "prune old keys".

 - When setting keys for a service, we need to specify enctypes for it:

    - Always use kadm5_randkey_principal_3() instead of the older
      kadm5_randkey_principal().

    - Add krb5_string_to_keysalts2(), like MIT's krb5_string_to_keysalts(),
      but with a context, and simpler.

    - Add --enctypes options to various kadmin/ktutil commands.

    - Add [libdefaults] supported_enctypes param with enctype[:salttype]
      list.

    - Add [realms] realm supported_enctypes param with enctype[:salttype]
      list.

      Default to aes128-cts-hmac-sha1-96:normal.
2019-01-02 17:29:08 -06:00
Nicolas Williams
7b76d6719f Fix VC warning about enctypes 2019-01-02 13:56:04 -05:00
Nicolas Williams
6f7c0e53c8 Fix warning in lib/gssapi/test_acquire_cred.c 2019-01-02 13:56:04 -05:00
Nicolas Williams
7d5f955b51 Fix warning in lib/krb5/test_acl.c 2019-01-02 13:56:04 -05:00
Nicolas Williams
752c3a6139 Fix warning in lib/hcrypto/test_dh.c 2019-01-02 13:56:04 -05:00
Nicolas Williams
ffc4ac1d8d Fix warnings in ASN.1 template test 2019-01-02 13:56:04 -05:00
Nicolas Williams
7c449afbf8 Fix lib/roken test macro redefinition 2019-01-02 13:56:04 -05:00
Nicolas Williams
299fbf5dac Fix warning in roken test on Windows 2019-01-02 13:56:04 -05:00
Nicolas Williams
43a911eedc Fix bug in kadmin check warning message 2019-01-02 13:56:04 -05:00
Nicolas Williams
454e729e84 Make KADM5_* flags unsigned, fix warning 2019-01-02 13:56:04 -05:00
Nicolas Williams
a6e6916c1c Fix warning in sl compiler output
Use a cast through uintptr_t to un-const rather than a cast through
unsigned long.  This was caught by the Appeyor Windows build.
2019-01-02 13:56:04 -05:00
Jeffrey Altman
1dd38cc3de lib/hx509: declare and apply HX509_LIB_xxx macros
libhx509 is not built according to the same export and calling conventions
on Windows as the other libraries.  This change declares and applies
HX509_LIB_FUNCTION, HX509_LIB_NORETURN_FUNCTION, HX509_LIB_CALL and
HX509_LIB_VARIABLE to lib/hx509.

As a result of this change the calling convention for exported functions
will be __stdcall instead of __cdecl.

Change-Id: Ibc3f05e8088030ef7d13798f1d9c9b190bc57797
2019-01-02 10:23:39 -06:00
Jeffrey Altman
bec4818943 WIN32: hint noreturn functions
apply __declspec(noreturn) compiler hints to functions that
do not return.

Change-Id: I3c6c4703c7235d1df3e21dccad5272ea4cddfd36
2019-01-02 10:23:39 -06:00
Jeffrey Altman
4d57ee72f3 lib/wind: get-punycode-examples.py whitespace fix
Change-Id: I89e82539578fd9436ee735c124401fa019369eee
2019-01-02 10:23:39 -06:00
Jeffrey Altman
da6190ec03 lib/gssapi/ntlm: _gss_ntlm_allocate_ctx handle calloc failure
If a memory allocation failure occurs, return an error instead of
triggering a segmentation fault.

Change-Id: I38f5e88ca2f1ba7411b05a35b925168015261eb4
2019-01-01 15:05:31 -05:00
Jeffrey Altman
c1c98d3cfd lib/roken: is_special_auxv_p test for AT_HWCAP2
fix breakage introduced by 6341132175
("roken: fix build breakage, AT_HWCAP2 may be undefined (#446)").
Detected by Coverity.

Change-Id: Iefdb73d4392e5184a69a99208945ece6b7b8ecb3
2019-01-01 14:59:19 -05:00
Luke Howard
7098aa038b Windows: remove reference to NetInfo 2019-01-01 12:53:17 +11:00
Luke Howard
b9dcbe505d Windows: default client keytab to %{LOCAL_APPDATA}/Kerberos/client.keytab 2019-01-01 12:53:17 +11:00
Radoslav Bodo
f3f06fcba9 kadmin selective prune of historic key for principal 2018-12-31 14:17:10 -06:00
Luke Howard
af0d8ef677 gssapi: support for client keytab in gss_acquire_cred (#383)
For compatibility with MIT Kerberos, support automatic acquisition of initiator
credentials if a client keytab is available. The default path on non-Windows is
/var/heimdal/user/%{euid}/client.keytab, but can be overriden with the
KRB5_CLIENT_KTNAME environment variable or the default_client_keytab_name
configuration option. If a client keytab does not exist, or exists but does not
contain the principal for which initiator credentials are being acquired, the
system keytab is tried.
2018-12-31 18:20:37 +11:00
Luke Howard
58b77bb485 krb5: fix a couple of missing options in verify_krb5_conf 2018-12-31 18:18:08 +11:00
Luke Howard
014f16883c libhcrypto: UI_UTIL_FLAG_VERIFY_SILENT 2018-12-30 15:39:49 -06:00
Luke Howard
7e0ff63b38 gssapi: add OPTSYM for gss_duplicate_cred() (#487)
Allow API-as-SPI mechanisms to provide gss_duplicate_cred(), introduced
in e6d1c108.
2018-12-29 20:22:12 +11:00
Luke Howard
d8e4328762 kdc: log principal name in TGT not found error 2018-12-29 15:01:43 +11:00
Nicolas Williams
e6d1c10808 Rewrite gss_add_cred() (fix #413)
It turns out gss_add_cred() really needed a complete rewrite.  It's much
better to first have a gss_duplicate_cred() (which has been needed for
other reasons anyways), and use that when the input_cred_handle is not
GSS_C_NO_CREDENTIAL and output_cred_handle is not NULL, then mutate that
duplicate credential handle (or the input_cred_handle if
output_cred_handle is NULL).
2018-12-28 19:26:25 -06:00
Jeffrey Altman
134b53ead1 lib/roken: roken_get_shell unreachable code warning
When WIN32 is undefined an unreachable code warning was generated
since "/bin/sh" is returned as the default resposne.

Change-Id: I757c9d05db62c1d52fee0e510259098d73273a84
2018-12-28 14:31:21 -05:00
Jeffrey Altman
51c2a5831a lib/kadm5: _kadm5_s_init_hooks
prevent leak of configuration strings introduced by
f62b00e33c ("kadm5: improve
kadm5 hook logging (#397)")

Change-Id: I12c028241e6ee0175599b6edc6a334c6efb858d9
2018-12-28 14:26:11 -05:00
Nicolas Williams
b0a357429d Fix warning in lib/gssapi/test_context.c 2018-12-28 01:09:38 -06:00
Nicolas Williams
7c03b981a4 Fix warning in lib/krb5/get_default_principal.c 2018-12-28 01:09:38 -06:00
Nicolas Williams
06773bba48 Fix warning in lib/ipc/tc.c 2018-12-28 01:09:38 -06:00
Nicolas Williams
6df981e048 Fix warning in lib/krb5/test_store.c 2018-12-28 01:09:38 -06:00
Luke Howard
36ad8fa536 krb5: fix pointer indirection error in keyring cache (#166) 2018-12-28 17:54:18 +11:00
Nicolas Williams
698c521dd6 Install ldap-utils in Travis Linux builds 2018-12-27 15:55:49 -06:00
Nicolas Williams
7a824146fa Fix defaultsearchbase in check-ldap's slapd.conf 2018-12-27 15:55:49 -06:00
Nicolas Williams
e93a135765 Fix check-ldap slapd start race
We start slapd in the foreground (-d0) but backgrounded in the shell,
then we wait 4 seconds.  This causes a race condition however.  This
commit makes the slapd-init script more robust and limits the wait to
however many seconds (up to 30) that slapd needs to start service.
2018-12-27 15:55:49 -06:00
Luke Howard
65ed504d21 hcrypto: print failure on password mismatch (#469)
UI_UTIL_read_pw_string(), an interface borrowed from OpenSSL, should report
password verification failure to stderr.
2018-12-27 17:40:57 +11:00
Luke Howard
410d96f480 kadmin: do not assign passwords at realm initialization
Since c6bf100b password quality checks have been moved out of kadmindd and into
libkadm5. This means that all password changes are subject to quality checks,
if enforce_on_admin_set is true (the default). In rare instances it could be
possible for realm initialization to fail because the randomly generated
passwords do not pass the password quality test. Fix this by creating
principals with no password or key, rather than with a random password.

Random *keys* continue to be set immediately after the principal is created,
and before DISALLOW_ALL_TIX is unset, so there should be no functionality or
security implications from this change. It is safe to call a server-side API
such as kadm5_s_create_principal_with_key() as local_flag is asserted to be
true.
2018-12-27 17:11:27 +11:00
Luke Howard
be3836d4ca Revert "kadmin: do not assign passwords at realm initialization"
This reverts commit 83def5bc18. Not passing all
tests, will resubmit as pull request.
2018-12-27 16:42:36 +11:00
Luke Howard
83def5bc18 kadmin: do not assign passwords at realm initialization
Since c6bf100b password quality checks have been moved out of kadmindd and into
libkadm5. This means that all password changes are subject to quality checks,
if enforce_on_admin_set is true (the default). In rare instances it could be
possible for realm initialization to fail because the randomly generated
passwords do not pass the password quality test. Fix this by creating
principals with no password or key, rather than with a random password.

Random *keys* continue to be set immediately after the principal is created,
and before DISALLOW_ALL_TIX is unset, so there should be no functionality or
security implications from this change. It is safe to call a server-side API
such as kadm5_s_create_principal_with_key() as local_flag is asserted to be
true.
2018-12-27 16:27:16 +11:00
Luke Howard
f62b00e33c kadm5: improve kadm5 hook logging (#397)
Centralize logging for kadm5 hook failure, log successful hook loading, better
logging on hook load failures and on platforms that do not support dlopen().
2018-12-27 11:58:26 +11:00
Isaac Boukris
efb111e450 Separate enterprise and canonicalize flags
The meaning of the two is different and we should
not implicitly set both if one was requested (this
aligns the logic with MIT kinit -C/-E options).

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-26 16:55:13 -06:00
Isaac Boukris
2ee4169dd1 Avoid shadowing KDC returned error code
The referral function does not handle short names,
so avoid falling over it in case capath fails, in
order to preserve the error code returned by the
KDC (it wasn't a problem before the order between
the two functions has changed).

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-26 16:55:13 -06:00
Isaac Boukris
c67b296694 KDC: Add ETYPE_INFO{,2} padata on PREAUTH_FAILED
Without it, Windows clients will perform an
extra AS-REQ, causing password lockout count
to increase by two instead of one.

This is an alternative to Samba commit:
978bc8681e74ffa17f96fd5d4355094c4a26691c

One difference however, it doesn't return
ENC_TIMESTAMP in PREAUTH_REQUIRED, only the
necessary ETYPE_INFO{,2} (same as Windows).

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-26 16:55:13 -06:00
Isaac Boukris
c555ed6a1f KDC: Allow hdb to set the issued ticket's realm
This is used by Samba to set the canonical realm in
case netbios realm was requested (same as Windows).

Regression introduced by upstream commit:
378f34b4be

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-26 16:55:13 -06:00