users: Restart nslcd service after configuration changes during setup

Fixes an issue where the nslcd configuration option pam_authz_search is not
in effect after the users module setup.

Tests:
  - Remove the pam_authz_search configuration option from /etc/nslcd.conf,
    restart nslcd service, delete plinth.sqlite database to run first setup
    after plinth start, start plinth. Do it twice:
    1) before applying patch, users::test_user_states functional test fails.
    2) after applying patch, users::test_user_states functional test pass.
  - After applying patch, the nslcd service is restarted during module
    upgrade.
  - All the users module tests pass.

Relates to
https://salsa.debian.org/freedombox-team/freedombox/-/merge_requests/2594#note_565614.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa 2024-12-28 14:44:06 +02:00 committed by Sunil Mohan Adapa
parent 526c5354aa
commit 40e00423a8
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class UsersApp(app_module.App):
app_id = 'users'
_version = 7
_version = 8
can_be_disabled = False

View File

@ -124,7 +124,8 @@ def _configure_ldap_authentication():
action_utils.service_enable('slapd')
action_utils.service_start('slapd')
action_utils.service_enable('nslcd')
action_utils.service_start('nslcd')
# For changes in /etc/nslcd.conf to take effect, restart the service
action_utils.service_restart('nslcd')
def _configure_ldap_structure():