From e935323b2f743e20ebae0dfd79db00a34f594c0b Mon Sep 17 00:00:00 2001 From: aliriza Date: Thu, 13 Apr 2023 12:32:26 +0000 Subject: [PATCH] system-auth.d --- sys/apps/shadow/shadow.sysconf | 12 +++++++++++- sys/apps/shadow/ympbuild | 2 +- sys/auth/elogind/ympbuild | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/apps/shadow/shadow.sysconf b/sys/apps/shadow/shadow.sysconf index 68b058c2..0463cd76 100644 --- a/sys/apps/shadow/shadow.sysconf +++ b/sys/apps/shadow/shadow.sysconf @@ -9,4 +9,14 @@ if [ ! -f /etc/shadow ] ; then chown root /etc/shadow chgrp root /etc/shadow fi - +current=$(date +%s -r /etc/pam.d/system-auth.d/) +last=$(cat /var/lib/ymp/sysconf/shadow/update.date 2>/dev/null) +if [ "$current" != "$last" ] ; then + echo "# Automatically generated file. Do not edit."> /etc/pam.d/system-auth + for file in $(ls /etc/pam.d/system-auth.d/ | sort) ; do + echo "### CONFIG: $file" + cat /etc/pam.d/system-auth.d/$file | sed "s/#.*//g" + echo + done | sed "/^ *$/d" >> /etc/pam.d/system-auth + date +%s -r /etc/pam.d/system-auth.d/ > /var/lib/ymp/sysconf/shadow/update.date +fi diff --git a/sys/apps/shadow/ympbuild b/sys/apps/shadow/ympbuild index 384e3ef8..1d7868e3 100644 --- a/sys/apps/shadow/ympbuild +++ b/sys/apps/shadow/ympbuild @@ -47,7 +47,7 @@ build(){ package(){ make install $jobs install -vDm 600 ../useradd.defaults "${DESTDIR}/etc/default/useradd" - install -vDm 600 ../system-auth "${DESTDIR}/etc/pam.d/system-auth" + install -vDm 600 ../system-auth "${DESTDIR}/etc/pam.d/system-auth.d/50-shadow" install -vDm 755 ../shadow.sysconf ${DESTDIR}/etc/sysconf.d/shadow } diff --git a/sys/auth/elogind/ympbuild b/sys/auth/elogind/ympbuild index a1e0456b..48800cf4 100644 --- a/sys/auth/elogind/ympbuild +++ b/sys/auth/elogind/ympbuild @@ -69,5 +69,9 @@ package(){ # openrc service mkdir -p "${DESTDIR}"/etc/init.d install ../elogind.initd "${DESTDIR}"/etc/init.d/elogind + + # shadow system-auth.d file + mkdir -p "${DESTDIR}"/etc/pam.d/system-auth.d/ + echo "session include elogind-user" > "${DESTDIR}"/etc/pam.d/system-auth.d/99-elogind }