mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
feat: Introduce ENABLE_AMAVIS env (#1866)
* Introduce ENABLE_AMAVIS env * missing 'fi' added * documentation added * add condition for amavis fix function * Fix spelling Co-authored-by: William Desportes <williamdes@wdes.fr> * Fix spelling Co-authored-by: William Desportes <williamdes@wdes.fr> Co-authored-by: William Desportes <williamdes@wdes.fr> Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
This commit is contained in:
parent
666de3e2ec
commit
dd0b399f33
|
@ -27,6 +27,13 @@ Here you can adjust the [log-level for Supervisor](http://supervisord.org/loggin
|
|||
|
||||
The log-level will show everything in its class and above.
|
||||
|
||||
##### ENABLE_AMAVIS
|
||||
|
||||
Amavis content filter (used for ClamAV & SpamAssassin)
|
||||
|
||||
- 0 => Amavis is disabled
|
||||
- **1** => Amavis is enabled
|
||||
|
||||
##### ENABLE_CLAMAV
|
||||
|
||||
- **0** => Clamav is disabled
|
||||
|
|
|
@ -64,6 +64,11 @@ ENABLE_SRS=0
|
|||
ENABLE_POP3=
|
||||
ENABLE_CLAMAV=0
|
||||
|
||||
# Amavis content filter (used for ClamAV & SpamAssassin)
|
||||
# 0 => Disabled
|
||||
# 1 => Enabled
|
||||
ENABLE_AMAVIS=1
|
||||
|
||||
# If you enable Fail2Ban, don't forget to add the following lines to your `docker-compose.yml`:
|
||||
# cap_add:
|
||||
# - NET_ADMIN
|
||||
|
|
|
@ -20,6 +20,7 @@ VARS[DEFAULT_RELAY_HOST]="${DEFAULT_RELAY_HOST:=}"
|
|||
VARS[DMS_DEBUG]="${DMS_DEBUG:=0}"
|
||||
VARS[DOVECOT_MAILBOX_FORMAT]="${DOVECOT_MAILBOX_FORMAT:=maildir}"
|
||||
VARS[DOVECOT_TLS]="${DOVECOT_TLS:=no}"
|
||||
VARS[ENABLE_AMAVIS]="${ENABLE_AMAVIS:=1}"
|
||||
VARS[ENABLE_CLAMAV]="${ENABLE_CLAMAV:=0}"
|
||||
VARS[ENABLE_FAIL2BAN]="${ENABLE_FAIL2BAN:=0}"
|
||||
VARS[ENABLE_FETCHMAIL]="${ENABLE_FETCHMAIL:=0}"
|
||||
|
@ -149,7 +150,7 @@ function register_functions
|
|||
# ? >> Fixes
|
||||
|
||||
_register_fix_function '_fix_var_mail_permissions'
|
||||
_register_fix_function '_fix_var_amavis_permissions'
|
||||
[[ ${ENABLE_AMAVIS} -eq 1 ]] && _register_fix_function '_fix_var_amavis_permissions'
|
||||
|
||||
[[ ${ENABLE_CLAMAV} -eq 0 ]] && _register_fix_function '_fix_cleanup_clamav'
|
||||
[[ ${ENABLE_SPAMASSASSIN} -eq 0 ]] && _register_fix_function '_fix_cleanup_spamassassin'
|
||||
|
@ -180,8 +181,7 @@ function register_functions
|
|||
[[ ${ENABLE_FETCHMAIL} -eq 1 ]] && _register_start_daemon '_start_daemons_fetchmail'
|
||||
[[ ${ENABLE_CLAMAV} -eq 1 ]] && _register_start_daemon '_start_daemons_clamav'
|
||||
[[ ${ENABLE_LDAP} -eq 0 ]] && _register_start_daemon '_start_changedetector'
|
||||
|
||||
_register_start_daemon '_start_daemons_amavis'
|
||||
[[ ${ENABLE_AMAVIS} -eq 1 ]] && _register_start_daemon '_start_daemons_amavis'
|
||||
}
|
||||
|
||||
function _register_start_daemon
|
||||
|
|
|
@ -128,10 +128,16 @@ function _setup_mailname
|
|||
|
||||
function _setup_amavis
|
||||
{
|
||||
_notify 'task' 'Setting up Amavis'
|
||||
sed -i \
|
||||
"s|^#\$myhostname = \"mail.example.com\";|\$myhostname = \"${HOSTNAME}\";|" \
|
||||
/etc/amavis/conf.d/05-node_id
|
||||
if [[ ${ENABLE_AMAVIS} -eq 1 ]]
|
||||
then
|
||||
_notify 'task' 'Setting up Amavis'
|
||||
sed -i \
|
||||
"s|^#\$myhostname = \"mail.example.com\";|\$myhostname = \"${HOSTNAME}\";|" \
|
||||
/etc/amavis/conf.d/05-node_id
|
||||
else
|
||||
_notify 'task' 'Remove Amavis from postfix configuration'
|
||||
sed -i 's|content_filter =.*|content_filter =|' /etc/postfix/main.cf
|
||||
fi
|
||||
}
|
||||
|
||||
function _setup_dmarc_hostname
|
||||
|
@ -1475,10 +1481,14 @@ function _setup_security_stack
|
|||
# fix cron.daily for spamassassin
|
||||
sed -i -e 's|invoke-rc.d spamassassin reload|/etc/init\.d/spamassassin reload|g' /etc/cron.daily/spamassassin
|
||||
|
||||
# copy user provided configuration files if provided
|
||||
if [[ -f /tmp/docker-mailserver/amavis.cf ]]
|
||||
# Amavis
|
||||
if [[ ${ENABLE_AMAVIS} -eq 1 ]]
|
||||
then
|
||||
cp /tmp/docker-mailserver/amavis.cf /etc/amavis/conf.d/50-user
|
||||
_notify 'inf' 'Amavis enabled'
|
||||
if [[ -f /tmp/docker-mailserver/amavis.cf ]]
|
||||
then
|
||||
cp /tmp/docker-mailserver/amavis.cf /etc/amavis/conf.d/50-user
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue