Commit Graph

2086 Commits

Author SHA1 Message Date
Nicolas Williams
cb5262014a Revert "kdc: Quiet warning in FAST unwrap"
This reverts commit a9c0b8f264.

From Joseph Sutton:

> I found that this commit would result in `KRB5KRB_AP_ERR_BAD_INTEGRITY`
> errors in Samba whenever explicit FAST armor was present. Reverting the
> commit made FAST work again.

> It should be safe to use `tgs_ac` here, since it will always be non-NULL if
> `r->explicit_armor_present` is true. Maybe a local variable
> `explicit_armor_present` (which would be assigned to
> `r->explicit_armor_present` before the function returns successfully) would
> help a static analyser to deduce that its value doesn't change within the
> function, and that `tgs_ac != NULL` still holds.

a9c0b8f264 (commitcomment-95581208)
2023-01-09 22:30:10 -06:00
Nicolas Williams
561c60ca29 kdc: Explicitly ignore return in audit code 2023-01-04 16:25:22 -06:00
Nicolas Williams
a13c3fc32c httpkadmind: If early ENOMEM, close the connection 2023-01-04 16:24:55 -06:00
Nicolas Williams
e27ddc6596 bx509d: If early ENOMEM, close the connection 2023-01-04 16:24:32 -06:00
Nicolas Williams
23c13886c4 bx509: Fix error path NULL dereference 2023-01-04 16:23:56 -06:00
Nicolas Williams
2d5880734b httpkadmind: Quiet warning 2023-01-04 02:23:01 -06:00
Nicolas Williams
cb09267ed9 kdc: Fix deref-before-NULL-check in _kdc_db_fetch() 2023-01-04 02:07:25 -06:00
Nicolas Williams
82475cbf8e httpkadmind: Fix ENOMEM leak 2023-01-04 01:36:02 -06:00
Nicolas Williams
cd4e693865 httpkadmind: Quiet set-but-not-use variable warning 2023-01-04 01:36:02 -06:00
Nicolas Williams
1a0e535871 hpropd: Fix use-after-free? (WIP) 2023-01-04 01:36:02 -06:00
Nicolas Williams
12160382a0 bx509d: Fix leaks 2023-01-04 01:36:02 -06:00
Nicolas Williams
c6074377bc bx509d: Fix free() of text string
Also fix a leak, and quiet some warnings.
2023-01-04 01:36:02 -06:00
Nicolas Williams
e3bcc21dcb test_token_validator: Quiet set-but-not-use variable warning 2023-01-04 01:36:02 -06:00
Nicolas Williams
90856e35cc test_csr_authorizer: Fix use-after-free 2023-01-04 01:36:02 -06:00
Nicolas Williams
6cf01fea19 kdc: Quiet warnings re: debug logging 2023-01-04 01:36:02 -06:00
Nicolas Williams
d33e26de1a kdc: Quiet set-but-not-use variable warning in HDB dump code 2023-01-04 01:36:02 -06:00
Nicolas Williams
20b2dda743 kdc: Quiet a static analyzer warning 2023-01-04 01:36:02 -06:00
Nicolas Williams
3ff12a7fcd kdc: Fix ENOMEM double-free in IPC CSR authorizer 2023-01-04 01:36:01 -06:00
Nicolas Williams
ea39bc5a6b kdc: Fix #1059 2023-01-04 01:36:01 -06:00
Nicolas Williams
be0d4036a9 kdc: Quiet set-but-not-use variable warning 2023-01-04 01:36:01 -06:00
Nicolas Williams
6964949c21 kdc: Quiet set-but-not-use variable warning in kdc-tester 2023-01-04 01:36:01 -06:00
Nicolas Williams
a9c0b8f264 kdc: Quiet warning in FAST unwrap
I believe tgs_ac is not NULL at that location, but ac definitely isn't.
2023-01-04 00:43:49 -06:00
Nicolas Williams
fd6597614e bx509d: Add test of IPC CSR authorizer
We have a CSR authorizer plugin for calling to an IPC service.

In this commit we add test implementation of such a service.

We also remove the simple_csr_authorizer plugin and fold its
functionality into the new test_csr_authorizer functionality.
2022-12-15 17:44:41 -06:00
Nicolas Williams
f47f15d5b9 bx509d: /get-tgts: Allow piecemeal authorization
We use the CSR authorizer system for /get-tgt and /get-tgts because,
well, the CSR authorizer system knows how to deal with principal names
("PKINIT SANs").

The caller of the /get-tgts end-point is a batch API that is meant for
super-user clients that implement orchestration for automation.  For
this end-point it's important to be able to return TGTs for just the
requested principals that are authorized rather than fail the whole
request because one principal isn't.  A principal might be rejected by
the authorizer if, for example, it's not meant to exist, and that might
be desirable because "synthetic" HDB entries might be configured, and we
might not want principals that don't exist to appear to exist for such
an orchestration service.

The hx509 CSR related functions allow one to mark specific requested
EKUs and SANs as authorized or not.  Until now we have simply rejected
all requests that don't have all attributes approved, but for /get-tgts
we need partial request approval.  This commit implements partial
request approval for the /get-tgts end-point.
2022-12-15 17:44:41 -06:00
Nicolas Williams
ba93778682 bx509d: Set log destination 2022-12-15 17:44:41 -06:00
Nicolas Williams
cf020532c2 bx509d: Fix leak of error messages 2022-12-15 17:44:41 -06:00
Nicolas Williams
cd02c50be5 kdc: OpenSSL 3.0 support 2022-11-22 11:34:54 -05:00
Joseph Sutton
cfb32a638e Introduce macro for common plugin structure elements
Heimdal's HDB plugin interface, and hence Samba's KDC that depends upon
it, doesn't work on 32-bit builds due to structure fields being arranged
in the wrong order. This problem presents itself in the form of
segmentation faults on 32-bit systems, but goes unnoticed on 64-bit
builds thanks to extra structure padding absorbing the errant fields.

This commit reorders the HDB plugin structure fields to prevent crashes
and introduces a common macro to ensure every plugin presents a
consistent interface.

Samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=15110

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-11-17 17:15:21 -06:00
Stefan Metzmacher
422419ddde kdc: add missing enctype = p[i] assignments to _kdc_find_etype()
This is needed when a service provides support for newer entry.etypes
without having a key for that encryption type yet.

It is triggered with svc_use_strongest_session_key=TRUE.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-11-17 08:50:28 -05:00
Joseph Sutton
05e589d247 kdc: Check generate_pac() return code
If the function fails, we should not issue a ticket missing the PAC.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-11-17 07:52:06 -05:00
Volker Lendecke
f4faaeaba3 heimdal: Fix the 32-bit build on FreeBSD
Format string fixes that fail in the Samba build on a 32-bit machine

Signed-off-by: Volker Lendecke <vl@samba.org>
2022-11-16 23:46:46 -05:00
Nicolas Williams
56c6120522 httpkadmind: Make more like bx509d internally
- Correct handling of POST (before POSTs with non-zero-length bodies
   would cause the server to close the connection).

 - Add CSRF features from bx509d.
2022-10-02 22:46:37 -05:00
Nicolas Williams
ae527bf97c bx509d: Add /get-tgts batch end-point
In order to support batch jobs systems that run many users' jobs and
which jobs need credentials, we add a /get-tgts end-point that is a
batched version of the /get-tgt end-point.  This end-point returns JSON.

Also, we make GETs optional, default to not-allowed in preference of
POSTs.

We also correct handling of POST (before POSTs with non-zero-length bodies
would cause the server to close the connection), and add additional CSRF
protection features, including the ability to disable all GET requests
for /get-keys and /get-config.
2022-10-02 22:46:37 -05:00
Stefan Metzmacher
c4216b17a8 kdc: add enable_fast option (enabled by default)
This makes it possible to disable fast if needed,
which is very good for regression tests.
Samba disables this in a few test environments with this
option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15002
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15005

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-09-25 21:13:01 +10:00
Nicolas Williams
4c71d1bf06 bx509: Fix typos in commentary 2022-08-07 18:59:28 -05:00
Joseph Sutton
b19633f9b9 Use constant-time memcmp when comparing sensitive buffers
This helps to avoid timing attacks.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-04-30 13:35:52 -04:00
Nicolas Williams
d93f0d103d httpkadmind: Clarify namespace in man page 2022-04-26 17:54:12 -05:00
Nicolas Williams
a5271cd765 httpkadmind: Enable materialization 2022-04-25 22:24:52 -05:00
Nicolas Williams
18f44e7e90 httpkadmind: Make get_keys_max_spns configurable 2022-04-25 22:24:51 -05:00
Nicolas Williams
a5273d18cd httpkadmind: Support ok-as-delegate and such
Add support for configuring the attributes of new principals created via
httpkadmind.  This can be done via virtual host-based service
namespaces, which will provide default attributes even if disabled (but
the created principals will not be disabled, naturally), or via
krb5.conf.
2022-04-25 22:24:51 -05:00
Nicolas Williams
dcef1341d3 kdc: Add error symbols for error logging
Having "KRB5KRB_AP_ERR_ILL_CR_TKT" in log messages is much better than
"UNKNOWN--1765328341".
2022-03-16 15:04:10 -05:00
Joseph Sutton
d5ad04a7f3 kdc: Add function to add encrypted padata
Since plugins no longer have a way of accessing the 'ek' member of the
request structure, this function provides a way for a plugin to add
encrypted padata to the response.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-03-08 18:58:17 +11:00
Luke Howard
df655cecd1 kdc: allow audit plugins to influence return code
Honor the return code of _kdc_audit_request(), propagating if non-zero. Note
that this is principally intended to allow the audit plugin to return
HDB_ERR_NOT_FOUND_HERE, which influences whether the KDC sends an error reply
or not. If the audit plugin also wishes to rewrite r->error_code, it must do so
separately.

Closes: #964
2022-03-03 10:10:37 +11:00
Stefan Metzmacher
8495f63bc3 kdc: provide kdc_request_get_explicit_armor_{clientdb,client,pac}()
_kdc_fast_check_armor_pac() already checks the PAC of the armor,
but it should also remember it if it's an TGS-REQ with explicit armor.

This will allow the kdc pac hooks to generate a compound identity PAC
with PAC_TYPE_DEVICE_INFO.

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Closes: #967
2022-03-03 10:10:29 +11:00
Stefan Metzmacher
11d8a053f5 kdc-plugin: also pass astgs_request_t to the pac related functions
This is more consistent and allows the pac hooks to be more flexible.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-03-03 09:58:48 +11:00
Nicolas Williams
419610aa14 kdc: HDB max_life/max_renew == 0 -> unlimited 2022-02-15 20:16:29 -06:00
Nicolas Williams
e7e2c7a145 kdc: Honor "unlimited" max_life/max_renew 2022-02-15 16:56:27 -06:00
Nicolas Williams
2c8a078bcf bx509d: Do not leak temp ccaches 2022-02-14 21:07:47 -06:00
Luke Howard
69973757ce gss: remove gss_get_instance() 2022-01-30 14:20:05 -05:00
Jeffrey Altman
543b94637f more dealloc functions require HEIM_CALLCONV
Change-Id: I68168a387c088b45e2572d5c982d33dfe0aa38a8
2022-01-29 00:15:59 -05:00