mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
users: Use own copy of ldapscripts config
Avoid modifying the conffile shipped with ldapscripts. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
44b92f12eb
commit
4cbb60ccfe
@ -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():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user