From 401d3870f6d82c2fa2da2a1bcdbe22b2e01dd7a6 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 16 Apr 2016 14:37:02 -0400 Subject: [PATCH] Move ldapscript setup to users module setup. --- actions/ldap | 18 ------------------ actions/users | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/actions/ldap b/actions/ldap index cf0dc75eb..ed4d40f0d 100755 --- a/actions/ldap +++ b/actions/ldap @@ -121,24 +121,6 @@ remove_user_from_group() } -setup() -{ - # XXX: Password setting on users is disabled as changing passwords - # using SASL Auth is not supported. - cat < /dev/null -set /files/etc/ldapscripts/ldapscripts.conf/SERVER '"ldapi://"' -set /files/etc/ldapscripts/ldapscripts.conf/SASLAUTH '"EXTERNAL"' -set /files/etc/ldapscripts/ldapscripts.conf/SUFFIX '"dc=thisbox"' -set /files/etc/ldapscripts/ldapscripts.conf/USUFFIX '"ou=Users"' -set /files/etc/ldapscripts/ldapscripts.conf/GSUFFIX '"ou=Groups"' -set /files/etc/ldapscripts/ldapscripts.conf/PASSWORDGEN '"true"' -save -EOF -} - - -setup - command=$1 shift case $command in diff --git a/actions/users b/actions/users index 102a4fa06..49c214bb3 100755 --- a/actions/users +++ b/actions/users @@ -24,9 +24,11 @@ Configuration helper for the LDAP user directory import argparse import subprocess +import augeas from plinth import action_utils ACCESS_CONF = '/etc/security/access.conf' +LDAPSCRIPTS_CONF = '/etc/ldapscripts/ldapscripts.conf' def parse_arguments(): @@ -117,6 +119,22 @@ replace: olcRootDN olcRootDN: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth ''') + aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + + augeas.Augeas.NO_MODL_AUTOLOAD) + aug.set('/augeas/load/Shellvars/lens', 'Shellvars.lns') + aug.set('/augeas/load/Shellvars/incl[last() + 1]', LDAPSCRIPTS_CONF) + aug.load() + + # XXX: Password setting on users is disabled as changing passwords + # using SASL Auth is not supported. + aug.set('/files' + LDAPSCRIPTS_CONF + '/SERVER', '"ldapi://"') + aug.set('/files' + LDAPSCRIPTS_CONF + '/SASLAUTH', '"EXTERNAL"') + aug.set('/files' + LDAPSCRIPTS_CONF + '/SUFFIX', '"dc=thisbox"') + aug.set('/files' + LDAPSCRIPTS_CONF + '/USUFFIX', '"ou=Users"') + aug.set('/files' + LDAPSCRIPTS_CONF + '/GSUFFIX', '"ou=Groups"') + aug.set('/files' + LDAPSCRIPTS_CONF + '/PASSWORDGEN', '"true"') + aug.save() + def main(): """Parse arguments and perform all duties"""