Commit Graph

29515 Commits

Author SHA1 Message Date
Nicolas Williams
855b27ccfb httpkadmind: Allow host SPNs to fetch selves
Combined with the synthetic_clients feature, this will allow hosts that
have a PKINIT-worthy client certificate with a SAN with their host
principals to create their own principals and "extract" their host
keytabs.  Together with some other PKIX credential bootstrapping
protocol, this can help hosts bootstrap Kerberos host credentials.
2021-06-29 14:52:07 -05:00
Nicolas Williams
00358252d3 kdc: Add synthetic PKINIT principals option 2021-06-29 14:52:07 -05:00
Andrew Bartlett
4a5fc6bcde Move out: label to inside #endif of HAVE_DLOPEN
Samba compiles Heimdal internally without HAVE_DLOPEN to keep
to internally supplied mechanisms and plugins.

Samba compiles with strict warning flags and on Ubuntu 20.04
with gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) we see:

../../source4/heimdal/lib/gssapi/mech/gss_mech_switch.c: In function ‘_gss_load_mech’:
../../source4/heimdal/lib/gssapi/mech/gss_mech_switch.c:462:1: error: label ‘out’ defined but not used [-Werror=unused-label]
  462 | out:
      | ^~~
cc1: all warnings being treated as errors

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2021-06-25 09:44:53 +10:00
Andrew Bartlett
040a093654 Provide the correct principal name to verify_flags() for user2user tickets
When b->kdc_options.enc_tkt_in_skey is set, the variable 'spn'
provided to verify_flags() for the purpose of logging is not
yet set, it is still NULL from the initialiser.

On Samba we see, when compiling with -O3 and strict warning rules with
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04):

$ make -k
PYTHONHASHSEED=1 WAF_MAKE=1  ./buildtools/bin/waf build
Waf: Entering directory `/home/abartlet/heimdal-import/samba/bin/default'
	Selected embedded Heimdal build
[2822/4527] Compiling source4/heimdal/kdc/krb5tgs.c
In function ‘verify_flags’,
    inlined from ‘verify_flags’ at ../../source4/heimdal/kdc/krb5tgs.c:625:1,
    inlined from ‘tgs_build_reply.isra.0’ at ../../source4/heimdal/kdc/krb5tgs.c:1671:8:
../../source4/heimdal/kdc/krb5tgs.c:635:2: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  635 |  kdc_log(context, config, 4, "Ticket not valid (%s)", pstr);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘verify_flags’,
    inlined from ‘tgs_build_reply.isra.0’ at ../../source4/heimdal/kdc/krb5tgs.c:1671:8:
../../source4/heimdal/kdc/krb5tgs.c:631:2: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  631 |  kdc_log(context, config, 4, "Ticket expired (%s)", pstr);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Essentially, with an optimising compiler, the funciton is inlined
and the compiler notices that the kdc_log() argument is always NULL.

Based on patches by Stefan Metzmacher <metze@samba.org>
in his master-heimdal branch at:
https://git.samba.org/?p=metze/samba/wip.git;a=commitdiff;h=2ac326b9cb8f896f874edfa6725f087034270322#patch2
https://git.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master-heimdal

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2021-06-23 11:56:04 +10:00
Nicolas Williams
8ac3452fd7 kadmin: Add missing attributes; sort units
Sorting the units fixes a bug introduced in:

    ae8908bf8 kadmin: Add disallow-client attribute

that I had fixed via:

    f6ac4ee86 roken: Fix parse flags bug

which wasn't a bug at all.
2021-06-22 14:47:38 -05:00
Nicolas Williams
ae8908bf81 kadmin: Add disallow-client attribute
This is useful for services that need not be clients.  For example, an
untrusted service that need only accept authentication from clients,
but not initiate authentication to other services.
2021-06-22 13:01:24 -05:00
Nicolas Williams
f6ac4ee864 roken: Fix parse flags bug 2021-06-22 13:01:24 -05:00
Nicolas Williams
1870584d22 kdc: Fix _kdc_audit_addaddrs() buglet 2021-06-21 23:38:16 -05:00
Luke Howard
0452d8c601 krb5: check return value in krb5_get[_cache]_next()
krb5_get_next() and krb5_get_cache_next() do not check for krb5_kcm_call()
returning non-zero before accessing the repsonse data; they only handle the
case where the return value is KRB5_CC_END.

Return immediately if the return value of krb5_kcm_call() is not KRB5_CC_END or
0. This was fixed in the Apple code.
2021-06-16 12:09:19 +10:00
Nicolas Williams
be3a640b69 kinit: Fix --anonymous renewal bug
`kinit --anonymous ... some long running command here` will eventually
fail to renew the anon TGT.
2021-05-21 11:00:58 -05:00
Luke Howard
718e3f8b68 hx509: correct ASN.1 OID typo for SHA-384
A copy and paste error initialized the SHA-384 structure in libhx509
with the OID for SHA-512.

Fixes: 776
2021-05-19 14:41:03 +10:00
Luke Howard
497a561b4d gss: avoid string concatenation warning in error message init
Some compilers with -Wstring-concatenation enabled warned about a suspicious
concatenation of string literals in the initialization of the GSS-API error
message array.

At the expense of a long line, avoid this warning but explicitly concatenating
the offending string literal.

Fixes: #775
2021-05-17 10:09:01 +10:00
Luke Howard
f67dd0f903 roken: move Heimdal vis.h extensions to separate header
vis.h is not built on platforms (such as macOS) that already have
that header, which resulted in prototypes for Heimdal-specific
vis.h extensions being absent.

Move those prototypes to a separate header, vis-extras.h, which
must be explicitly included in order to use the Heimdal extensions.
2021-05-17 10:05:58 +10:00
Nicolas Williams
cc5bd3a6c0 kdc: Improve warn_ticket_addresses feature (fix bug) 2021-05-14 17:02:08 -05:00
Nicolas Williams
9ce3cbbf2a kdc: Improve warn_ticket_addresses feature
- Don't log "Request from wrong address (ignoring)".
 - Add "wrongaddr=yes" kv to final log message.
 - Add request and ticket addresses (up to 3) to final log message.
2021-05-12 17:56:26 -05:00
Nicolas Williams
8807a0aad9 bx509d: Use /get-tgt lifetime q-param 2021-05-06 23:13:31 -05:00
Nicolas Williams
5aaf12351a iprop: More default HDB type fixes 2021-05-04 14:53:40 -05:00
Nicolas Williams
0c1cd18e03 iprop: Fix default dbname choice on initial prop
If a DB does not already exist, ipropd-slave will use the compiled
default, which is not necessarily what is desired or configured in
`[kdc]`.

This change makes `hdb_default_db()` return the first dbanme in the
`[kdc]` configuration, falling back on `HDB_DEFAULT_DB`.

Also, this adds a `--database` option to `ipropd-slave`.
2021-05-03 15:02:43 -05:00
Nicolas Williams
e609e61f21 bx509d: Set Content-Type and Cache-Control 2021-04-30 16:02:18 -05:00
Nicolas Williams
b1b993b231 httpkadmind: Use no-store rather than no-cache 2021-04-30 15:46:20 -05:00
Nicolas Williams
034413892e roken: Fix Makefile race 2021-04-26 14:40:00 -05:00
Nicolas Williams
1e65ebd5eb asn1: Fix Windows build 2021-04-25 10:45:43 -05:00
Nicolas Williams
ec171ef0b6 asn1: Add missing file gen_print.c 2021-04-25 10:45:43 -05:00
Nicolas Williams
e80ac3ae22 kdc: Install bx509d and httpkadmind man pages 2021-04-23 22:15:51 -05:00
Nicolas Williams
5c93af553b asn1: Build both backends
The codegen backend is faster than the template backend, even for
modules that don't use IOS.  On x64 we see the template backend being
4% slower for TGS requests using the kdc-tester program.

So let's build both, libasn1 (codegen) and libasn1template when
configured with --disable-asn1-templating, but make sure that the
asn1_print utility is linked with libasn1template.

Eventually we'll want to either optimize the template backend better,
or add IOS and JSON printing support to the codegen backend.
2021-04-23 22:15:51 -05:00
Nicolas Williams
32b314b174 asn1: Generate print stubs (codegen) 2021-04-23 22:15:51 -05:00
Nicolas Williams
e3359f6bf5 roken: Install useful rk utils 2021-04-23 22:15:51 -05:00
Nicolas Williams
83fe958211 hx509/bx509: Long-lived certs weren't being issued 2021-04-23 14:49:03 -05:00
Nicolas Williams
a4adb8354f bx509: Complete /get-tgt?cname= support 2021-04-22 17:02:18 -05:00
Nicolas Williams
76d6ee4abc bx509: Don't clobber error in get_tgt() 2021-04-22 17:02:16 -05:00
Nicolas Williams
407f12cc0b asn1: Fix --disable-asn1-templating build 2021-04-21 22:40:41 -05:00
Nicolas Williams
6d7c44989b github: Use GitHub Actions 2021-04-20 12:01:54 -05:00
Nicolas Williams
f60300984e bx509d: /get-tgt add EKU to authorization check 2021-04-16 14:13:05 -05:00
Nicolas Williams
eb2d1029c2 kdc: Test warn_ticket_addresses and /get-tgt w/ addresses 2021-04-14 19:28:09 -05:00
Nicolas Williams
6ff3dbf297 bx509: Add addresses q-param for /get-tgt 2021-04-14 19:28:08 -05:00
Nicolas Williams
16d6bda3aa krb5: Add _krb5_parse_address_no_lookup() 2021-04-14 19:27:21 -05:00
Nicolas Williams
2d1fee6d11 kdc: Set r->addr
Fixes a NULL-dereference.
2021-04-14 19:27:21 -05:00
Nicolas Williams
966f18f57e kdc: Add warn_ticket_addresses config option (fix missing) 2021-04-14 19:27:21 -05:00
Nicolas Williams
a5e289f4f7 kdc: Add warn_ticket_addresses config option 2021-04-13 23:22:45 -05:00
Nicolas Williams
6633f6e525 bx509d: Implement /get-tgt end-point 2021-04-06 17:19:48 -05:00
Nicolas Williams
d72c4af635 bx509: Rename end-points; doc Negotiate more
Leaving old end-point names around.
2021-04-06 17:19:48 -05:00
Nicolas Williams
9dcab76724 asn1: Fix build concurrency bug 2021-04-01 01:08:00 -05:00
Nicolas Williams
9ff74bcd21 asn1: Fix check/print type confusion 2021-04-01 01:08:00 -05:00
Nicolas Williams
e7a8457fd2 asn1: Fix extra.c printer functions 2021-04-01 01:08:00 -05:00
Nicolas Williams
e2e0dc331e kcm: Actually implement --socket-path option 2021-03-31 22:59:38 -05:00
Nicolas Williams
9d9fd7f2fa kcm: Check service registration errors 2021-03-31 22:59:38 -05:00
Nicolas Williams
6216117da0 iprop: Optional async slave HDB writes
New command-line option for ipropd-slave to disable sync HDB writes
also when replaying the log.
2021-03-31 22:59:38 -05:00
Nicolas Williams
c2bf9b9e71 kx509: Improve start_realm logic 2021-03-31 22:59:38 -05:00
Nicolas Williams
6b8487f44b kinit: Fix kinit -R crash 2021-03-31 22:59:38 -05:00
Nicolas Williams
afa1624682 kinit: Make --default-for behavior optional
Scripts that run kinit -k will break otherwise.
2021-03-31 22:59:38 -05:00