[debian-lan-devel] [debian-lan] 01/02: Invalidate the sssd cache when adding/removing content.

Andreas B. Mundt andi at moszumanska.debian.org
Sat Feb 21 09:12:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

andi pushed a commit to branch master
in repository debian-lan.

commit 19a6ebdcbe80f1ce815408aa71f3de81923f7236
Author: Andreas B. Mundt <andi at debian.org>
Date:   Sat Feb 21 08:44:50 2015 +0100

    Invalidate the sssd cache when adding/removing content.
---
 fai/config/files/usr/local/sbin/add2gosa/GOSA      |  9 +++---
 .../files/usr/local/sbin/debian-lan/SERVER_A       |  9 +++---
 fai/config/files/usr/local/sbin/gosa-create/GOSA   | 35 +++++++++++-----------
 fai/config/package_config/SERVER_A                 |  3 ++
 4 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/fai/config/files/usr/local/sbin/add2gosa/GOSA b/fai/config/files/usr/local/sbin/add2gosa/GOSA
index 5256778..a84556f 100755
--- a/fai/config/files/usr/local/sbin/add2gosa/GOSA
+++ b/fai/config/files/usr/local/sbin/add2gosa/GOSA
@@ -7,12 +7,13 @@ set -e
 
 umask 0022
 
-sync_nscd(){
+sync_ns_cache(){
+    ## Clear tables to have database up to date:
     if pidof nscd 1>&2 > /dev/null ; then
-        ## Clear tables to have database up to date:
         nscd -i passwd
         nscd -i group
     fi
+    sss_cache -U -G
 }
 
 mk_uname() {
@@ -25,7 +26,7 @@ mk_uname() {
     # Check if username is not yet in use:
     N=3
     UNAME=${FNAME::$N}${GNAME::$N}
-    sync_nscd
+    sync_ns_cache
     while getent passwd $UNAME > /dev/null || getent group $UNAME > /dev/null; do
         N=$(($N+1))
         if [ $N -gt 5 ] ; then
@@ -206,7 +207,7 @@ else
 fi
 
 
-sync_nscd
+sync_ns_cache
 # Test if dn exists:
 _ldapsearch "$SUFFIX" "(objectClass=organizationalUnit)" "dn" \
     | grep -q "$SUFFIX" || end_die "No Department '$SUFFIX' found.  Create it in GOsa first."
diff --git a/fai/config/files/usr/local/sbin/debian-lan/SERVER_A b/fai/config/files/usr/local/sbin/debian-lan/SERVER_A
index 4a5c2e4..0ff388f 100755
--- a/fai/config/files/usr/local/sbin/debian-lan/SERVER_A
+++ b/fai/config/files/usr/local/sbin/debian-lan/SERVER_A
@@ -45,12 +45,13 @@ usage(){
     exit 1
 }
 
-sync_nscd(){
+sync_ns_cache(){
+    ## Clear tables to have database up to date:
     if pidof nscd 1>&2 > /dev/null ; then
-        ## Clear tables to have database up to date:
         nscd -i passwd
         nscd -i group
     fi
+    sss_cache -U -G
 }
 
 adduserLDAP(){
@@ -152,7 +153,7 @@ shift
 
 case $COMMAND in
     adduser)
-        sync_nscd
+        sync_ns_cache
         if [ -r $1 ] ; then
             ## We have a file, one user per line.
             chmod 600 $1
@@ -190,7 +191,7 @@ case $COMMAND in
         fi
         ;;
     deluser)
-        sync_nscd
+        sync_ns_cache
         if [ -r $1 ] ; then
             ## We have a file, one user per line.
             IFS=$'\n'
diff --git a/fai/config/files/usr/local/sbin/gosa-create/GOSA b/fai/config/files/usr/local/sbin/gosa-create/GOSA
index 1af8107..0468135 100755
--- a/fai/config/files/usr/local/sbin/gosa-create/GOSA
+++ b/fai/config/files/usr/local/sbin/gosa-create/GOSA
@@ -25,23 +25,24 @@ ldapsearch -b "ou=gosa,dc=intern" -xLLL "(&(uid=$USERID)(objectClass=posixAccoun
     cn homeDirectory gidNumber 2>/dev/null | perl -p0e 's/\n //g' | \
 while read KEY VALUE ; do
     case "$KEY" in
-	dn:) USERNAME= ; HOMEDIR= ; GROUPID= ; USERDN="dn=$VALUE" ;;
-	cn:) USERNAME="$VALUE" ;;
-	homeDirectory:) HOMEDIR="$VALUE" ;;
-	gidNumber:) GROUPID="$VALUE"  ;;
-	"")
-	    test "$HOMEDIR" || continue
-	    echo "$HOMEDIR" | grep -q "^$PREFIX/$HOSTNAME" || continue
-	    test -e "$HOMEDIR" && continue
-	    cp -r /etc/skel $HOMEDIR
-	    if type nscd > /dev/null 2>&1 ; then
-		nscd -i passwd
-		nscd -i group
-	    fi
-	    chown -R $USERID:$GROUPID $HOMEDIR
-	    chmod $DIR_MODE $HOMEDIR
-	    kadmin.local -q "add_principal -randkey -x $USERDN $USERID"
-	    logger -t gosa-create -p notice Home directory \'$HOMEDIR\' and principal \'$USERID\' created.
+        dn:) USERNAME= ; HOMEDIR= ; GROUPID= ; USERDN="dn=$VALUE" ;;
+        cn:) USERNAME="$VALUE" ;;
+        homeDirectory:) HOMEDIR="$VALUE" ;;
+        gidNumber:) GROUPID="$VALUE"  ;;
+        "")
+            test "$HOMEDIR" || continue
+            echo "$HOMEDIR" | grep -q "^$PREFIX/$HOSTNAME" || continue
+            test -e "$HOMEDIR" && continue
+            cp -r /etc/skel $HOMEDIR
+            if type nscd > /dev/null 2>&1 ; then
+                nscd -i passwd
+                nscd -i group
+            fi
+            sss_cache -U -G
+            chown -R $USERID:$GROUPID $HOMEDIR
+            chmod $DIR_MODE $HOMEDIR
+            kadmin.local -q "add_principal -randkey -x $USERDN $USERID"
+            logger -t gosa-create -p notice Home directory \'$HOMEDIR\' and principal \'$USERID\' created.
 ## send a welcome-email:
             cat << EOF | /usr/lib/sendmail $USERID
 Subject: Welcome to the mail-system
diff --git a/fai/config/package_config/SERVER_A b/fai/config/package_config/SERVER_A
index 20afa68..3ee53f3 100644
--- a/fai/config/package_config/SERVER_A
+++ b/fai/config/package_config/SERVER_A
@@ -13,5 +13,8 @@ avahi-daemon
 dirvish
 #apt-clone
 
+## to invalidate cache:
+sssd-tools
+
 PACKAGES aptitude KERBEROS_KDC
 krb5-kdc-ldap

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/debian-lan.git



More information about the debian-lan-devel mailing list