Commit Graph

119 Commits

Author SHA1 Message Date
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
375dd8897f klist: partial fix of -v --json
It's still not supported, but at least it generates valid JSON now.

Note that --json w/o -v is functional but has issues, specifically the
rtbl_add_column_entry() does not encode strings properly for output as JSON
strings.  Fixing this will take significantly more effort.  One wonders if it
might not be better to use a proper JSON library instead of the rtbl stuff.
2019-10-03 13:09:18 -05:00
Nicolas Williams
697c6462cf klist: fix verbose printing of config entries 2019-10-03 13:09:18 -05:00
Luke Howard
a7bb4504f2 klist: display all known flags when listing tickets
Show transited-policy-checked, ok-as-delegate and anonymous flags when listing
credentials.
2019-05-18 23:19:06 -04:00
Quanah Gibson-Mount
7c16ce3457 Minor typo/grammar fixes 2017-03-10 15:47:43 -05:00
Jeffrey Altman
5debfae6d1 er: klist print_tickets leaks 'str'
Change-Id: Ie86f3a9d64ceb6d44cd36be06700194b978247c9
2016-11-18 23:04:06 -05:00
Nicolas Williams
7fa85e6d6d Round #3 of scan-build warnings cleanup 2016-11-16 23:27:27 -06:00
Ken Dreyer
9dd7e27bf7 klist: fix spelling in comments 2014-05-28 14:34:06 -06:00
Viktor Dukhovni
c6548bc166 Don't deref NULL pointer with klist -t 2013-10-03 20:41:49 -04:00
Love Hornquist Astrand
a1168815ec use krb5_cc_get_lifetime 2013-07-16 14:42:24 +02:00
Love Hornquist Astrand
b2ff260e15 klist --json support 2013-05-07 16:47:45 -07:00
Jelmer Vernooij
2b365b2327 Rename kcc to heimtools.
This should prevent naming clashes with other utilities named 'kcc'.

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2012-03-06 00:06:26 -08:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
b1909b2daa Fixes from NetBSD via Thomas Klausner and Roland C. Dowdeswell 2011-05-04 21:31:10 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
92a827da9b move klist to kcc 2010-11-24 16:21:44 -08:00
Asanka Herath
85f5f6bbda klist: If we aren't being verbose, we don't need the full ticket 2010-09-14 08:04:15 -04:00
Love Hornquist Astrand
f4585e3cc3 make list caches more useful, support -A 2009-11-22 09:55:13 -08:00
Love Hornquist Astrand
0c112865b4 Drop RCSID 2009-08-20 19:03:15 -07:00
Love Hornquist Astrand
e568ea28b2 No need to check for NULL, principal is allocated. 2009-07-30 09:47:24 +02:00
Love Hörnquist Åstrand
44493f8921 use krb5_principal_get_realm
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25118 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-16 08:13:51 +00:00
Love Hörnquist Åstrand
ebc8d73af1 don't set unused variables, remove undefined behavior:
"Pass-by-value argument in function is undefined."

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24869 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-27 03:33:26 +00:00
Love Hörnquist Åstrand
97b2277b95 move rcsid, make afs optional
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24365 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:32:11 +00:00
Love Hörnquist Åstrand
35425fff7d print friendly name in klist output if it differs from principal
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24183 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-12-15 04:29:23 +00:00
Love Hörnquist Åstrand
bf2976562a print friendly name
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24182 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-12-15 04:29:13 +00:00
Love Hörnquist Åstrand
c433df9fa7 use krb5_is_config_principal()
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23867 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-28 05:14:41 +00:00
Love Hörnquist Åstrand
7b0f314da2 select heimdal_kuser as text domain
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23836 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-14 11:54:21 +00:00
Love Hörnquist Åstrand
18e444d6d4 Use unparse_flags for ticket flags.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23830 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-14 11:53:28 +00:00
Love Hörnquist Åstrand
b852960c8a N_()ify
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23829 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-14 11:53:13 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
fecad68410 add new option --hidden that doesn't display principal that starts with @
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20516 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-04-22 10:40:41 +00:00
Love Hörnquist Åstrand
0d1b4d2de9 remove code that depend on kerberos 4 library
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20458 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-04-19 20:41:27 +00:00
Love Hörnquist Åstrand
9e3b1291f4 (print_cred_verbose): include ticket length in the verbose output
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19770 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-01-09 00:03:46 +00:00
Love Hörnquist Åstrand
c31be304c0 Use krb5_get_kdc_sec_offset.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18528 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-17 16:00:00 +00:00
Love Hörnquist Åstrand
652da91adb Rename u_intXX_t to uintXX_t
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17447 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-05 10:52:01 +00:00
Love Hörnquist Åstrand
a271224bab In the list caches view, rename the Status field to Expires.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16245 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-10-26 19:46:10 +00:00
Love Hörnquist Åstrand
737b532df0 Change short flag of --list-caches to -l (-v is already used).
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16125 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-10-06 19:56:38 +00:00
Love Hörnquist Åstrand
cd2ce0c2a6 Add option --list-caches that lists the avaible caches and their status.
$ klist --list-caches
  Principal        Cache name               Status
lha@E.KTH.SE     2                        Valid
lha@SU.SE        1                        Expired
lha/root@SU.SE   0                        Expired
lha@N.L.NXS.SE   Initial default ccache   Expired


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16114 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-10-01 03:39:59 +00:00
Love Hörnquist Åstrand
ded223d98f (check_for_tgt): Re-order code so it only free the credential if one
was returned.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15947 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-08-22 20:18:06 +00:00
Love Hörnquist Åstrand
4c6f3aeaf3 If there are no addresses, print addressless instead of nothing.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15603 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-09 03:27:19 +00:00
Love Hörnquist Åstrand
ac8c82785c s/optind/optidx/
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15541 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-01 07:14:58 +00:00
Love Hörnquist Åstrand
d6b87a47d9 use strlcpy
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14932 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-04-24 19:54:58 +00:00
Johan Danielsson
0326089c9f use rtbl_set_separator
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14288 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-10-04 15:10:20 +00:00
Love Hörnquist Åstrand
f7a51721c2 (print_cred_verbose): keytypes are no longer, use enctype
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14064 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-23 18:31:23 +00:00
Johan Danielsson
26457b7135 replace krb5_free_creds_contents by krb5_free_cred_contents
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13790 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-04-25 19:25:35 +00:00
Johan Danielsson
0cad850aac (print_tickets): bail out if krb5_cc_next_cred returns error other
than KRB5_CC_END


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12990 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-10-12 15:57:42 +00:00
Love Hörnquist Åstrand
cdeab003ac (check_for_tgt): set client as part of the pattern/match cred
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12959 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-10-03 12:18:44 +00:00
Love Hörnquist Åstrand
1b0fb56912 (check_for_tgt): use krb5_cc_clear_mcred
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12426 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-07-06 23:35:43 +00:00