summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2023-06-21samba-tool: move some parts of 'domain level [show|raise]' in to try/exceptStefan Metzmacher1-47/+50
This just adds indentation for now, the following changes will add transactions... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-21samba-tool: let 'domain level raise --domain-level' use the correct crossRef dnStefan Metzmacher1-3/+8
We should not rely on lp.get('workgroup')... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-21samba-tool: check for invalid 'domain level' subcommands firstStefan Metzmacher1-2/+3
This will simplify further changes... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-21samba-tool: Fix missing import for "domain level raise --forest-level=2016"Andrew Bartlett1-1/+1
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-06-21tests/krb5: Test that FX-COOKIE matches cookie returned by WindowsJoseph Sutton1-0/+87
The cookie produced by Windows differs depending on whether FAST was used. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-06-16samba-tool: add new --dns-directory-partition option to dns zonecreate commandBjörn Baumbach2-5/+113
The new --dns-directory-partition chooses the directory partition for the new zone - "domain" or "forest". Defaults to the current default "domain". Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jun 16 21:23:28 UTC 2023 on atb-devel-224
2023-06-16libsmb: Test smb1 mknodVolker Lendecke1-0/+20
Requires O_PATH to work correctly Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-06-15tests/auth_log: Ensure tests continue to pass when new log types are addedJoseph Sutton1-2/+24
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-15tests/auth_log: Add support for new ‘KDC Authorization’ log typeJoseph Sutton1-0/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Refactor waitForMessages() to use nextMessage()Joseph Sutton1-15/+8
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jun 14 23:55:42 UTC 2023 on atb-devel-224
2023-06-14tests/auth_log: Add method to fetch the next relevant message from the ↵Joseph Sutton1-0/+38
messaging bus Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Test authentication with policy restrictions and a wrong passwordJoseph Sutton1-0/+145
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Test S4U2Self followed by constrained delegation with ↵Joseph Sutton2-0/+118
authentication policies Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Remove unneeded ‘dn’ parameterJoseph Sutton1-9/+9
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Make use of KerberosCredentials.get_sid()Joseph Sutton10-270/+106
KerberosCredentials objects now keep track of their account’s SID, which removes the need to look it up with KDCBaseTest.get_objectSid(). Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Keep track of account SIDsJoseph Sutton2-1/+15
This prevents having to look them up in the database when tests need them. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Fix overlong linesJoseph Sutton1-3/+5
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Add a couple of authentication policy testsJoseph Sutton1-0/+38
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Test authentication logging of TGT lifetimesJoseph Sutton1-5/+17
It is useful to test a combination of device restrictions and TGT lifetime restrictions so that we can check what TGT lifetime values end up in the logs. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Cache created authentication policiesJoseph Sutton2-18/+40
View with ‘git show -b’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/krb5: Keep track of the type of each created accountJoseph Sutton2-0/+8
This allows us to determine which parts of an authentication policy apply to a particular account, which will be necessary to test audit logging. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Properly expect authentication failuresJoseph Sutton1-8/+12
These authentications are actually failing (due to RESPONSE_TOO_BIG errors), but our authentication logging infrastructure hides this. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Make samba.tests.auth_log test executableJoseph Sutton1-0/+11
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14samba-tool ou: Remove unused variablesJoseph Sutton1-3/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14samba-tool ou: Remove unused importJoseph Sutton1-1/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14samba-tool: Fix typoJoseph Sutton1-1/+1
Found by Rob van der Linde <rob@catalyst.net.nz>. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14selftest: Assert trust realm is not NoneJoseph Sutton1-2/+1
This is consistent with the other tests in this file. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14tests/auth_log: Factor out isRemote()Joseph Sutton1-22/+22
This makes waitForMessages() easier to read. View with ‘git show -b’. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-06-14python:safe_tarfile: Improve safe extract()Andreas Schneider1-11/+1
This also checks for symlinks and hardlinks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python:safe_tarfile: Implement safer extractall()Andreas Schneider1-0/+53
This also checks for symlinks and hardlinks. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python:safe_tarfile: Set extraction_filter for pythons providing itAndreas Schneider1-14/+22
It should be available for Python >= 3.11.4 but also has been backported. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python:tests: Adopt safe_tarfile for extraction_filter raisesAndreas Schneider1-6/+21
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15390 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14selftest: Add unit tests of the DC startup FL check/update codeAndrew Bartlett2-1/+222
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14python/tests: Make helpful, stateless methods @classmethod and @staticmethodAndrew Bartlett1-3/+5
This allows them to be used in setUpClass in tests. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-14selftest: Split up tests in dsdb.py to avoid creating a user when not requiredAndrew Bartlett1-12/+23
Creating a user is CPU intensive, particularly when a password is set so avoid doing so if not required. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-06-10gp: Fix user apply failure when droping privsDavid Mulder1-1/+1
When dropping privileges, gpupdate errored: gpclass.py:1167: KeyError: "getpwnam(): name not found: <HOSTNAME> apply_gp was incorrectly passing the hostname instead of the username. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Jun 10 10:46:28 UTC 2023 on atb-devel-224
2023-05-31sefltest: Improve getdcname test by confirming the _REQUIRED flag behavioursAndrew Bartlett1-2/+173
We do this by checking what the underlying CLDAP netlogon call returns. This also validates that behaviour. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-31selftest: Fix remaining incorrect references to 2012 -> 2012R2 FL in ↵Andrew Bartlett1-4/+4
GetDCNameEx test Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-31selftest: Change self.assertTrue(x is not None) -> self.assertIsNotNone(x)Andrew Bartlett1-30/+30
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2023-05-29selftest: Confirm that the flags like DS_DIRECTORY_SERVICE_9_REQUIRED workAndrew Bartlett1-0/+83
We need to confirm this both for forwarded requests, and also for requests direct to the possible DC. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon May 29 23:29:50 UTC 2023 on atb-devel-224
2023-05-29selftest: Rework samba.tests.getdcname not to use ncalrpcAndrew Bartlett1-1/+1
This test is able to operate over the network, which aids testing against a comparative windows DC. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-29selftest: Assert that we have a trust in samba.tests.getdcnameAndrew Bartlett1-18/+9
We must ensure this test cannot became inoperative because the environment it was run against has no trust. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-05-29python:tests: Ensure that we don’t overwrite testsJoseph Sutton1-2/+8
If the file iterator returns two entries with the same name, one may overwrite the other. script_iterator() currently ensures this won’t happen, but it pays to be safe. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Make script executableJoseph Sutton1-2/+6
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Initialize global variableJoseph Sutton1-0/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Remove unused importsJoseph Sutton1-2/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Exclude Python test directoriesJoseph Sutton1-36/+3
Practically all of our Kerberos tests are excluded already. Many of our tests aren’t marked as executable, and so aren’t being checked anyway. Rather than having a large list of exclusions which one may easily forget to update, just exclude the test directories. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29python:tests: Fix f-stringsJoseph Sutton1-3/+3
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29samba-tool domain: Handle new NBT_SERVER_* flagsJoseph Sutton1-0/+2
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-05-29tests/auth_log: Remove debugging codeJoseph Sutton1-5/+0
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>