[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] update-cert-dbs: Check user existence.
Dominik George
gitlab at salsa.debian.org
Sat Jan 12 22:25:08 GMT 2019
Dominik George pushed to branch master at Debian Edu / debian-edu-config
Commits:
d50de951 by Dominik George at 2019-01-11T13:24:04Z
update-cert-dbs: Check user existence.
Also do not parse ls [1], and use $BASE_HOME consequently.
[1] https://mywiki.wooledge.org/ParsingLs
- - - - -
1 changed file:
- share/debian-edu-config/tools/update-cert-dbs
Changes:
=====================================
share/debian-edu-config/tools/update-cert-dbs
=====================================
@@ -6,17 +6,24 @@
set -e
BASE_HOME=/skole/tjener/home0
-for i in $(ls /skole/tjener/home0/ | grep -v lost+found) ; do
- if [ -d $BASE_HOME/$i/.mozilla/firefox/debian-edu.default ] ; then
- su - $i sh -c 'certutil -A -d sql:$HOME/.mozilla/firefox/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
- su - $i sh -c 'certutil -A -d dbm:$HOME/.mozilla/firefox/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
+for dir in "$BASE_HOME"/*; do
+ # Skip if not a directory
+ test -d "$dir" || continue
+
+ # Extract username and check existence
+ username=${dir##*/}
+ id "$username" || continue
+
+ if [ -d "$dir/.mozilla/firefox/debian-edu.default" ] ; then
+ su - $username sh -c 'certutil -A -d sql:$HOME/.mozilla/firefox/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
+ su - $username sh -c 'certutil -A -d dbm:$HOME/.mozilla/firefox/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
fi
- if [ -d $BASE_HOME/$i/.thunderbird/debian-edu.default ] ; then
- su - $i sh -c 'certutil -A -d sql:$HOME/.thunderbird/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
- su - $i sh -c 'certutil -A -d dbm:$HOME/.thunderbird/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
+ if [ -d "$dir/.thunderbird/debian-edu.default" ] ; then
+ su - $username sh -c 'certutil -A -d sql:$HOME/.thunderbird/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
+ su - $username sh -c 'certutil -A -d dbm:$HOME/.thunderbird/debian-edu.default/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
fi
- if [ -d $BASE_HOME/$i/.pki/nssdb ] ; then
- su - $i sh -c 'certutil -A -d sql:$HOME/.pki/nssdb/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
+ if [ -d "$dir/.pki/nssdb" ] ; then
+ su - $username sh -c 'certutil -A -d sql:$HOME/.pki/nssdb/ -t "CT,CT," -n "DebianEdu" -i /etc/ssl/certs/Debian-Edu_rootCA.crt'
fi
logger -t update-cert-dbs "Updated nssdb files for user accounts in $BASE_HOME/."
done
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/commit/d50de951ba715e6e337525396a8938436ad6bad4
--
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/commit/d50de951ba715e6e337525396a8938436ad6bad4
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20190112/2959ab49/attachment-0001.html>
More information about the debian-edu-commits
mailing list