This commit is contained in:
Christoph 2018-10-31 03:42:46 +01:00
commit 458c5353f0
8 changed files with 383 additions and 75 deletions

2
.gitignore vendored
View File

@ -14,7 +14,7 @@ postfixadmin-*
crontab-root* crontab-root*
# - Dovecot # - Dovecot
dovecot* dovecot-*
log* log*
# - roundcube # - roundcube

View File

@ -0,0 +1,12 @@
# ----------
# - Doveadm-Index
# ----------
# - Index users INBOX:
# -
doveadm index -u <user@domain.ltd> INBOX
# - Index INBOX for ALL users
# -
doveadm index -A

View File

@ -0,0 +1,12 @@
# ----------
# - Force Dovecot to recalculate mailbox quota
# ----------
# - Recalculate one mailbox:
# -
doveadm quota recalc -u <user@domain.ltd>
# - Recalculate ALL mail accounts:
# -
doveadm quota recalc -A

View File

@ -0,0 +1,21 @@
Debian Jessie comes with systemd so you really should not use initscript anymore but
switch to systemd for starting dovecot. There is systemd service description file available
for you in case your vendor does not provide it in the package:
https://github.com/dovecot/core/blob/master/dovecot.service.in
--
> i use ./configure with
> --with-systemdsystemunitdir=/etc/systemd/system/ and that installs the
> systemd.service and socket
That's what I missed, thank you a lot. And service seems to handle
correctly restarts
Also use:
--with-rundir=/var/run/dovecot
--

123
DOC/dovecot/lmtp_notice.txt Normal file
View File

@ -0,0 +1,123 @@
- to drop cached lmtp adress verification, delete file
/var/lib/postfix/verify_cache.db
mail RCPT TO: test-help@warenform.com
=====================================
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = substring ('%u' from '#"[^-]+#"_*@%%' for '#') || '@%d' and active = true
15-lda.conf:
recipient_delimiter =
90-sieve.conf:
recipient_delimiter =
--> stored mail into mailbox 'INBOX'
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = substring ('%u' from '#"[^-]+#"_*@%%' for '#') || '@%d' and active = true
15-lda.conf:
recipient_delimiter =
90-sieve.conf:
recipient_delimiter = -
--> stored mail into mailbox 'INBOX'
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = substring ('%u' from '#"[^-]+#"_*@%%' for '#') || '@%d' and active = true
15-lda.conf:
recipient_delimiter = -
90-sieve.conf:
recipient_delimiter =
--> stored mail into mailbox 'help'
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = substring ('%u' from '#"[^-]+#"_*@%%' for '#') || '@%d' and active = true
15-lda.conf:
recipient_delimiter = -
90-sieve.conf:
recipient_delimiter = -
--> stored mail into mailbox 'help'
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = '%u' and active = true
15-lda.conf:
recipient_delimiter =
90-sieve.conf:
recipient_delimiter =
--> 550 5.1.1 <test-help@warenform.com> User doesn't exist: ...
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = '%u' and active = true
15-lda.conf:
recipient_delimiter =
90-sieve.conf:
recipient_delimiter = -
--> 550 5.1.1 <test-help@warenform.com> User doesn't exist: ...
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = '%u' and active = true
15-lda.conf:
recipient_delimiter = -
90-sieve.conf:
recipient_delimiter =
--> stored mail into mailbox 'help'
no "Error:" in dovecot.log
configuration:
sql-connect.conf.ext :
user_query = SELECT.. WHERE username = '%u' and active = true
15-lda.conf:
recipient_delimiter = -
90-sieve.conf:
recipient_delimiter = -
--> stored mail into mailbox 'help'
no "Error:" in dovecot.log

View File

@ -1,7 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
_QUARANTINE_ADMIN='postmaster\@$mydomain'
QUARANTINE_ADMIN=$_QUARANTINE_ADMIN script_dir="$(realpath $(dirname $0))"
script_name="$(basename "$0")"
conf_file="${script_dir}/conf/install_amavis.conf"
backup_date="$(date +%Y-%m-%d-%H%M)"
crontab_backup_file="${script_dir}/crontab-root-${backup_date}.install_amavis.lst"
# ------------- # -------------
@ -90,6 +96,29 @@ detect_os_1 () {
} }
# -------------
# --- Some default settings
# -------------
DEFAULT_QUARANTINE_DIR="/var/QUARANTINE"
DEFAULT_QUARANTINE_ADMIN='postmaster\@$mydomain'
DEFAULT_DB_IN_USE=false
DEFAULT_INSTALL_CLAMAV_UNOFFICIAL_SIGS=true
DEFAULT_MALWARE_PATROL_IN_USE=true
DEFAULT_MALWERE_PATROL_FREE=false
DEFAULT_MP_RECEIPT_NUMBER=106015125438
DEFAULT_SECURITE_INFO_IN_USE=true
DEFAULT_SI_AUTHORISATION_SIGNATURE_WF=76ed7ca6670dbee497e1a0397a7e178c4caa25888bc26d7327d1eab0195342a4cfa522dcf10382623d57dbc2a79bd37627b9a52def4d4bfe617d26e35405ce3b
DEFAULT_SI_AUTHORISATION_SIGNATURE_OOPEN=b0b7e94d3fcc8f3b1f128edd5830392361868cf0174723a9924ac25bf8b1b588cb974b50234e1bc1d9839dfe0ca6e1627733d90daf1399347b1046d20c2e3a89
# - This parameter will be not asked, so setting it here
# -
QUARANTINE_ADMIN=$DEFAULT_QUARANTINE_ADMIN
# - Is this a systemd system? # - Is this a systemd system?
# - # -
if [[ "X`which systemd`" = "X" ]]; then if [[ "X`which systemd`" = "X" ]]; then
@ -107,60 +136,34 @@ detect_os_1
echo "" echo ""
script_dir="$(realpath $(dirname $0))"
conf_file="${script_dir}/conf/install_amavis.conf"
backup_date="$(date +%Y-%m-%d-%H%M)"
crontab_backup_file="${script_dir}/crontab-root-${backup_date}.install_amavis.lst"
if [[ -f "$conf_file" ]]; then if [[ -f "$conf_file" ]]; then
source $conf_file source $conf_file
fi fi
#clear
#echo ""
#echo -e "\033[32m--\033[m" # -------------
#echo "" # --- Set default values for some non existent variables (i.e. no configuration file is present)
#echononl "Run with Install Script with previous settings (yes/no): " # -------------
#read OK
#OK=${OK,,} if [[ -z "$_HOSTNAME" ]] ; then
#if [[ "X$OK" = "X" ]] ; then _HOSTNAME="$(hostname -f)"
# OK=yes _HOSTNAME_SHORT="$(hostname)"
#fi [[ "$_HOSTNAME" = "$_HOSTNAME_SHORT" ]] && _HOSTNAME=""
#while [ "X$OK" != "Xyes" -a "X$OK" != "Xno" ]; do fi
# echononl "Wrong entry! [yes/no]: "
# read OK
# OK=${OK,,} [[ -z "$_QUARANTINE_DIR" ]] && _QUARANTINE_DIR="$DEFAULT_QUARANTINE_DIR"
#done
#[[ $OK = yes ]] && skip_interactive_use=true [[ -z "$_DB_IN_USE" ]] && _DB_IN_USE=$DEFAULT_DB_IN_USE
#
#if $skip_interactive_use ; then [[ -z "$_INSTALL_CLAMAV_UNOFFICIAL_SIGS" ]] && _INSTALL_CLAMAV_UNOFFICIAL_SIGS=$DEFAULT_INSTALL_CLAMAV_UNOFFICIAL_SIGS
#
#HOSTNAME=$_HOSTNAME [[ -z "$_MALWARE_PATROL_IN_USE" ]] && _MALWARE_PATROL_IN_USE=$DEFAULT_MALWARE_PATROL_IN_USE
#IPV4=$_IPV4 [[ -z "$_MALWERE_PATROL_FREE" ]] && _MALWERE_PATROL_FREE=$DEFAULT_MALWERE_PATROL_FREE
#IPV6=$_IPV6
# [[ -z "$_SECURITE_INFO_IN_USE" ]] && _SECURITE_INFO_IN_USE=$DEFAULT_SECURITE_INFO_IN_USE
#QUARANTINE_DIR=$_QUARANTINE_DIR
#QUARANTINE_ADMIN=$_QUARANTINE_ADMIN
#
#DB_IN_USE=$_DB_IN_USE
#DB_TYPE=$_DB_TYPE
#DB_HOST=$_DB_HOST
#DB_NAME=$_DB_NAME
#DB_USER=$_DB_USER
#DB_PASS=$_DB_PASS
#INSTALL_CLAMAV_UNOFFICIAL_SIGS=$_INSTALL_CLAMAV_UNOFFICIAL_SIGS
#MALWARE_PATROL_IN_USE=$_MALWARE_PATROL_IN_USE
#MALWERE_PATROL_FREE=$_MALWERE_PATROL_FREE
#MP_RECEIPT_NUMBER=$_MP_RECEIPT_NUMBER
#SECURITE_INFO_IN_USE=$_SECURITE_INFO_IN_USE
#SI_AUTHORISATION_SIGNATURE=$_SI_AUTHORISATION_SIGNATURE
#
#else
#clear
#echo -e "\033[21G\033[32mInstallation script for AMaViS, Spamassassin and ClamAV\033[m"
#echo
clear clear
echo -e "\033[21G\033[32mInstallation script for AMaViS, Spamassassin and ClamAV\033[m" echo -e "\033[21G\033[32mInstallation script for AMaViS, Spamassassin and ClamAV\033[m"
@ -190,6 +193,36 @@ else
fi fi
# -------------
# --- Some further default values depending on Hostname
# -------------
# - Set default values for ipv4- and ipv6-address
# -
if [[ -z $_IPV4 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV4="$(dig +short "$_HOSTNAME" A)"
fi
if [[ -z $_IPV6 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV6="$(dig +short "$_HOSTNAME" AAAA)"
fi
# - Set defaul value for securite signature
# -
if [[ -z "$_SI_AUTHORISATION_SIGNATURE" ]]; then
[[ "$HOSTNAME" =~ warenform.de$ ]] && _SI_AUTHORISATION_SIGNATURE=$DEFAULT_SI_AUTHORISATION_SIGNATURE_WF
# - For all this take O.OPEN's Signature
# -
[[ "$HOSTNAME" =~ oopen.de$ ]] && _SI_AUTHORISATION_SIGNATURE=$DEFAULT_SI_AUTHORISATION_SIGNATURE_OOPEN
[[ "$HOSTNAME" =~ cadus.org$ ]] && _SI_AUTHORISATION_SIGNATURE=$DEFAULT_SI_AUTHORISATION_SIGNATURE_OOPEN
[[ "$HOSTNAME" =~ so36.net$ ]] && _SI_AUTHORISATION_SIGNATURE=$DEFAULT_SI_AUTHORISATION_SIGNATURE_OOPEN
[[ "$HOSTNAME" =~ interventionistische-linke.org$ ]] && _SI_AUTHORISATION_SIGNATURE=$DEFAULT_SI_AUTHORISATION_SIGNATURE_OOPEN
fi
IPV4= IPV4=
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
@ -404,6 +437,11 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
MALWERE_PATROL_FREE=false MALWERE_PATROL_FREE=false
fi fi
# - Set default Value for Malware Patrol serial number (if non free account in use)
# -
if ! $MALWERE_PATROL_FREE ; then
[[ -z "$_MP_RECEIPT_NUMBER" ]] && _MP_RECEIPT_NUMBER="$DEFAULT_MP_RECEIPT_NUMBER"
fi
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
@ -730,7 +768,7 @@ echo ""
echononl " Save Configuration" echononl " Save Configuration"
cat << EOF > $conf_file cat << EOF > $conf_file
# --- # ---
# - Parametersettins postfix bases system # - Parametersettings for installscript $script_name
# --- # ---
_HOSTNAME=$HOSTNAME _HOSTNAME=$HOSTNAME
@ -748,11 +786,31 @@ _DB_USER=$DB_USER
_DB_PASS=$DB_PASS _DB_PASS=$DB_PASS
_INSTALL_CLAMAV_UNOFFICIAL_SIGS=$INSTALL_CLAMAV_UNOFFICIAL_SIGS _INSTALL_CLAMAV_UNOFFICIAL_SIGS=$INSTALL_CLAMAV_UNOFFICIAL_SIGS
_MALWARE_PATROL_IN_USE=$MALWARE_PATROL_IN_USE _MALWARE_PATROL_IN_USE=$MALWARE_PATROL_IN_USE
EOF
if $MALWARE_PATROL_IN_USE ; then
cat << EOF >> $conf_file
_MALWERE_PATROL_FREE=$MALWERE_PATROL_FREE _MALWERE_PATROL_FREE=$MALWERE_PATROL_FREE
_MP_RECEIPT_NUMBER=$MP_RECEIPT_NUMBER _MP_RECEIPT_NUMBER=$MP_RECEIPT_NUMBER
EOF
else
cat << EOF >> $conf_file
_MALWERE_PATROL_FREE=
_MP_RECEIPT_NUMBER=
EOF
fi
if $SECURITE_INFO_IN_USE ; then
cat << EOF >> $conf_file
_SECURITE_INFO_IN_USE=$SECURITE_INFO_IN_USE _SECURITE_INFO_IN_USE=$SECURITE_INFO_IN_USE
_SI_AUTHORISATION_SIGNATURE=$SI_AUTHORISATION_SIGNATURE _SI_AUTHORISATION_SIGNATURE=$SI_AUTHORISATION_SIGNATURE
EOF EOF
else
cat << EOF >> $conf_file
_SECURITE_INFO_IN_USE=$SECURITE_INFO_IN_USE
_SI_AUTHORISATION_SIGNATURE=
EOF
fi
if [[ $? -eq 0 ]] ; then if [[ $? -eq 0 ]] ; then
echo_ok echo_ok
else else

View File

@ -82,6 +82,13 @@ echo_skipped() {
trap clean_up SIGHUP SIGINT SIGTERM trap clean_up SIGHUP SIGINT SIGTERM
# -------------
# --- Some default settings
# -------------
DEFAULT_ADMIN_EMAIL="argus@oopen.de"
# - Is this a systemd system? # - Is this a systemd system?
# - # -
if [[ "X`which systemd`" = "X" ]]; then if [[ "X`which systemd`" = "X" ]]; then
@ -102,6 +109,21 @@ if [[ -f "$conf_file" ]]; then
source $conf_file source $conf_file
fi fi
[[ -z "$_ADMIN_EMAIL" ]] && _ADMIN_EMAIL="$DEFAULT_ADMIN_EMAIL"
# -------------
# --- Set default values for some non existent variables (i.e. no configuration file is present)
# -------------
if [[ -z "$_HOSTNAME" ]] ; then
_HOSTNAME="$(hostname -f)"
_HOSTNAME_SHORT="$(hostname)"
[[ "$_HOSTNAME" = "$_HOSTNAME_SHORT" ]] && _HOSTNAME=""
fi
clear clear
echo -e "\033[21G\033[32mInstallation script for Postfix basic mailsystem \033[m" echo -e "\033[21G\033[32mInstallation script for Postfix basic mailsystem \033[m"
echo echo
@ -128,6 +150,22 @@ else
done done
fi fi
# -------------
# --- Some further default values depending on Hostname
# -------------
# - Set default values for ipv4- and ipv6-address
# -
if [[ -z $_IPV4 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV4="$(dig +short "$_HOSTNAME" A)"
fi
if [[ -z $_IPV6 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV6="$(dig +short "$_HOSTNAME" AAAA)"
fi
IPV4= IPV4=
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"

View File

@ -1,27 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
script_dir="$(dirname $(realpath $0))"
script_name="$(basename "$0")"
conf_dir=$(dirname $0)/conf
conf_file="${conf_dir}/install_postfix_base.conf"
_TLS_CERT_DIR=/etc/postfix/ssl _TLS_CERT_DIR=/etc/postfix/ssl
_TLS_CERT_FILE="${_TLS_CERT_DIR}/mailserver.crt" _TLS_CERT_FILE="${_TLS_CERT_DIR}/mailserver.crt"
_TLS_KEY_FILE="${_TLS_CERT_DIR}/mailserver.key" _TLS_KEY_FILE="${_TLS_CERT_DIR}/mailserver.key"
#
_TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt _TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt
#
#
#_HOSTNAME=o15.oopen.de
#_IPV4=83.223.86.96
#_EXT_IF_IP=83.223.86.96
#
### - Leave empty, if no IPv6 should be supported
### -
#_IPV6=2a01:30:0:13:5054:ff:fe09:2318
##_IPV6=
#
#_ADMIN_EMAIL=admin@oopen.de
#
#_SASL_AUTH=false
#_RELAY_HOST=b.mx.oopen.de
#_SASL_USER=anw-urb
#_SASL_PASS='OhPie2aethei'
# ------------- # -------------
@ -81,6 +69,15 @@ echo_skipped() {
} }
# -------------
# --- Some default settings
# -------------
DEFAULT_ADMIN_EMAIL="argus@oopen.de"
DEFAULT_RELAY_HOST="b.mx.oopen.de"
DEFAULT_SASL_AUTH=false
# - Is this a systemd system? # - Is this a systemd system?
# - # -
if [[ "X`which systemd`" = "X" ]]; then if [[ "X`which systemd`" = "X" ]]; then
@ -91,13 +88,27 @@ fi
echo "" echo ""
conf_dir=$(dirname $0)/conf # - Read Configuration File if exists
conf_file="${conf_dir}/install_postfix_base.conf" # -
if [[ -f "$conf_file" ]]; then if [[ -f "$conf_file" ]]; then
source $conf_file source $conf_file
fi fi
# -------------
# --- Set default values for some non existent variables (i.e. no configuration file is present)
# -------------
[[ -z "$_ADMIN_EMAIL" ]] && _ADMIN_EMAIL="$DEFAULT_ADMIN_EMAIL"
[[ -z "$_SASL_AUTH" ]] && _SASL_AUTH="$DEFAULT_SASL_AUTH"
if [[ -z "$_HOSTNAME" ]] ; then
_HOSTNAME="$(hostname -f)"
_HOSTNAME_SHORT="$(hostname)"
[[ "$_HOSTNAME" = "$_HOSTNAME_SHORT" ]] && _HOSTNAME=""
fi
clear clear
echo -e "\033[21G\033[32mInstallation script for Postfix basic mailsystem \033[m" echo -e "\033[21G\033[32mInstallation script for Postfix basic mailsystem \033[m"
echo echo
@ -124,6 +135,24 @@ else
done done
fi fi
# -------------
# --- Some further default values depending on Hostname
# -------------
# - Set default values for ipv4- and ipv6-address
# -
if [[ -z $_IPV4 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV4="$(dig +short "$_HOSTNAME" A)"
fi
if [[ -z $_IPV6 ]] && [[ -n "$_HOSTNAME" ]] && [[ -x "$(which dig)" ]]; then
_IPV6="$(dig +short "$_HOSTNAME" AAAA)"
fi
if [[ -z $_IPV6 ]]; then
_IPV6=None
fi
IPV4= IPV4=
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
@ -239,6 +268,21 @@ else
fi fi
done done
fi fi
# -------------
# --- Some further default values depending on sasl authentification
# -------------
# - Set default value for relay host if sasl authentification should be
# - supported and value for _RELAY_HOST not given
# -
if [[ "$SASL_AUTH" = "yes" ]] || $SASL_AUTH ; then
[[ -z "$_RELAY_HOST" ]] && _RELAY_HOST="$DEFAULT_RELAY_HOST"
fi
if [[ "$SASL_AUTH" = "yes" ]] || $SASL_AUTH ; then if [[ "$SASL_AUTH" = "yes" ]] || $SASL_AUTH ; then
SASL_AUTH=true SASL_AUTH=true