Commit Graph

853 Commits

Author SHA1 Message Date
Nicolas Williams
ba5bb07495 krb5: disable automatic kx509 by default 2019-11-13 18:42:28 -06:00
Nicolas Williams
dfada0ccad kx509: Add CSR support
This commit adds support for proof of posession to the kx509 protocol by
using PKCS#10 CSRs.

This allows conveyance of extReq CSR attributes requesting desired
Certificate Extensions.
2019-10-09 20:53:30 -05:00
Nicolas Williams
6a7e7eace6 Add kx509 client and revamp kx509 service
This commit adds support for kx509 in libkrb5, and revamps the KDC's
kx509 service (fixing bugs, adding features).

Of note is that kx509 is attempted optimistically by the client, with
the certificate and private key stored in the ccache, and optionally in
an external PEM or DER file.

NOTE: We do not optimistically use kx509 in krb5_cc_store_cred() if the
      ccache is a MEMORY ccache so we don't generate a key when
      accepting a GSS context with a delegated credential.

kx509 protocol issues to be fixed in an upcoming commit:

 - no proof of possession (this is mostly not too bad, but we'll want to
   fix it by using CSRs)
 - no algorithm agility (only plain RSA is supported)
 - very limited (no way to request any options in regards to the
   requested cert)
 - error codes are not very useful

Things we're adding in this commit:

 - libkrb5 kx509 client
 - automatic kx509 usage hooked in via krb5_cc_store_cred() of start TGT
 - per-realm templates on the KDC side
 - per-realm issuer certificates
 - send error messages on the KDC side
   (this is essential to avoid client-side timeouts on error)
 - authenticate as many error messages
 - add a protocol probe feature so we can avoid generating a
   keypair if the service is not enabled
   (once we add support for ECC algorithms we won't need this
    anymore; the issue is that RSA keygen is slow)
 - support for different types of client principals, not just username:

    - host-based service and domain-based service, each with its own
      template set per-{realm, service} or per-service

   (the idea is to support issuance of server certificates too, not
    just client/user certs)
 - more complete support for SAN types
 - tests (including that PKINIT->kx509->PKINIT works, which makes it
   possible to have "delegation" of PKIX credentials by just delegating
   Kerberos credentials)
 - document the protocol in lib/krb5/kx509.c

Future work:

 - add option for longer-ticket-lifetime service certs
 - add support for ECDSA, and some day for ed25519 and ed448
 - reuse private key when running kinit
   (this will require rethinking how we trigger optimistic kx509
    usage)
 - HDB lookup for:
    - optional revocation check (not strictly necessary)
    - adding to certificates those SANs listed in HDB
       - hostname aliases (dNSName SANs)
       - rfc822Name (email)
       - XMPP SANs
       - id-pkinit-san (a user could have aliases too)
 - support username wild-card A RRs, ala OSKT/krb5_admin
    i.e., if a host/f.q.d.n principal asks for a certificate for
    some service at some-label.f.q.d.n, then issue it
   (this is not needed at OSKT sites because OSKT already
    supports keying such service principals, which means kx509
    will issue certificates for them, however, it would be nice
    to be able to have this independent of OSKT)
   (a better way to do this would be to integrate more of OSKT
    into Heimdal proper)
 - a kx509 command, or heimtools kx509 subcommand for explicitly
   attempting use of the kx509 protocol (as opposed to implicit, as is
   done in kinit via krb5_cc_store_cred() magic right now)

Issues:

 - optimistically trying kx509 on start realm TGT store -> timeout issues!
    - newer KDCs will return errors because of this commit; older ones
      will not, which causes timouts
    - need a separate timeout setting for kx509 for optimistic case
    - need a [realm] config item and DNS SRV RR lookup for whether a
      realm is expected to support kx509 service
2019-10-08 21:26:50 -05:00
Nicolas Williams
c6d0793e63 Do not recover log in kadm5_get_principal() 2019-10-03 15:52:15 -05:00
Nicolas Williams
f40d393c83 tests/kdc/check-authz still fails
I couldn't figure out why this fails in Travis, so I'm nuking it.
2019-07-09 15:47:12 -05:00
Nicolas Williams
1af64c5de5 Do not use real $HOME in tests/kdc/check-authz
This test would fail if ~/.k5login has incorrect permissions.

Now we set $HOME to $objdir and use a canned .k5login.
2019-07-09 12:27:16 -05:00
Luke Howard
d89b5cb966 kuser: allow kinit to renew anonymous PKINIT tickets
Anonymous PKINIT tickets discard the realm information used to locate the
issuing AS. Store the issuing realm in the credentials cache in order to locate
a KDC which can renew them.
2019-05-21 16:00:20 +10:00
Isaac Boukris
b7fe0fb85a kdc: allow checksum of PA-FOR-USER to be HMAC_MD5
even if tgt used an enctype with a different checksum.

Per [MS-SFU] 2.2.1 PA-FOR-USER the checksum is always
HMAC_MD5, and that's what Windows and MIT clients send.

In heimdal both the client and kdc use instead the
checksum of the tgt, and therefore work with each other
but windows and MIT clients fail against heimdal KDC.

Both Windows and MIT KDC would allow any keyed checksum
to be used so Heimdal client work fine against it.

Change Heimdal KDC to allow HMAC_MD5 even for non RC4
based tgt in order to support per-spec clients.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2019-05-18 22:33:48 -04:00
Luke Howard
3051db0d5d kuser: support authenticated anonymous AS-REQs in kinit
Allow kinit to request anonymous tickets with authenticated clients, not just
anonymous PKINIT.
2019-05-14 15:16:19 -04:00
Luke Howard
2287c250b2 Revert "Revert "Fix tests/plugin/windc.c""
windc doesn't link against libkdc, so it doesn't need to check its instance;
however, we will continue to export kdc_get_instance() from libkdc in case
other windc plugins do link against it.
2019-01-05 10:55:13 +11:00
Luke Howard
e776e6c5ed Revert "Fix tests/plugin/windc.c"
Will fix by exporting kdc_get_instance() from libkdc.
2019-01-05 10:47:42 +11:00
Nicolas Williams
9b39978ddd Fix tests/plugin/windc.c 2019-01-04 11:26:28 -06:00
Luke Howard
e739c4d0c2 windc: update test windc plugin to use new load SPI 2019-01-04 15:17:20 +11:00
Luke Howard
e0bb9c10ca gssapi: credential store extensions (#451)
Implement the GSS-API credential store API extensions defined by MIT here:

https://k5wiki.kerberos.org/wiki/Projects/Credential_Store_extensions

Note: we kill off gss_acquire_cred_ext() here. This was never a public API,
although mechanisms could have implemented it and I briefly used it in my
BrowserID prototype mechanism. gss_acquire_cred_ext_from() occupies the place
in the dispatch table where gss_acquire_cred_ext() used to, but this structure
was never visible outside Heimdal (i.e. it is only used by internal
mechanisms);

(Mechanisms that need to accept arbitrary key/value dictionaries from
applications should now implement gss_acquire_cred_from().)
2019-01-03 14:38:39 -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
Radoslav Bodo
f3f06fcba9 kadmin selective prune of historic key for principal 2018-12-31 14:17:10 -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
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
Luke Howard
c89d3f3b8c kadmin: allow enforcing password quality on admin password change
This patch adds the "enforce_on_admin_set" configuration knob in the
[password_quality] section. When this is enabled, administrative password
changes via the kadmin or kpasswd protocols will be subject to password quality
checks. (An administrative password change is one where the authenticating
principal is different to the principal whose password is being changed.)

Note that kadmin running in local mode (-l) is unaffected by this patch.
2018-12-26 15:38:48 +11:00
Adam Henry Lewenberg
c9c72ab11c Put double quotes around the foopassword in case password has whitespace
From a suggestion by nicowilliams, put double quotes aroung the varaible
$foopassword in case the password contains whitespace or other special
characters.
2018-12-23 01:33:31 -06:00
Adam Lewenberg
7c82637120 Make the password used in check-kadmin.in be settable as a parameter
When we use a custom patch that makes strong passwords required even for
administrators the check-kadmin test will fail because "foo" (the password
used in check-kadmin.in) is not a strong password. So, we make the
password used in check-kadmin.in settable as a parameter. This way, we
only have to change one line of check-kadmin.in rather than a dozen to get
check-kadmin to pass when using the strong-passwords everywhere patch.

Note that this change makes no real change to any of the tests in
check-kadmin.in: no tests are changed, removed, or added.
2018-12-23 01:33:31 -06:00
Quanah Gibson-Mount
c75bb31a9c For issue#381
Fix output to be grammatically correct.
2018-12-18 06:21:07 +13:00
Isaac Boukris
9de0cd8f7e tests: fix kadmin5 wrapper from repeating flags
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
2018-12-14 16:59:44 -06:00
YASUOKA Masahiko
4279b467cb Remove an extra line that uses "klist". The command was replaced with
"heimtools klist".
2018-12-14 16:31:42 -06:00
Olly Betts
7ad6c01a8d Fix assorted typos 2018-12-14 17:30:14 -05:00
Daria Phoebe Brashear
d9425fecdf heim_verbose can't be used mid-stanza in shell commands
Solaris make won't allow @echo in a shell command string as there is no
command called @echo, and it passes the whole shell command to the shell
without poaching off the @ itself first
2018-04-19 13:12:59 -04:00
Viktor Dukhovni
8a0186c5b9 Fix missing wait_for in check-iprop 2017-05-28 16:58:02 -05:00
Viktor Dukhovni
c02af7b3bb Avoid another potential check-iprop race.
Though a race was never observed, the re-sync, slave DB deletion,
master changes and restart did not take into account late changes
in the master before slave down.
2017-04-18 16:54:48 -05:00
Viktor Dukhovni
69bb29ea29 Fix check-iprop race
Creation of a random key HDB entry takes 3 updates, not one.  Instead of
hard-coding this magic count, wait for the appearance of the expected
entry with no "invalid" flag among its attributes.
2017-04-18 10:04:56 -05:00
Viktor Dukhovni
b1e699103f Fix transit path validation CVE-2017-6594
Commit f469fc6 (2010-10-02) inadvertently caused the previous hop realm
to not be added to the transit path of issued tickets.  This may, in
some cases, enable bypass of capath policy in Heimdal versions 1.5
through 7.2.

Note, this may break sites that rely on the bug.  With the bug some
incomplete [capaths] worked, that should not have.  These may now break
authentication in some cross-realm configurations.
2017-04-13 18:06:39 -05:00
Viktor Dukhovni
6b285e67e5 Avoid expr in non-portable comparison
The output of `wc -l` includes leading white-space, and at least
in FreeBSD 11, `expr 1 + "$foo"` fails when "$foo" (captured as
`wc -l` output) has leading whitespace.  Instead, just emit one
more line for "wc" to count.
2017-03-16 11:41:19 -04:00
Viktor Dukhovni
008a26c489 Leave srcdir as-as and use absolute form only as needed 2017-03-15 19:12:03 -04:00
Nicolas Williams
4c64231430 Misc last newline fixes
Originally by Christos Zoulas.
2017-03-13 18:39:41 -04:00
Quanah Gibson-Mount
7c16ce3457 Minor typo/grammar fixes 2017-03-10 15:47:43 -05:00
Viktor Dukhovni
28b6b96e09 Don't do AFS string-to-key tests when feature is disabled 2017-03-09 20:26:30 -05:00
Viktor Dukhovni
2baa0a00c8 Skip mdb_stat test when the command is not available 2017-03-09 20:20:25 -05:00
Nicolas Williams
fe43be8558 Add include/includedir directives for krb5.conf 2017-02-27 18:15:59 -06:00
Nicolas Williams
9ab5ffa3ba check-iprop: don't fail to kill daemons 2017-01-24 11:08:26 -06:00
Nicolas Williams
d237e8e4d9 Fix check-iprop races 2016-12-22 09:40:14 -06:00
Nicolas Williams
bda422f40b Make check-ldap work again
(cherry picked from commit 7a1f7499bd28447159000c31a6638b48ab2d9596)
2016-12-19 14:46:54 -06:00
Nicolas Williams
3e65dfbc32 Fix make dist missing files (#228) 2016-12-15 12:15:56 -06:00
Viktor Dukhovni
a51ecdb8db Make leaks-kill.sh a no-op for now 2016-12-07 19:52:54 -06:00
Nicolas Williams
1ed7bd56b1 Fix leaks-kill.sh --check 2016-12-07 19:52:29 -06:00
Nicolas Williams
2027aa11ed Use --detach in tests to avoid waiting 2016-12-07 19:52:29 -06:00
Nicolas Williams
8735d47d8b Add missing tests/gss env setup 2016-12-06 22:44:34 -06:00
Jelmer Vernooij
650d730d0d Increase timeout when waiting for iprop-slave.
This is required when running on slower platforms. We're hitting the
timeout building on mips.
2016-12-04 17:40:38 -06:00
Nicolas Williams
16b77f7dfa Fix make dist 2016-11-28 21:35:34 -06:00
Nicolas Williams
274021f7db Make check-ldap run on Ubuntu
Apparmor on Ubuntu prevents slapd from using the Unix domain socket we
want it to.  The fix is to copy the slapd executable into the objdir,
which disables the apparmor profile for slapd.

Also, make sure the ldapi: URI has the right path for the socket in
krb5.conf.
2016-11-15 15:35:29 -06:00
Nicolas Williams
2c20a5a8bc Set KRB5_CONFIG earlier in check-ldap
Otherwise the kdc won't find the plugin.
2016-11-15 14:16:54 -06:00