Password package update

This commit is contained in:
2025-04-27 15:25:54 -05:00
parent 6864492ce4
commit a14dfd6562
5 changed files with 36 additions and 8 deletions

View File

@@ -9,10 +9,19 @@ function getLDAPAttr() {
ldapsearch -x "${filter}" "${attribute}" | grep -E "^${attribute}: " | sed "s/${attribute}: //"
}
# Clear cleanup files
ldif="/root/cleanup.ldif"
>"${ldif}"
bash="/root/cleanup.bash"
if [ "$1" == "-h" ]; then
cat <<EOM
Usage: $0
Add -m to mute the use of ravensend.
Writes ${ldif} and ${bash} for follow-up by admins.
EOM
exit 0
fi
# Clear cleanup files
>"${ldif}"
echo "#!/bin/bash" > "${bash}"
# Attributes
@@ -84,12 +93,12 @@ fi
# Report when users are expiring -- give them several notices to fix it.
if [ -n "${EXPIRING}" ]; then
echo "EXPIRING: ${EXPIRING}"
ravensend -c "#tech" -m "The following users are expiring: ${EXPIRING}"
if [ "$1" != '-m' ]; then ravensend -c "#tech" -m "The following users are expiring: ${EXPIRING}"; fi
fi
# Report users that have expired. These users should be contacted or removed.
if [ -n "${EXPIRED}" ]; then
echo "EXPIRED: ${EXPIRED}"
echo "Expired users can be cleaned up with ${ldif} and ${bash}"
ravensend -c "#sharingan" -m 'Users have expired and need attention.'
echo "Expired users can be cleaned up with ${ldif} and ${bash}. Run /usr/bin/pwck and /usr/bin/grpck afterwards."
if [ $1 != '-m' ]; then ravensend -c "#sharingan" -m 'The following users have expired and need attention.'; fi
fi