979 Commits

Author SHA1 Message Date
Stefan Metzmacher
ba8c3dbc62 lib/gssapi/krb5: implement GSS_C_CHANNEL_BOUND_FLAG for gss_init_sec_context()
This will force KERB_AP_OPTIONS_CBT to be sent.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2024-07-06 16:14:43 -04:00
Nicolas Williams
1b62220778 tests: Use here-doc kadmin in Java test 2024-01-20 16:13:21 -06:00
Nicolas Williams
366016b1f6 tests: Speed up tests/gss/check-gssmask 2024-01-17 16:55:35 -06:00
Nicolas Williams
1aa0a495c2 tests: Use kadmin w/ here-document to speed up tests 2024-01-16 16:28:35 -06:00
Nicolas Williams
016373931d tests: Kill daemons on ^C 2024-01-16 16:28:35 -06:00
Nicolas Williams
7a0915c630 tests: Make check-hdb-mitdb a bit more verbose 2024-01-16 16:28:35 -06:00
Taylor R Campbell
ad23636db8 Add a test for potential DNS leaks via symbol interposition.
We build variants of kinit and test_acquire_cred that define their
own symbols rk_dns_lookup, gethostbyname, gethostbyname2, and
getaddrinfo to print a message and abort.  For getaddrinfo, we abort
only if the caller failed to specify AI_NUMERICHOST; otherwise we use
dlsym(RTLD_NEXT, "getaddrinfo") instead.

The new test tests/gss/check-nodns is like tests/gss/check-basic, but
uses kinit_auditdns and test_acquire_cred_auditdns to verify that no
DNS resolution happens.

This test should work and be effective on ELF platforms where the
getaddrinfo function is implemented by the symbol `getaddrinfo'.  On
non-ELF platforms it may not be effective -- and on platforms where
the getaddrinfo function is implemented by another symbol (like
`__getaddrinfo50') it may not work, but we can cross that bridge when
we come to it.

Verified manually that the test fails, with the expected error
message and abort, without `block_dns = yes' in krb5-nodns.conf.  No
automatic test of the mechanism for now because it might not work on
some platforms.

XXX check-nodns.in is copypasta of check-basic.in, should factor out
the common parts so they don't get out of sync.
2024-01-08 10:22:02 -06:00
Nicolas Williams
f455ea9834 tests: Make make -j8 check work
In the future we should also make it so that `make check` for `tests/db`,
`tests/gss`, and `tests/kdc` first initializes all the realms and starts all
the daemons, then runs the actual checks possibly in parallel, then shuts down
the daemons.  This will require quite a bit of work, so for now we just disable
parallel make in those directories.
2024-01-03 18:48:02 -06:00
Nicolas Williams
d274f0e240 bx509: Test CSRs w/ BasicConstraints in extReq 2023-11-08 14:22:02 -06:00
Nicolas Williams
27cdf81995 kdc: Honor no-auth-data-reqd on cross-real TGTs
Nowadays we use PACs instead of AD-SIGNEDPATH, so we want a PAC on every
TGT, but we don't necessarily want PACs on cross-realm TGTs.

Specifically, we don't interop well yet with AD when issuing cross-realm
TGTs with AD realms as the destination realm (see #1091).
2023-06-23 13:44:13 -05:00
Nicolas Williams
77a452f4fd kdc: Make path to MIT Kerberos for testing configurable 2023-01-04 00:43:35 -06:00
Nicolas Williams
131d90c414 bx509d: Fix tests skipping on OS X 2022-12-21 22:14:03 -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
f727a4bdfd bx509: Fix test moar 2022-11-02 10:57:55 -05:00
Nicolas Williams
3e1befe633 bx509: Make test run with UBSAN 2022-11-01 16:10:57 -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
Nicolas Williams
c0bc8beb07 httpkadmind: Test attributes defaulting 2022-04-26 17:54:12 -05:00
Nicolas Williams
a5271cd765 httpkadmind: Enable materialization 2022-04-25 22:24:52 -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
6932819419 kadmind: Test other operations after LIST
Test that we can still do other things after `kadmin list` to make sure
we're not leaving -after listing- the connection in a state where other
operations can't work.

Also, no more sleeps at all in the test.
2022-03-24 17:17:22 -05:00
Nicolas Williams
621deed047 kadmin: Fix re-entrance in iterations
Any callback of kadm5_iter_principals() that wants to call other kadm5
functions (such as kadm5_get_principal()) needs to do so on a different
kadm5 handle than the one used for kadm5_iter_principals().
2022-03-23 18:03:38 -05:00
Nicolas Williams
d172a8bd79 kdc: More testing of hard aliases
This is an attempt to make sure we test realm migration aliases by doing
kinit w/ a hard alias name in a different realm, and that we can get
service tickets for services in the same and other realms some of which
are hard aliases in one direction, and some in the other.
2022-03-23 12:46:00 -05:00
Nicolas Williams
b92a02edda kadmind: Online LIST using kadm5_iter_principals()
Implement a variation on the op for listing principals where if the
client indicates support for the new variation then we stream the list
instead of collecting it into one reply.  This is the server-side
version of the associated, preceding commit:

    kadm5: Add online kadm5_iter_principals()
2022-03-20 18:30:21 -05:00
Nicolas Williams
e6a543fa1a tests: Make tests/kdc/check-kadmin fast
Not sure why we ever needed the run-kadmind-for-one-operation approach
to testing.  Anyways, we probably don't.  Ditching that and using the
--detach mechanism of daemonization means we don't need to sleep in the
test (except when we need to restart kadmind with different options).
2022-03-20 18:24:19 -05:00
Nicolas Williams
1acb961bc1 kdc: Implement hard and soft principal aliases
We introduced a notion of soft vs. hard aliases in the previous commit
(hdb: Distinguish soft and hard principal aliases).

This commit corrects existing test cases and adds new test cases.

Soft aliases allow for the configuration of referrals using HDB entries.

Hard aliases are like copies of the aliased HDB entries.  These are
useful for renaming principals (and realms).

See the preceding commit.
2022-03-17 20:43:32 -05:00
Nicolas Williams
953d944242 gss: Remove useless grep from check-context 2022-03-09 10:22:06 -06:00
Luke Howard
25fae63097 tests: update test KDC plugin for new PAC plugin signatures
Fixes regression introduced in 11d8a053.
2022-03-03 10:16:12 +11:00
Nicolas Williams
b92cf79543 Revert "osx: Never load OS X CCAPI while testing"
This reverts commit 79d87af910.
2022-02-11 15:13:13 -06:00
Nicolas Williams
add605ee58 tests: cat messages.log in gss/check-basic trap 2022-02-10 00:57:31 -06:00
Nicolas Williams
848c21b9b9 tests: Kill kdc harder when failing 2022-02-10 00:57:31 -06:00
Nicolas Williams
79d87af910 osx: Never load OS X CCAPI while testing 2022-02-10 00:56:44 -06:00
Nicolas Williams
1da235c9c3 osx: Avoid blocking the KDC in KEYCHAIN in tests
If a client tries to use PKINIT we can block in the OS X keychain if no
anchors are configured.
2022-02-09 23:49:40 -06:00
Nicolas Williams
13cb84d465 GitHub: Skip check-tester in valgrind build 2022-02-01 13:38:48 -06:00
Nicolas Williams
df244493ee krb5: Test KCM
Finally, we have a test for KCM.  It shall not break again.
2022-01-25 15:38:55 -06:00
Nicolas Williams
06ba7b1597 test: When kdc fails to start, show the log
This is an attempt to find out why the GitHub Actions OS X build is
failing.
2022-01-20 14:32:17 -06:00
Luke Howard
ec24edf700 kdc: add accessor functions for KDC request structure
Add accessor functions for use by Samba and other plugin developers.
Documentation is in kdc/kdc-accessors.h.
2022-01-20 17:23:24 +11:00
Luke Howard
4befd3e355 kdc: remove krb5_ prefix for KDC attribute functions
We will use the kdc_ rather than krb5_kdc_ prefix for new public APIs exported
from libkdc. Amend the recently introduced
request_{get,set,copy,delete}_attribute APIs to conform.
2022-01-17 23:50:04 -05:00
Luke Howard
0e8c4ccc6e hdb: eliminate hdb_entry_ex
Remove hdb_entry_ex and revert to the original design of hdb_entry (except with
an additional context member in hdb_entry which is managed by the free_entry
method in HDB).
2022-01-15 18:54:57 +11:00
Nicolas Williams
f076ed57cc Fix make dist 2022-01-14 20:10:19 -06:00
Luke Howard
40e4a4df09 kdc: use astgs_request_t for client/server name (TGS)
Store the client and server principal name from the TGT and request
(respectively) in the astgs_request_t rather than using local variables.
2022-01-10 15:29:49 +11:00
Nicolas Williams
c2e3c5b66e gss: Add way to set authenticator authz-data
Now we can set Authenticator authorization-data with
gss_set_name_attribute().
2022-01-08 10:38:01 +11:00
Luke Howard
7cc4b7a9e6 kdc: KDC plugin API contract notes
Add some notes about the KDC plugin API contract, and require plugins to
explicitly indicate which version of the API they support (remove the macro
alias for the current version).
2022-01-05 13:08:11 +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
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
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
Nicolas Williams
73bb84c0f3 bx509d: Fix tests (log message diffs) 2022-01-02 21:37:43 -06: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
Luke Howard
81077eea7b tests: use cname/sname string name instead of unparsing 2021-12-26 18:40:19 +11:00