Commit Graph

29901 Commits

Author SHA1 Message Date
Luke Howard
b0f0ed74e8 kdc: use attribute dictionary in altsec authorizer plugin 2022-01-04 12:27:43 +11:00
Luke Howard
a8ff420b16 kdc: add attribute dictionary to kdc_request_t
Add a heim_dict_t to the KDC request structure for use by pre-authentication
mechanisms and plugins.
2022-01-04 12:27:43 +11:00
Luke Howard
b27026996a base: s/addkv_{bool,number,object}/setkv
Now heim_audit_addkv() correctly supports multiple values, the other functions
that (by design) replace existing values with a single value should use the
heim_audit_setkv prefix.

A subsequent commit could add variants that support multiple values for
non-string types.
2022-01-04 09:07:10 +11:00
Luke Howard
c8656863ba base: factor out addkv() array promotion logic 2022-01-04 09:07:10 +11:00
Luke Howard
ceef0a0089 Windows 10 SDK build fixes
Build without Win32.mak, and using Universal C Runtime (UCRT)

windows: Check for APPVER, not VCVER for UCRT

When deciding whether UCRT is used (and thus no CRT merge modules), check for
Windows 10 rather than the version of Visual Studio, as we may be building with
an older SDK.
2022-01-03 09:25:18 -05:00
Jeffrey Altman
95021a3284 roken: ndbm_wrap support for db6
use the db6/db.h header if present on the system.
2022-01-03 18:09:08 +11:00
Jeffrey Altman
7cae05061a cf: check libdb-6 for db_create
787d9ceec9 ("check for db6/db.h")
added a check for the db6 header defining HAVE_DB6_DB_H but failed
to add a check for existence of db_create() in the libdb-6 library.
2022-01-03 18:09:08 +11:00
Jeffrey Altman
0fbd163640 cf: db.m4 remove db_create check in non-existent libdb5
The correct library name is libdb-5.
2022-01-03 18:09:08 +11:00
Luke Howard
77f33c1fde base: preserve multiple values in heim_audit_vaddkv()
Previously, if heim_audit_vaddkv() was called multiple times, values would be
concatenated; since changing the request kv type to a dictionary, only the most
recently set value was preserved.

Fix this by promoting multi-valued values to an array of values, which is
visualized in the same manner as it was prior to b1dcc1a4.
2022-01-03 16:35:36 +11:00
Luke Howard
2a2a83b712 base: fix string description of array-object type 2022-01-03 16:24:11 +11:00
Luke Howard
44a8cf1747 base: avoid unnecessary allocation of "reason" key
"reason" key is unused, don't allocate it
2022-01-03 16:19:49 +11:00
Luke Howard
097a3de44e kdc: don't cast away const in krb5plugin_kdc_ftable 2022-01-03 16:17:01 +11:00
Luke Howard
fcff5933ad kdc: rename windc to kdc plugin
Rename the "windc" plugin API to the more general "kdc" plugin API, for two
reasons: the Heimdal KDC uses the Windows PAC even when not emulating a domain
controller, and the plugin API has accreted methods that are not specific to
emulating a domain controller (such as referral_policy and finalize_reply).
2022-01-03 16:17:01 +11:00
Luke Howard
a4c6b81ce9 kdc: add audit plugin API to windc API
Allow the windc plugin to also implement an audit callback. As part of this
change, both the HDB and windc audit function signatures are changed to return
void.
2022-01-03 16:17:01 +11:00
Luke Howard
98070b5eaa Revert "heimdal: handle referrals for 3 part DRSUAPI SPNs"
Active Directory/Samba-specific referral policy should be implemented by a
windc plugin, not in the main KDC code. It looks like it probably isn't
necessary at all if Samba wishes to bypass Heimdal's referral handling.

This reverts commit 6f0cafa6cf.
2022-01-03 16:17:01 +11:00
Luke Howard
3fa47f5a1a kdc: add referral_policy callback to windc plugin
Add a referral policy hook to the TGS as a more elegant way of resolving
referral detection for Samba). The hook can either rewrite the server_princ in
the request, or it can return an error to disable built-in referral processing.
2022-01-03 16:17:01 +11:00
Luke Howard
5cce73a6ef gss: expose canonical name from PAC if present
Expose canonical name via the canonical-name naming attribute.
2022-01-03 15:59:16 +11:00
Luke Howard
2a826d769f gss: expose PAC info buffers under urn:mspac:
Expose PAC info buffers using naming attributes prefixed with urn:mspac:,
aligned with MIT.
2022-01-03 15:59:16 +11:00
Nicolas Williams
66e256e672 krb5: Can't test KCM in test_cc 2022-01-02 22:16:06 -06:00
Nicolas Williams
73bb84c0f3 bx509d: Fix tests (log message diffs) 2022-01-02 21:37:43 -06:00
Nicolas Williams
7e311ea9bf gss: Fix test_names clang-13 build 2022-01-02 21:19:13 -06:00
Nicolas Williams
3f2b1007a3 base: Fix test_base clang-13 build 2022-01-02 21:16:36 -06:00
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