Add script dovecot-service-checksuspended.

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-29 17:08:54 +00:00
commit f330b6b06e
2 changed files with 24 additions and 0 deletions

23
dovecot-service-checksuspended Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Version: 0.0.1
# Copyright (c) 2023:
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
# Licensed under the terms of the GNU General Public License version 3.
#
# A Dovecot service script to check whether a domain or user has been suspended from being able to use mail.
VIRTUAL_DIR="/etc/virtual"
U="${USER%%@*}"
D="${USER#*@}"
[[ -e "$VIRTUAL_DIR/$D/suspended" ]] && {
printf "* %s\\r\\n" "NO [ALERT] Domain suspended"
exit 0
}
[[ -e "$VIRTUAL_DIR/$D/$U/suspended" ]] && {
printf "* %s\\r\\n" "NO [ALERT] User suspended"
exit 0
}
exec "$@"