1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-24 13:57:43 +03:00

140214 Commits

Author SHA1 Message Date
Stefan Metzmacher
5ada7c17b7 s4:kdc: let samba_kdc_update_pac() always fetch the user claims
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
4f5be1cd78 s4:kdc: let samba_kdc_update_pac() use samba_kdc_entry_pac_valid_principal() to check delegated_proxy
This might not be needed, but it's more consistent.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
51d7db7e9f s4:kdc: remove useless samba_kdc_get_user_info_dc() from samba_kdc_get_device_info_blob()
There's no need to call it again if the caller already did.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
94e77288dc s4:kdc: move user_info_dc_shallow_copy variable in samba_kdc_update_pac()
This is only needed as tmp variable in the if block...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
593b9c2e9c s4:kdc: move samba_kdc_get_user_info_dc() for the device in samba_kdc_update_pac()
We should can already call this in the 'need_device' branch, then
it can be reused later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
9fda646adb s4:kdc: move samba_kdc_get_user_info_dc() up in samba_kdc_update_pac()
This will make further changes easier.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
8e0b132c08 s4:kdc: introduce need_device helper variable in samba_kdc_update_pac()
Also use samba_kdc_entry_pac_valid_principal() in order to catch
all conditions for a valid device. For principals issued by
trusted domains there's no device.entry pointer!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
e55caa68a5 s4:kdc: make samba_kdc_get_{user_info_dc,claims_data} static
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
55c47104c1 s4:kdc: pass samba_kdc_entry_pac to samba_kdc_check_s4u2proxy_rbcd()
This simplifies and unifies the callers.

For the MIT kdc we avoid using via kerberos_pac_to_user_info_dc()
directly.

Now both go via samba_kdc_get_user_info_dc() and MIT also
handles the samba_kdc_get_claims_data() path.

For the MIT kdc it means kerberos_pac_to_user_info_dc() is now
called via samba_kdc_get_user_info_dc() ->
samba_kdc_get_user_info_from_pac() and it is followed by
authsam_update_user_info_dc() consistently.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
58df2bd733 s4:kdc: move samba_kdc_check_s4u2proxy_rbcd() from db-glue to pac-glue
This will allow us to make more functions static in the next steps.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
4f5946ca0c s4:kdc: make a lot of pac-glue.c functions static
This makes the code base less confusing (at least for me).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
c004c32993 s4:kdc: let mit_samba_get_pac() use samba_kdc_get_pac()
It means we port commit b42fbc78395870c3caa33aa1c9636a59fde9e867 also to the
MIT kdc and enforce authentication policy service restrictions when getting a PAC

We should have this logic only once in order to avoid getting out of
sync between heimdal and MIT regarding the core logic.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
b5628d0f4a s4:kdc: split out samba_kdc_get_pac() from samba_wdc_get_pac()
samba_kdc_get_pac() will be re-used by mit_samba_get_pac() in
the next step.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
ddeb85fd72 s4:kdc: don't return ENOENT from samba_kdc_get_claims_data[_from_pac]
This will matter in the next commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
6e9d54a9eb s4:kdc: use better variable names in samba_wdc_check_client_access()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
4bc5b6f90f s4:auth: avoid talloc_reference in claims_data_encoded_claims_set()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 22:06:39 +00:00
Stefan Metzmacher
2cae470f23 winbindd: find_auth_domain() and find_lookup_domain_from_name() should handle namespaces
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sat Feb 22 17:03:27 UTC 2025 on atb-devel-224
2025-02-22 17:03:27 +00:00
Stefan Metzmacher
800048c131 winbindd: add find_routing_from_namespace_noinit()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
2fdb34c508 winbindd: remember ForestTrustInformation in routing_domain->fti
This will be used for sid/name filtering in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
87bb258a3f s3:passdb: add pdb_filter_hints()
This reveals information about our own domain/forest.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
5f672b125f s4:rpc_server/lsa: let dcesrv_lsa_lookup_name_account() handle uPNSuffixes
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
72d377c0f3 libcli/lsarpc: add trust_forest_info_match_tln_namespace()
This will be used by the namespace filtering part of
sid filtering...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
c5d2659688 libcli/auth: let NTLMv2_RESPONSE_verify_netlogon_creds() check RODC callers check computer_name
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
b2e5de0e8c s4:rpc_server/netlogon: let dcesrv_netr_NTLMv2_RESPONSE_verify do RODC checking
This implements MS-NRPC 3.5.4.5.1.2 RODC server cachability validation.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
8bbea06140 libcli/auth: let NTLMv2_RESPONSE_verify_netlogon_creds() return the computer_name
This will be used to implement the MS-NRPC 3.5.4.5.1.2 RODC server cachability validation.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
29b07aff09 libcli/auth: add NTLMv2_RESPONSE_verify_trust() checking
This implements MS-NRPC 3.5.4.5.1.1 Pass-through domain name validation.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
dc7ac4d0a5 s3:rpc_server/netlogon: let _netr_NTLMv2_RESPONSE_verify() generate trust_forest_domain_info array
MS-NRPC 3.5.4.5.1.1 Pass-through domain name validation,
requires to pass information about the trust topology to
NTLMv2_RESPONSE_verify_netlogon_creds()...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
442b961b7b s4:rpc_server/netlogon: let dcesrv_netr_NTLMv2_RESPONSE_verify generate trust_forest_domain_info array
MS-NRPC 3.5.4.5.1.1 Pass-through domain name validation,
requires to pass information about the trust topology to
NTLMv2_RESPONSE_verify_netlogon_creds()...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
97e256566f libcli/auth: pass trust_forest_domain_info array to NTLMv2_RESPONSE_verify_netlogon_creds
This will be used in the next commits in order to
implement MS-NRPC 3.5.4.5.1.1 Pass-through domain name validation.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
ddf0434c96 s3:rpc_server/netlogon: split out _netr_NTLMv2_RESPONSE_verify()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
daa816af23 s4:rpc_server/netlogon: split out dcesrv_netr_NTLMv2_RESPONSE_verify()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
1e09a2846f libcli/auth: split out NTLMv2_RESPONSE_verify_workstation()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
36dddad8c6 docs-xml/smbdotconf: add ft_scanner to 'server service'
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
f5b112b436 s4:dsdb: add forest trust scanner service
See MS-ADTS 3.1.1.6.4 PDC Forest Trust Update

It basically connects to all forest trusts
and searches for crossRef objects with
SYSTEM_FLAG_CR_NTDS_DOMAIN under
CN=Partitions,CN=Configuration.

With this information it add/removes
FOREST_TRUST_SCANNER_INFO records into
the msDS-TrustForestTrustInfo of the local
trustedDomain object.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
af0b912215 s3:tldap: add tldap_msg_rc() helper
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
69f528a9ce winbindd: make use of lsaR[G|S]etForestTrustInformation2 to allow SCANNER_INFO
Note that we don't need to handle a fallback to old servers,
because we only talk to ourself here.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
2db3185fb7 s4:rpc_server/lsa: add lsaR[G|S]etForestTrustInformation2 support to allow FOREST_TRUST_SCANNER_INFO
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
fba41093e9 s4:dsdb/common: let dsdb_trust_merge_forest_info() handle SCANNER and BINARY records
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
02b4fdd41d s4:dsdb/common: let dsdb_trust_normalize_forest_info_step2() handle SCANNER and BINARY records
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
ce3635832d s4:dsdb/common: let dsdb_trust_normalize_forest_info_step1() handle BINARY and SCANNER records
Note for scanner records we need to filter out duplicates,
but binary records may exist multiple times.

Review with: git show -w

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
54b8c0dd5b s4:dsdb/common: let dsdb_trust_forest_info_add_record() handle BINARY and SCANNER records
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
34b47c9c22 libcli/lsarpc: let trust_forest_info_from_lsa2() handle BINARY and SCANNER records
The tricky part is that we also need to upgrade
LSA_FOREST_TRUST_BINARY_DATA records into FOREST_TRUST_SCANNER_INFO records.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
60943b52f2 libcli/lsarpc: add trust_forest_info_lsa_2to2()
This normalizes LSA_FOREST_TRUST_BINARY_DATA in
LSA_FOREST_TRUST_SCANNER_INFO.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
ce5e377797 libcli/lsarpc: let trust_forest_{record_lsa_2to1,info_to_lsa}() handle SCANNER_INFO
We need to convert the [LSA_]FOREST_TRUST_SCANNER_INFO record
into a binary record, but with LSA_FOREST_TRUST_SCANNER_INFO
as type.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
63045ddc4a libcli/lsarpc: let trust_forest_{record_lsa_1to2,info_from_lsa}() handle BINARY and SCANNER records
The tricky part is that it's all based on the sub_type within
the binary data, if it's FOREST_TRUST_SCANNER_INFO the
record is upgraded to an LSA_FOREST_TRUST_SCANNER_INFO,
otherwise it's downgraded to a LSA_FOREST_TRUST_BINARY_DATA
record.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
6fdb76667d libcli/lsarpc: let trust_forest_record_to_lsa() handle BINARY and SCANNER records
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
57352cf769 libcli/lsarpc: let trust_forest_record_from_lsa() handle BINARY and SCANNER records
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
c0f025c87c s4:dsdb/util_trusts: convert most functions from lsa_ForestTrustInformation to lsa_ForestTrustInformation2
We use trust_forest_info_lsa_{1to2,2to1}() where needed.

This will make it possible to support
FOREST_TRUST_BINARY_DATA and FOREST_TRUST_SCANNER_INFO later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
8dc11c71b4 libcli/lsarpc: add trust_forest_info_lsa_{1to2,2to1}()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00
Stefan Metzmacher
c903d4699c libcli/lsarpc: add trust_forest_info_{from,to}_lsa2()
Note for now these will fail for FOREST_TRUST_BINARY_DATA and
FOREST_TRUST_SCANNER_INFO.

But this will still make the transition from
lsa_ForestTrustInformation to lsa_ForestTrustInformation2
easier.

Support for will FOREST_TRUST_BINARY_DATA and FOREST_TRUST_SCANNER_INFO
will be added before we implement the forest trust background scanner
job and the lsaRSetForestTrustInformation2 function.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-22 16:00:36 +00:00