libnss-systemd: also let userdbd manage passwords

As of upstream commit:

https://github.com/systemd/systemd/commit/f43a19ecd6e3415e

in v249 userdbd can also synthesize shadow/gshadow records,
so add the shadow config to nsswitch.conf on installation.
This commit is contained in:
Luca Boccassi
2022-07-17 19:22:12 +01:00
parent 0f50857620
commit bf9a307cfc
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -2,8 +2,8 @@
set -e
# try to insert the systemd entry to the "passwd" and "group" lines in
# /etc/nsswitch.conf to automatically enable libnss-systemd support; do not
# try to insert the systemd entry to the "passwd", "group", "shadow" and "gshadow"
# lines in /etc/nsswitch.conf to automatically enable libnss-systemd support; do not
# change the configuration if the lines already contain "systemd"
insert_nss_entry() {
echo "Checking NSS setup..."
@@ -27,6 +27,8 @@ insert_nss_entry() {
}
s/^(passwd:\s+)(.*)/$1.insert($2)/e;
s/^(group:\s+)(.*)/$1.insert($2)/e;
s/^(shadow:\s+)(.*)/$1.insert($2)/e;
s/^(gshadow:\s+)(.*)/$1.insert($2)/e;
' /etc/nsswitch.conf
}
+1 -1
View File
@@ -19,7 +19,7 @@ remove_nss_entry() {
return
fi
# we must remove possible [foo=bar] options as well
sed -i -r "/(passwd|group):/ s/[[:space:]]+$module\b([[:space:]]*\[[^]]*\])*//" $file
sed -i -r "/(passwd|group|shadow|gshadow):/ s/[[:space:]]+$module\b([[:space:]]*\[[^]]*\])*//" $file
}
if [ "$1" = remove ]; then