summaryrefslogtreecommitdiff
path: root/python/samba/tests/gpo.py
AgeCommit message (Collapse)AuthorFilesLines
2025-03-25python:gp_cert_auto_enrol: fix GUID stringificationDouglas Bagnall1-2/+4
We were using some broken ad-hoc unpacking to do what the ndr unpacker does perfectly well. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15839 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Tue Mar 25 05:21:49 UTC 2025 on atb-devel-224
2024-01-22gpo: Test certificate policy without NDESGabriel Nagy1-6/+120
As of 8231eaf856b, the NDES feature is no longer required on Windows, as cert auto-enroll can use the certificate from the LDAP request. However, 157335ee93e changed the implementation to convert the LDAP certificate to base64 due to it failing to cleanly convert to a string. Because of insufficient test coverage I missed handling the part where NDES is disabled or not reachable and the LDAP certificate was imported. The call to load_der_x509_certificate now fails with an error because it expects binary data, yet it receives a base64 encoded string. This adds a test to confirm the issue. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15557 Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com> Reviewed-by: David Mulder <dmulder@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-11-30python: tests: update all super calls to python 3 style in testsRob van der Linde1-1/+1
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> [abartlet@samba.org Some python2 style super() calls remain due to being an actual, even if reasonable, behaviour change]
2023-11-30python: get rid of pointless empty overridden methodsRob van der Linde1-3/+0
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-11-20python:tests: Fix assertEquals which doesn't exist in Python 3.12Andreas Schneider1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15513 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-27gp_pol: Test multiple values multi_sz roundtripGabriel Nagy1-0/+33
Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@samba.org> Autobuild-User(master): David Mulder <dmulder@samba.org> Autobuild-Date(master): Fri Oct 27 14:45:28 UTC 2023 on atb-devel-224
2023-10-27gp_pol: Test empty multi_sz roundtripGabriel Nagy1-1/+32
Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@samba.org>
2023-10-16gpupdate: Test Drive Maps Client Side ExtensionDavid Mulder1-1/+187
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-10-13python:tests: Use now() instead of utcnow()Joseph Sutton1-2/+2
utcnow() is deprecated and will be removed in a future version of Python. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-30gp: Use assertEqual() instead of assertEquals()Joseph Sutton1-121/+121
assertEquals() is deprecated and could be removed in a future version of Python. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-30gp: Check correct variablesJoseph Sutton1-14/+14
We were intending to check the keys, not the certificates. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-30python: Fix invalid escape sequencesJoseph Sutton1-33/+33
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-30python: Remove redundant backslashesJoseph Sutton1-4/+4
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-30python: Remove unused importsJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-28gp: Test disabled enrollment unapplies policyGabriel Nagy1-0/+54
For this we need to stage a Registry.pol file with certificate autoenrollment enabled, but with checkboxes unticked. Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: David Mulder <dmulder@samba.org>
2023-08-28gp: Test adding new cert templates enforces changesGabriel Nagy1-0/+48
Ensure that cepces-submit reporting additional templates and re-applying will enforce the updated policy. Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: David Mulder <dmulder@samba.org>
2023-08-28gp: Test with binary content for certificate dataGabriel Nagy1-4/+4
This fails all GPO-related tests that call `gpupdate --rsop`. Signed-off-by: Gabriel Nagy <gabriel.nagy@canonical.com> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: David Mulder <dmulder@samba.org>
2023-07-31gp: Test modifying centrify crontab user policy enforces changesDavid Mulder1-4/+38
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying script user policy enforces changesDavid Mulder1-4/+38
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying smb.conf policy enforces changesDavid Mulder1-3/+35
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying Issue policy enforces changesDavid Mulder1-3/+27
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying Messages policy enforces changesDavid Mulder1-4/+31
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying MOTD policy enforces changesDavid Mulder1-3/+33
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying firefox policy enforces changesDavid Mulder1-0/+76
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Test modifying firewalld policy enforces changesDavid Mulder1-0/+20
Ensure that modifying the firewalld policy and re-applying will enforce the correct policy. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-31gp: Ensure Firewalld tests don't flopDavid Mulder1-3/+7
This test was failing depending on the system it was run on, since the result depends on whether firewalld python bindings were installed. This wasn't failing in CI (and so there is no flopping test marked), but does fail on some local systems. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-04-28gpo: Group Policy tests require a s3 loadparamDavid Mulder1-1/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15225 Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-04-28gpupdate: Deprecate libgpo.get_gpo_listDavid Mulder1-6/+0
This is no longer used by gpupdate. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15225 Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-04-28gpupdate: Implement get_gpo_list in pythonDavid Mulder1-85/+57
The ADS code in libgpo is buggy. Rewrite get_gpo_list in python using SamDB. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15225 Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-03-20gpupdate: Test that PAM Access uses winbind separatorDavid Mulder1-4/+7
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2023-01-30python: Replace calls to deprecated methodsJoseph Sutton1-8/+8
These aliases are deprecated and have been removed in Python 3.12. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-12-21gp: Ensure rsop is tested for every CSEDavid Mulder1-4/+101
A bug cropped up in the rsop that was causing a crash because this wasn't being tested. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-21gp: Enable gpupdate output when testingDavid Mulder1-0/+1
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-21gp: Ensure policy changes don't leave files behindDavid Mulder1-3/+30
This test exercises the gp_file_applier and ensures that when a policy is modified, no old policy is left behind. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-21gp: Test that files are re-created if manually removedDavid Mulder1-2/+12
Currently applied files which are manually removed do not get re-applied. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-21gp: Modify Chromium CSE to use new files applierDavid Mulder1-2101/+17
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-21gp: Modify Machine Scripts CSE to use new files applierDavid Mulder1-0/+1
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-11-21gp: Test PAM Access with DENY_ALLDavid Mulder1-2/+5
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Nov 21 22:05:01 UTC 2022 on sn-devel-184
2022-11-12gp: Test that Password and Kerberos policies fail on unknown keyDavid Mulder1-1/+2
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Nov 12 01:34:17 UTC 2022 on sn-devel-184
2022-10-25gpo: Test to ensure startup scripts don't crash w/out paramsDavid Mulder1-1/+48
Startup scripts were failing to execute when no parameters were provided to the script. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15212 Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-05-31gpo: Move Group Policy code below gp directoryDavid Mulder1-27/+27
Moves the Group Policy extensions and supporting code within the existing python/samba/gp directory. Meant to clean up the clutter that's accumulating in python/samba. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue May 31 20:15:45 UTC 2022 on sn-devel-184
2022-05-13gpo: Remove sscep depends from Cert Auto EnrollDavid Mulder1-7/+51
Certificate Auto Enrollment currently depends on sscep to retrieve the root certificate chain. This isn't necessary, since this can be accomplished with a simple GET. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-05-10gpo: Test Centrify Compatible Crontab ExtensionsDavid Mulder1-0/+109
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-10gpo: Test Centrify Compatible Sudoers ExtensionDavid Mulder1-0/+57
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-03gpo: Test Cert Auto Enroll Advanced ConfigDavid Mulder1-1/+271
Adds advanced configuration to the testing of certificate auto enrollment. Currently fails. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-03-24samba-gpupdate: Implement enhanced loggingDavid Mulder1-45/+22
This ports the enhanced logging capabilities from AltLinux gpupdate. It generates log messages such as: 2022-03-02 11:28:54.872|[E40104]| Failed to set interfaces for zone | {'val': 'work'} 2022-03-02 11:28:55.017|[E40104]| Failed to set interfaces for zone | {'val': 'home'} Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Mar 24 23:40:47 UTC 2022 on sn-devel-184
2021-11-01gp: Test Firewalld Group Policy ApplyDavid Mulder1-0/+111
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-10-25Revert "gp: Test Firewalld Group Policy Apply"Andreas Schneider1-140/+29
This reverts commit 8f347449190c698ec4d2720bbf6ffced853ef797. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: David Mulder <dmulder@suse.com>
2021-10-25gp: Test Firewalld Group Policy ApplyDavid Mulder1-29/+140
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2021-09-09gpo: Test Chromium Group PolicyDavid Mulder1-0/+5024
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>