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

5137 Commits

Author SHA1 Message Date
Stefan Metzmacher
a814f5d90a python:lsa_utils: Fix fallback to OpenPolicy2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Feb 17 18:33:15 UTC 2025 on atb-devel-224
2025-02-17 18:33:15 +00:00
Andreas Schneider
f9a3fc19f1 python:lsa_utils: Don't use optional arguments for OpenPolicyFallback()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2025-02-17 17:29:37 +00:00
Björn Baumbach
3e1c19c2c3 pytests: test pysmbd with relative path names via samba-tool ntacl
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15806

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Fri Feb 14 16:18:19 UTC 2025 on atb-devel-224
2025-02-14 16:18:19 +00:00
Björn Baumbach
334f621e4b pytests: test pysmbd with non-existent file
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15807

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-02-14 15:20:36 +00:00
Stefan Metzmacher
84b7de6deb python:tests/krb5: only expect compressed claims if the compression reduces the size
I have captures showing that claims compression depends on the payload
itself and how well it compresses, instead of the pure length of the
payload.

E.g. a single string claim with a value of 68 'a'
characters has an unpressed size of 336
and compressed size is 335.
While a single string with random string s1
has an unpressed size of 504 and it's still
uncompressed on the wire.
A different random string s2 also has an unpressed
size of 504, but it is compressed into a size of 502.

So it really depends if the compression makes it actually
smaller than the uncompressed version.

This makes the tests more reliable against Windows DCs
with existing claims defined.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-14 10:58:40 +00:00
Stefan Metzmacher
23aa5e897c python:tests: add ClaimsTransformationTests to security.py
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-14 10:58:40 +00:00
Douglas Bagnall
455a0558c8 pytest: add ndr packing tests for security descriptors
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Volker Lendecke <vl@samba.org>
2025-02-13 14:13:37 +00:00
Stefan Metzmacher
dba0cdad5b security.idl: change ORGANISATION into ORGANIZATION
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 18:48:35 +00:00
Stefan Metzmacher
04208c04ff python:tests: let lsa_utils.py use valid netbios names
createtrustrelax has 16 characters, but only 15 are allowed
and they are typically uppercase.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-08 15:26:38 +00:00
Douglas Bagnall
2f93c9322b samba-tool contact: remove useless versionopts references
These are now redundant as all samba-tool sub-commands handle
-V/--version automatically.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
6f7bc5cb12 py:get_opts:VersionOptions prints version in --help
Because it might as well. Like this:

  Version Options:
    -V, --version       Display version number (4.22.2)

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
a61e192f25 samba-tool: --version shortcircuits option evaluation
This means in

   bin/samba-tool spn -h -V

the -V takes precedence over the -h, as with the 'net' tool.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
8aec198306 samba-tool: all subcommands know --version
Before `samba-tool -V` would give you the version,
but `samba-tool spn -V` would complain.

An ad-hoc selection of sub-commands already supported --version,
depending on whether VersionOptions was manually added to the
takes_options dict. The .run() methods of these subcommands all take a
'versionopts' keyword argument, but never use it. If it was set (i.e.,
argv contained "--version"), the process never gets to .run(), so the
value of versionopts.version is always None in run(). After this
commit we can remove VersionOptions/versionopts from sub-commands.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
3a408f06ae samba-tool: do not complain of no sub-command with '-V'
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
fd59b316b8 pytest: samba-tool --version tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-02-08 02:33:38 +00:00
Douglas Bagnall
e705dbbc67 provision: always use a large transaction index cache
A larger cache costs more per transaction, but makes a large number
of operations within a transaction faster. We expect to be dealing
with the latter case here, regardless of the batch_mode parameter
and the database size. 200000 is chosen because it is also used in
join and schemaupgrade, and should be sufficient in most cases.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue Feb  4 22:47:35 UTC 2025 on atb-devel-224
2025-02-04 22:47:35 +00:00
Andréas Leroux
5092d7f46b netcmd: Increase the transaction_index_cache_size to 200k for schemaupgrade
Increasing this value greatly improve the performances of schema
upgrade for large domains (>200k entries).

The value 200000 is chosen because it is already used in join.py, and
should be sufficient for known domains.

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

Signed-off-by: Andréas Leroux <aleroux@tranquil.it>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2025-02-04 21:48:40 +00:00
Stefan Metzmacher
abba3495d2 python:tests/dcerpc/lsa: add tests for invalid LookupSids2 combinations
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-29 01:14:40 +00:00
Ralph Boehme
b53ac980e1 s3/mdssvc: add option "elasticsearch:force_substring_search = yes | no" (default: no)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jan 24 10:52:33 UTC 2025 on atb-devel-224
2025-01-24 10:52:33 +00:00
Björn Baumbach
21a88df032 samba-tool user disable: add new --remove-supplemental-groups option
Removes all supplemental groups from a user, what is commonly
wanted when a user is disabled.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>

Autobuild-User(master): Björn Baumbach <bb@sernet.de>
Autobuild-Date(master): Thu Jan 23 19:51:05 UTC 2025 on atb-devel-224
2025-01-23 19:51:05 +00:00
Björn Baumbach
f924724e46 samba-tool user disable: make sure that filter matches only one user
toggle_userAccountFlags() can only handle one user.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
b19445a8f0 samba-tool user disable: rename filter variable to search_filter
filter() is a Python built-in function to filter iterables.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
462d0d667c samba-tool user disable: set proper --filter option description
Seems to be copied from samba-tool user setpassword command.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
dd0892a1be samba-tool group removemembers: avoid python backtrace on error
Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
300e14674c python/samdb: no need to set member_base_dn multiple times
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
c9d8e96d2b python/samdb: fix group member removal by SID
Otherwise the removal of groupmembers by SID fails silently, because the
DN does not match the the DN in group member list.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
a74bc62779 python/samdb: fix check which checks if user is already member of group
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
190a635b38 python/samdb: rename filter variable to search_filter
filter() is a Python built-in function to filter iterables.

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
a4f84ba897 python/samdb: add missing function parameter description
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Björn Baumbach
bba6bb164e python/samdb: fix attribute name in parameter description
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jule Anger <janger@samba.org>
2025-01-23 18:53:37 +00:00
Stefan Metzmacher
9bab6426b9 python:tests/krb5: let netlogon.py check for NETLOGON_NTLMV2_ENABLED
It's there for network_samlogon and interactive_samlogon,
but not in ticket_samlogon.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2025-01-15 13:03:34 +00:00
Stefan Metzmacher
9a4c2280e9 python:tests: let s3_net_join.py avoid kerberos_state=DONT_USE_KERBEROS
We may use ServerAuthenticateKerberos in future and that needed to
use kerberos.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00
Stefan Metzmacher
0ca38918f6 python:tests: let auth_log.py also test --option=clientusekrb5netlogon=yes
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00
Stefan Metzmacher
b84aa14c99 python:tests: let auth_log.py explicitly use --option=clientusekrb5netlogon=no
It also add some additional checks to make sure netlogon with AES was
used.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00
Stefan Metzmacher
2a4f0911e9 python:tests: let auth_log.py use self.assertIn(received, [4, 5]
This will simplify further changes.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-13 23:40:30 +00:00
Stefan Metzmacher
b0d6c639e4 python:tests/krb5: let netlogon.py test referral ticket for SEC_CHAN_DNS_DOMAIN
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:31 +00:00
Stefan Metzmacher
1510aad09b python:tests/krb5: allow get_service_ticket to accept a trust referral ticket without kvno
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:31 +00:00
Stefan Metzmacher
3d41954195 python:tests/krb5: allow tickets without a kvno
This is needed for trust referrals.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:31 +00:00
Stefan Metzmacher
4e6724e122 python:tests/krb5: let netlogon.py export changed passwords to keytab
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:31 +00:00
Stefan Metzmacher
ca795ef472 python:tests/krb5: add domain trust tests to netlogon.py
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:31 +00:00
Stefan Metzmacher
9e58d057a0 python:tests/krb5: add a create_trust() helper function to test trusted domains
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:31 +00:00
Stefan Metzmacher
9520aea8b0 python:tests/krb5: allow exporting a keytab file of the accounts used by the tests
EXPORT_KEYTAB_FILE=/dev/shm/export.keytab
EXPORT_KEYTAB_APPEND=0 or 1
EXPORT_EXISTING_CREDS_TO_KEYTAB=0 or 1
EXPORT_GIVEN_CREDS_TO_KEYTAB=0 or 1

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:30 +00:00
Stefan Metzmacher
122af1c77e python:tests/krb5: add KerberosCredentials.[g|s]et_trust_{incoming,outgoing,account}_creds
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:30 +00:00
Stefan Metzmacher
3dd918f318 python:tests/krb5: let netlogon.py run the tests also as rodc
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:30 +00:00
Stefan Metzmacher
6c21a74c44 python:tests/krb5: allow netlogon.py tests to work against a KDC with claims enabled
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:30 +00:00
Stefan Metzmacher
65812d642d python:tests/krb5: allow get_mock_rodc_krbtgt_creds(preserve=False) to create a tmp rodc
This also exposes credentials for the machine account for netlogon
testing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:30 +00:00
Stefan Metzmacher
a2864b3c4c python:tests/krb5: fix etypes_to_test values in RawKerberosTest
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-08 09:13:30 +00:00
Ralph Boehme
e18a5381a8 tests: test SMB3 POSIX append-IO behaviour
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-07 22:04:33 +00:00
Ralph Boehme
5c36cd2b9e tests: add a test for copy-chunk on a POSIX handle
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15751

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-07 22:04:32 +00:00
Ralph Boehme
c9001999ca tests: use libsmb.unix_mode_to_wire() in smb3unix.py
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15751

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-07 22:04:32 +00:00