Commit Graph

5306 Commits

Author SHA1 Message Date
Nicolas Williams
fe43be8558 Add include/includedir directives for krb5.conf 2017-02-27 18:15:59 -06:00
Jeffrey Altman
ec39b832ff kdc: fix kx509 service principal match
Each KDC is a kx509 server.  The service principal must be of the
form

  kca_service/<localhost.domain>@<DEFAULT_REALM>

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

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

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

Change-Id: I6bd5f90b674ebb7220d8efafa6d339fdc21e1a07
2017-01-27 00:37:08 -05:00
Nicolas Williams
3e65dfbc32 Fix make dist missing files (#228) 2016-12-15 12:15:56 -06:00
Viktor Dukhovni
3657f23a9e Fix more doxygen bitrot 2016-12-15 04:28:21 -05:00
Nicolas Williams
2ebec2e4ec Fix some Doxygen warnings 2016-12-14 22:05:46 -06:00
Nicolas Williams
bbaae5f43c Fix 32-bit time_t regression (#220) 2016-12-06 22:44:23 -06:00
Nicolas Williams
6e5bbbf65d Fix FAST client memleak 2016-12-06 22:44:23 -06:00
Nicolas Williams
e5126ab924 Fix warnings 2016-11-28 17:34:44 -06:00
Nicolas Williams
3ba12317a0 Misc fixes (coverity) 2016-11-28 15:09:55 -06:00
Nicolas Williams
f38089257b Misc fixes (coverity) 2016-11-20 17:43:51 -06:00
Nicolas Williams
6696920d9e Fix leak in krb5_rd_rep() callers 2016-11-20 17:43:51 -06:00
Nicolas Williams
52a562a3a4 Misc fixes (coverity) 2016-11-18 22:21:45 -06:00
Jeffrey Altman
69fbbfdfcb krb5: fix verify_conf syslog facility check
search for facility not severity

Change-Id: I79e9104d1fd27e8d11f7f9c6006676d947086ac5
2016-11-18 21:24:26 -05:00
Jeffrey Altman
5cf454ca54 krb5: _krb5_expand_path_tokens missing va_end()
when returning early due to memory allocation error must call va_end()

Change-Id: Icc42771c166453f67679334cea19ed9be692bd87
2016-11-18 21:12:36 -05:00
Jeffrey Altman
d07fe95b61 krb5: krb5_data_free() do not test before free()
Change-Id: I739eb0b227eb7885bb83b6e68eaf39db81b1ceb5
2016-11-18 20:43:19 -05:00
Nicolas Williams
7fa85e6d6d Round #3 of scan-build warnings cleanup 2016-11-16 23:27:27 -06:00
Nicolas Williams
1c81ddf4e2 Round #2 of scan-build warnings cleanup 2016-11-16 17:03:14 -06:00
Nicolas Williams
953dc07391 Round #1 of scan-build warnings cleanup 2016-11-15 21:27:20 -06:00
Jeffrey Altman
f561b55d38 krb5: windows tests require HEIMBASE
When building the lib/krb5 tests link against HEIMBASE in order to
make use of heim_abort() and friends.

Change-Id: Ifaf54177bbb14cddf0f3544add370cda158783d1
2016-11-15 00:33:55 -05:00
Jeffrey Altman
961f543a27 Set princ type to NT-SMTP-NAME when parsing
In krb5_parse_name_flags(), if the principal name is not an enterprise
name, is one component in length and contains an '@', set the principal
type to NT-SMTP-NAME as specified by RFC 4120.
2016-11-14 21:29:47 -06:00
Jeffrey Altman
6a1db3fb1c princ type NT-UNKNOWN + "host" == NT-SRV-HST
Treat principals of type NT-UNKNOWN as NT-SRV-HST if the first component
of the principal name is "host".

Change-Id: I28fb619379daac827436040e701d4ab7b279852b
2016-11-14 21:29:47 -06:00
Jeffrey Altman
09bdb3ab3e Set the right name type for anon princ (client)
In fast_wrap_req() set the correct type in KDC_REQ client principal
name.

Also fix ENOMEM handling.
2016-11-14 21:29:47 -06:00
Nicolas Williams
a59bb7132f When building a princ name pick a sane def type
This is part of the fix to #173.  MSFT RODCs insist on the name type for
krbtgt principals be set to KRB5_NT_SRV_INST.

Commentary from Jeffrey Altman <jaltman@secure-endpoints.com>

As reported by David Mulder of Dell's Quest, Active Directory will
return a BAD_INTEGRITY error when a request for a krbtgt service
ticket is received with principal type NT-PRINCIPAL instead of NT-SRV-INST
as required by RFC 4120.

[Nico: RFC4120 does not require this.  See the description of the
       name-type field of PrincipalName on page 55.]

  ERROR: VAS_ERR_KRB5: Failed to obtain credentials.
  Client: SLED10-32$@F.QAS,
  Service: SLED10-32$@F.QAS, Server: ad2-f.f.qas
  Caused by: KRB5KRB_AP_ERR_BAD_INTEGRITY (-1765328353): Decrypt integrity check failed

Microsoft began enforcing principal type checking for RODCs in 2008R2.
Microsoft does state that ALL krgtgt/REALM tickets SHOULD be sent using
principal name type of KRB5_NT_SRV_INST instead of KRB5_NT_PRINCIPAL.

From Microsoft:

  "I believe we discovered the problem. There isn't a bug in Windows.
  There's been a code change to address another issue which puts in additional
  checks for Kerberos tickets. The problem is with the Unix clients when the
  client request a TGT. The Unix clients are using Name-type Principal
  [KRB_NT_PRINCIPAL (1)] instead of using Name-type Service and Instance
  [KRB_NT_SRV_INST (2)]...."

This change assigns the NT-SRV-INST principal type each time a krbtgt
service principal is created.  Unlike Microsoft, the Heimdal mostly does
not care about the name-type of any principals, with the exception of
referrals, where the name type is needed to decide how to find a
next-hop realm.
2016-11-14 21:29:47 -06:00
Florian Best
7422cd1f6b Implement krb5_get_init_creds_opt_set_change_password_prompt() 2016-11-11 11:48:43 -06:00
Jeffrey Altman
a013e93e95 default life/renewlife time to KDC policy
Instead of imposing a default 10 hour ticket lifetime and 1 month renew
lifetime when requesting tickets, increase the default lifetime and
renew lifetime to 2147483647 seconds.  This ensures that in the absence
of any other configuration or command line parameters that the KDC will
determine the ticket lifetime and renew lifetime.

Change-Id: I52b6eeac1ee830a9bf4d0130e8f4ec7b70bc8694
Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-11-10 16:13:10 -06:00
Nicolas Williams
616aaf95a8 Don't suppress DNS search list by appending '.'
The original motivation was to avoid extra timeouts when the network is
broken.  However this doesn't avoid one of the timeouts and adds
complexity and introduced bugs.

To really suppress search lists use ndots.
2016-11-10 13:17:19 -06:00
Nicolas Williams
13cb3b5646 Don't inhibit /etc/services matches 2016-11-09 22:49:03 -06:00
Nicolas Williams
6a68376a33 Don't inhibit /etc/hosts matches (fix #32)
Apending '.' to the hostname passed to `getaddrinfo()` is good for
avoiding extra timeouts when the search list is non-empty and the
network is broken, but searches in /etc/hosts are typically inhibited
then.  The fix is to try again without the trailing '.' if the first
lookup failed for any reason other than a timeout.
2016-11-09 22:49:03 -06:00
Roland C. Dowdeswell
37b987a848 lib/krb5/fcache.c: fcc_store_cred() was using ret before setting it. 2016-11-08 17:14:08 -05:00
Stefan Metzmacher
0ff40e2f4c lib/krb5: destroy a memory ccache on reinit
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12369

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>

(Bases on Samba commit 2abc3710a8a63327a769ba0482c553ed274b2113)
2016-11-08 15:36:14 -05:00
Roland C. Dowdeswell
a730c89376 lib/krb5/fcache.c: couple of uses of errno after it may have been changed. 2016-11-08 15:19:17 -05:00
Roland C. Dowdeswell
59732ce753 lib/krb5/fcache.c: return errors in fcc_destroy() rather than always 0. 2016-11-08 15:19:17 -05:00
Luke Howard
7b720cf61c krb5: implement draft-ietf-kitten-aes-cts-hmac-sha2-07 2016-10-08 08:17:11 +02:00
Uri Simchoni
a3bece16c7 lib/krb5: keep a copy of config etypes in the context
When reading configuration file, keep an extra copy of
the encryption types, and use this when resetting the
encryption types to default.

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

Signed-off-by: Uri Simchoni <uri@samba.org>
2016-09-30 08:37:06 -07:00
Viktor Dukhovni
09c4e516bf Further polish and docs for hierarchical capaths 2016-08-10 21:09:15 -04:00
Viktor Dukhovni
fc4e52174c Silence possible compiler warning
Reported by David Mulder, PR 195.
2016-08-09 20:57:04 -04:00
Viktor Dukhovni
99dfbda161 Add missing error check in krb5_check_transited
Reported by David Mulder, PR 195.
2016-08-09 20:52:58 -04:00
Viktor Dukhovni
1501740952 Fix transit path validation
Also implement KDC hierarchical transit policy checks.  The "hier_capaths"
parameter defaults to "yes" in [libdefaults] or can be set explicitly in
[realms] per-realm.
2016-08-08 16:29:18 -05:00
Nicolas Williams
41b6c829f7 Fix missing .El in krb5.conf.5 2016-08-08 14:14:04 -05:00
Jeffrey Altman
6234073499 add missing principal types
Add the WELLKNOWN and NT-HST-DOMAIN principal types to the nametype
table and asn.1

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

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

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

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

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

Change-Id: I122664c6d707a5f926643808ba414bf4f681f8b8
2016-06-16 16:38:17 -04:00
Abhinav Upadhyay
1f89ce4973 Fix typo: Sepember -> September 2016-06-11 00:18:59 +05:30
Viktor Dukhovni
840dc40574 Refine name canonicalization
When storing credentials whose ticket principal is not equal to the
requested principal, store the ticket under both names not only when
the original realm is the referral realm, but more generally for any
difference at all.  This matches MIT behaviour.

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

Also fix segfault when no creds and debugging
2016-06-09 01:13:15 -04:00
Nicolas Williams
2623cee389 Do not search system paths for non-ccapi plugins
On OS X anyways, since Heimdal cannot be built to replace the system
Kerberos implementation in OS X (even though it's based on Heimdal).

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

This means, for example, that OS X's plugins for PAC creation and
verification cannot be used by Heimdal.
2016-06-09 01:13:14 -04:00
Viktor Dukhovni
7d9fcb46b9 Ensure newly allocated ccache handles are zeroed
Otherwise, type-independent fields such as `initialized` have
uninitialized values, and incorrect behaviour may result.
2016-06-02 02:40:50 -04:00
Andrew Bartlett
2ff110cfa6 Merge pull request #154 from metze-samba/heimdal-for-upstream
lib/krb5: allow predefined PAC_{LOGON_NAME,PRIVSVR_CHECKSUM,SERVER_CH…
2016-05-14 22:32:13 +12:00
Andrew Bartlett
cc38a9f7d1 Merge pull request #174 from abhinav-upadhyay/fix-krb5.conf.5
Various fixes in kfb5.conf man page:
2016-05-14 22:26:43 +12:00
Viktor Dukhovni
1017a594ef Use OpenSSL include path as needed
For consistency make "-I" part of the macro value set by autoconf.

For now, don't attempt to handle OpenSSL rpath in cf/crypto.m4.
That's much easier by just setting LDFLAGS when running configure.
Otherwise too many Makefiles to edit and libtool and automake do
their best to undo the rpath.
2016-05-07 05:29:12 -04:00
Abhinav Upadhyay
1e085bb4da Various fixes in kfb5.conf man page:
Fix grammar at multiple places
Also, fix mdoc syntax at one place. There should be a space between the
section and the comma in the .Xr macro.
2016-04-28 15:50:48 +05:30