diff --git a/actions/users b/actions/users index a78d1af87..f7feddf35 100755 --- a/actions/users +++ b/actions/users @@ -21,15 +21,17 @@ Configuration helper for the LDAP user directory """ import argparse +import augeas +import os import re +import shutil import subprocess import sys -import augeas from plinth import action_utils ACCESS_CONF = '/etc/security/access.conf' -LDAPSCRIPTS_CONF = '/etc/ldapscripts/ldapscripts.conf' +LDAPSCRIPTS_CONF = '/etc/ldapscripts/freedombox-ldapscripts.conf' def parse_arguments(): @@ -186,6 +188,9 @@ olcRootDN: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth def configure_ldapscripts(): """Set the configuration used by ldapscripts for later user management.""" + # modify a copy of the config file + shutil.copy('/etc/ldapscripts/ldapscripts.conf', LDAPSCRIPTS_CONF) + aug = augeas.Augeas( flags=augeas.Augeas.NO_LOAD + augeas.Augeas.NO_MODL_AUTOLOAD) aug.set('/augeas/load/Shellvars/lens', 'Shellvars.lns') @@ -338,10 +343,11 @@ def flush_cache(): def _run(arguments, **kwargs): """Run a command. Check return code and suppress output by default.""" + env = dict(os.environ, LDAPSCRIPTS_CONF=LDAPSCRIPTS_CONF) kwargs['stdout'] = kwargs.get('stdout', subprocess.DEVNULL) kwargs['stderr'] = kwargs.get('stderr', subprocess.DEVNULL) kwargs['check'] = kwargs.get('check', True) - return subprocess.run(arguments, **kwargs) + return subprocess.run(arguments, env=env, **kwargs) def main():