Commit Graph

29879 Commits

Author SHA1 Message Date
Nicolas Williams
8be05797cc httpkadmind: Use enum MHD_Result return type 2022-01-02 21:11:48 -06:00
Nicolas Williams
e328c0e496 bx509d: Use enum MHD_Result return type 2022-01-02 21:11:40 -06:00
Nicolas Williams
53e63d9ec9 kdc: Fix bx509d/httpkadmind (b1dcc1a47) 2022-01-02 21:11:07 -06:00
Nicolas Williams
bc7c73b5d7 hcrypto: Fix build with clang-13 2022-01-02 20:58:39 -06:00
Nicolas Williams
a849015350 roken: Fix mergesort_r() clang-13 build 2022-01-02 20:53:09 -06:00
Luke Howard
957633b793 kdc: remove unused rx.h header
We no longer support Kerberos 4, remove rx.h.
2022-01-03 13:12:03 +11:00
Luke Howard
24c606719e kdc: fix _kdc_audit_addkv_bool wrapper copy paste
_kdc_audit_addkv_bool() should call heim_audit_addkv_bool() not
heim_audit_addkv_number(). Copy/paste error.
2022-01-03 09:36:50 +11:00
Luke Howard
52b9531cb5 kdc: note that GSS PA uses synthetic principals 2022-01-02 23:15:55 +11:00
Luke Howard
41ec5733ef kdc: document windc plugin entry points 2022-01-02 23:00:43 +11:00
Nicolas Williams
d833ce4cbc hdb: Namespace referrals
Add a new method for issuing referrals for entire namespaces of hostnames.

An alias of the form WELLKNOWN/HOSTBASED-NAMESPACE/service/namespace-fqdn@REALM
will cause all requests for host-based principals in the given namespace to be
referred to the given realm.
2022-01-02 21:40:17 +11:00
Nicolas Williams
be708ca3cf gsskrb5: Add simple name attributes support
This adds Kerberos mechanism support for:

 - composite principal name export/import
 - getting rudimentary name attributes from GSS names using
   gss_get_name_attribute():
    - all (raw) authorization data from the Ticket
    - all (raw) authorization data from the Authenticator
    - transit path
    - realm
    - component count
    - each component
 - gss_inquire_name()
 - gss_display_name_ext() (just for the hostbased service name type
                           though)

The test exercises almost all of the functionality, except for:

 - getting the PAC
 - getting authz-data from the Authenticator
 - getting the transit path

TBD (much) later:

 - amend test_context to do minimal name attribute checks as well
 - gss_set_name_attribute() (to request authz-data)
 - gss_delete_name_attribute()
 - getting specific authorization data elements via URN fragments (as
   opposed to all of them)
 - parsing the PAC, extracting SIDs (each one as a separate value)
 - some configurable local policy (?)
 - plugin interface for additional local policy
2022-01-01 23:30:15 -06:00
Nicolas Williams
1cede09a0b krb5: Add support for AD-KDC-ISSUED 2022-01-01 23:30:15 -06:00
Nicolas Williams
87f8c0d2b5 krb5: Add name attributes to krb5_principal
We now have what we need in krb5_principal to implement much of RFC6680.
Now we populate those fields so that they can be accessed by GSS-API
RFC6680 name attributes functions.

The next commit should add much of the GSS-API RFC6680 name attributes
functions and functionality.
2022-01-01 23:30:15 -06:00
Luke Howard
f3484d5e2e gss: pass GSS_C_NO_OID name type through to mechanism
Allow the mechanism, rather than the mechanism glue, to determine the default
name type if GSS_C_NO_OID was passed in when importing a name.
2022-01-02 16:28:20 +11:00
Luke Howard
d683780b1d kdc: separate PKINIT/GSS authorization failure
Create a new audit event for PKINIT/GSS authorization (impersonation) failure
2022-01-02 15:25:52 +11:00
Luke Howard
a9c6bc2bf2 kdc: audit "yes" boolean values as booleans
Audit boolean values that were logged as "yes" as boolean values; this will
change audit log values to "true" instead, so this patch may be omitted.
2022-01-02 15:25:52 +11:00
Luke Howard
e15e711b13 kdc: remove auth_event_details audit key
The auth event details audit key (formerly, parameter to auth_status)
contained, variously, an encryption type name; a PKINIT client certificate
name; or, a GSS initiator name. Audit these instead using individual keys that
reflect the values' contents.
2022-01-02 15:25:52 +11:00
Luke Howard
93c8d57091 kdc: call HDB audit function in both AS and TGS
Call the HDB audit method, if present, in both AS and TGS, immediately prior to
generating an error response to send to the clinet.
2022-01-02 15:25:52 +11:00
Luke Howard
1e1c5dbbfc kdc: make error code available to audit function
Set r->ret in the request before calling the HDB audit method.
2022-01-02 15:25:52 +11:00
Luke Howard
cc0874d410 kdc: preserve value types in auditing
Preserve integer/boolean audit values as their native types; convert to strings
when logging only. This commit goes some way towards unifying the two auditing
APIs.
2022-01-02 15:25:52 +11:00
Luke Howard
b1dcc1a474 kdc: refactor Samba-specific auditing API in terms of existing API
Make Samba-specific HDB auth status API a wrapper on the existing auditing API,
with a view towards unifying the two APIs in a future commit.

The term "auth status" is replaced with "auth event", and the HDB auth_status
method is replaced with a more general purpose audit method which has access to
the entire request structure.
2022-01-02 15:25:52 +11:00
Luke Howard
32032dec7e base: heimbase-svc.h needs to include heimbase.h
heimbase-svc.h depends on heim_context from heimbase.h. Not all consumers also
remember to import heimbase.h (now that it is included by hdb.h).
2022-01-02 15:25:52 +11:00
Luke Howard
d165e73fff bx509d: don't audit NULL message string
formatted can be NULL, it appeares the intention was to log msg instead
2022-01-02 15:25:52 +11:00
Luke Howard
52b1dffa63 kdc: return KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (PA)
Return KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN, not HDB_ERR_NOENTRY, if a client
principal could not be found during pre-authentication.

This fixes a regression introduced with synthetic principals in 00358252d3.
2022-01-01 08:41:13 -05:00
Luke Howard
0492729ba7 kdc: remove unused v4 hprop code 2021-12-30 20:42:18 +11:00
Nicolas Williams
09f3f96467 gsskrb5: Use optimistic anon PKINIT armored FAST 2021-12-30 18:54:54 +11:00
Nicolas Williams
554f375626 kinit: Use optimistic anon PKINIT armored FAST
Now that we can optimistically try FAST w/ anon PINIT armor, we should
do so in kinit whenever it makes sense.
2021-12-30 18:54:54 +11:00
Nicolas Williams
944e12e103 krb5: Add GIC optimistic FAST w/ anon 2021-12-30 18:54:54 +11:00
Nicolas Williams
ca71e365ec asn1: Move decoration to krb5.opt file 2021-12-30 18:54:54 +11:00
Luke Howard
486a1ea773 kdc: remove unnecessary cast in finalize() (windc.c) 2021-12-29 21:15:08 +11:00
Nicolas Williams
fb3ea5b943 kdc: Add ret to common svc req elements
We're logging SUCCESS even when the KDC sends error replies.  That's
because we're returning success to process_request() even when we send
errors to clients.  The error we want to send to the client, and that we
succeed or fail to send it, are different statuses.

Also, further move things into `r` and out of function arguments.
2021-12-27 10:16:58 +11:00
Nicolas Williams
5e3c0a7ce0 base: Add ret to common svc req elements
We're logging SUCCESS even when the KDC sends error replies.  That's
because we're returning success to process_request() even when we send
errors to clients.  The error we want to send to the client, and that we
succeed or fail to send it, are different statuses.

To fix this we'll add a `ret` field to the common service request state
structure, HEIM_SVC_REQUEST_DESC_COMMON_ELEMENTS /
heim_svc_req_desc_common_s.
2021-12-27 10:16:58 +11:00
Luke Howard
81077eea7b tests: use cname/sname string name instead of unparsing 2021-12-26 18:40:19 +11:00
Nicolas Williams
833483137b kdc: Log more about KRB-ERROR failures 2021-12-23 21:06:38 -06:00
Nicolas Williams
eeba89a1af kdc: Stop confusing the compiler 2021-12-23 21:06:38 -06:00
Nicolas Williams
6baac3126f asn1: Fix template decoration copy 2021-12-23 19:11:49 -06:00
Luke Howard
f74e9223b6 tests: add some logging to windc test plugin
Log some parameters from the astgs_request_t.
2021-12-23 17:49:36 -06:00
Luke Howard
f49e99e15f kdc: remove e_text argument to _kdc_encode_reply()
e_text is part of astgs_request_t, so it doesn't need to be an explicit
argument to _kdc_encode_reply()
2021-12-23 17:49:36 -06:00
Luke Howard
b6be850e0d kdc: remove outpadata from astgs_request_t
Remove the outpadata field from astgs_request_t, because it's not something we
wish to expose publically (yet it is something that Samba needs in the
client_access plugin API, to add Windows error information).

Instead, allocate rep->padata at the start of AS/TGS request handling, and
ensure it is valid for the lifetime of the request until it is encoded (at
which point it will be freed and set to NULL if zero length, to avoid sending a
zero length METHOD-DATA to the client).

(The previous approach of setting rep->padata to point to &r->outpadata was
fragile, because it required clearing the pointer before freeing the KDC-REP.)
2021-12-23 17:49:36 -06:00
Luke Howard
64dad876a4 kdc: simplify client_access windc plugin API
Make client_access plugin API take a single argument, astgs_request_t. Note: in
order to avoid making r->outpadata public (it's an internal buffer), but allow
Samba to modify the reply pa data, some pointer magic is required.
2021-12-23 17:49:36 -06:00
Luke Howard
36fe09f433 kdc: remove unused padata field from astgs_request_t 2021-12-23 17:49:36 -06:00
Luke Howard
e81bcb71f3 kdc: add finalize_reply API to windc plugin
Allow a windc plugin to finalize the KDC reply (including the encrypted ticket
and reply parts) before encoding for transmission.
2021-12-23 17:49:36 -06:00
Luke Howard
6b312659cb kdc: use PAC from request in _kdc_gss_finalize_pac()
Pass astgs_request_t to _kdc_gss_finalize_pac() in order to harmonize with
other functions.
2021-12-23 17:49:36 -06:00
Luke Howard
d3549c4ab7 kdc: remove superflous request arg to _kdc_check_access()
KDC_REQ is accessible as r->req
2021-12-23 17:49:36 -06:00
Luke Howard
805ea5e0a0 kdc: use rep/et/ek fields in astgs_request_t
Use rep/et/ek fields in astgs_request_t that were previously present but not
globally used.
2021-12-23 17:49:36 -06:00
Luke Howard
e3a5169862 kdc: make common astgs_request_t elements public API 2021-12-23 17:49:36 -06:00
Luke Howard
2e8b172f38 kdc: move PAC into astgs_request_t structure 2021-12-23 17:49:36 -06:00
Luke Howard
d95be72681 kdc: separate astgs_request_t common elements
Separate out some astgs_request_t common elements with the intention of making
them public API.
2021-12-23 17:49:36 -06:00
Luke Howard
5b7cf5d56f kdc: centralize include PAC logic
Add a helper function that returns TRUE if a PAC should be included in ticket
authorization data, that can be called from both AS and TGS paths.

Per [MS-KILE] 3.3.5.3, PACs are always included for TGTs; for service
tickets, policy is governed by whether the client explicitly requested
a PAC be omitted when requesting a TGT, or if the no-auth-data-reqd
flag is set on the service principal entry.
2021-12-23 13:52:15 +11:00
Luke Howard
0165633964 hdb: add no-auth-data-reqd flag to HDB entry
Add a new flag, no-auth-data-reqd, to the HDB entry which indicates that a PAC
should not be included on issued service tickets.
2021-12-23 13:52:12 +11:00