mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2026-11-20 23:43:26 +03:00
Add Dovecot 2.4-oriented documentation for PostfixAdmin installations. The new document covers: - baseline Dovecot 2.4 SQL passdb/userdb configuration - temporary weak password scheme compatibility for old MD5/MD5-CRYPT hashes - optional post-login password migration to ARGON2ID - optional per-user Maildir to mdbox migration using a local mail_format field - quota warning delivery to the user's INBOX - optional IMAPSieve/Rspamd spam and ham learning hooks - security notes for userdb_plain_pass and verbose password logging It also adds sanitized example files under DOCUMENTS/examples and references the new Dovecot 2.4 document from the existing DOVECOT and HASHING docs. Thanks @TrapoSAMA
69 lines
1.6 KiB
Bash
69 lines
1.6 KiB
Bash
#!/bin/sh
|
|
|
|
# Dovecot quota warning delivery helper.
|
|
#
|
|
# Called by Dovecot quota warnings, for example:
|
|
# execute quota-warning {
|
|
# args = 95 %{user}
|
|
# }
|
|
#
|
|
# It delivers a local warning message directly to the user's INBOX using
|
|
# doveadm. Review sender address, support text and local doveadm permissions.
|
|
|
|
set -u
|
|
|
|
PERCENT=${1:-}
|
|
USER=${2:-}
|
|
DOVEADM=${DOVEADM:-/usr/bin/doveadm}
|
|
FROM_ADDRESS=${FROM_ADDRESS:-postmaster@domain.com}
|
|
SERVER_NAME=${SERVER_NAME:-mail.domain.com}
|
|
SUPPORT_SIGNATURE=${SUPPORT_SIGNATURE:-Mail Support}
|
|
|
|
if [ -z "$PERCENT" ] || [ -z "$USER" ]; then
|
|
echo "Usage: $0 <percent|below> <user@example.com>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
case "$PERCENT" in
|
|
below|[0-9]|[0-9][0-9]|100) ;;
|
|
*)
|
|
echo "ERROR: unsafe quota percentage argument: $PERCENT" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
case "$USER" in
|
|
*@*.*) ;;
|
|
*)
|
|
echo "ERROR: unsafe user argument: $USER" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
if [ "$PERCENT" = "below" ]; then
|
|
SUBJECT="Storage alert: your mailbox is below the quota limit"
|
|
STATUS_TEXT="Your mailbox is now below the configured quota limit."
|
|
else
|
|
SUBJECT="Storage alert: your mailbox is at ${PERCENT}% capacity"
|
|
STATUS_TEXT="Your mailbox (${USER}) has reached ${PERCENT}% of its assigned storage."
|
|
fi
|
|
|
|
cat <<EOF | "$DOVEADM" -f utf-8 submaster deliver -u "$USER" -m INBOX
|
|
From: ${FROM_ADDRESS}
|
|
To: ${USER}
|
|
Subject: ${SUBJECT}
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Hello,
|
|
|
|
This is an automatic message from ${SERVER_NAME}.
|
|
${STATUS_TEXT}
|
|
|
|
If the mailbox reaches 100%, it may stop receiving new messages.
|
|
|
|
Please delete old messages or request a quota increase if needed.
|
|
|
|
Regards,
|
|
${SUPPORT_SIGNATURE}
|
|
EOF
|