mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Add ENV ENABLE_IMAP
(#3703)
This commit is contained in:
parent
bbed3f6608
commit
98a4c13ca9
|
@ -8,9 +8,12 @@ All notable changes to this project will be documented in this file. The format
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- **Dovecot:**
|
||||||
|
- ENV `ENABLE_IMAP` ([#3703](https://github.com/docker-mailserver/docker-mailserver/pull/3703))
|
||||||
- **Tests:**
|
- **Tests:**
|
||||||
- You can now use `make run-local-instance` to run a DMS image that was built locally to test changes ([#3663](https://github.com/docker-mailserver/docker-mailserver/pull/3663))
|
- You can now use `make run-local-instance` to run a DMS image that was built locally to test changes ([#3663](https://github.com/docker-mailserver/docker-mailserver/pull/3663))
|
||||||
- Log a warning when update-check is enabled, but no stable release image is used ([#3684](https://github.com/docker-mailserver/docker-mailserver/pull/3684))
|
- **Internal**:
|
||||||
|
- Log a warning when update-check is enabled, but no stable release image is used ([#3684](https://github.com/docker-mailserver/docker-mailserver/pull/3684))
|
||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
|
|
|
@ -131,9 +131,14 @@ Enabled `policyd-spf` in Postfix's configuration. You will likely want to set th
|
||||||
|
|
||||||
##### ENABLE_POP3
|
##### ENABLE_POP3
|
||||||
|
|
||||||
- **empty** => POP3 service disabled
|
- **0** => POP3 service disabled
|
||||||
- 1 => Enables POP3 service
|
- 1 => Enables POP3 service
|
||||||
|
|
||||||
|
##### ENABLE_IMAP
|
||||||
|
|
||||||
|
- 0 => Disabled
|
||||||
|
- **1** => Enabled
|
||||||
|
|
||||||
##### ENABLE_CLAMAV
|
##### ENABLE_CLAMAV
|
||||||
|
|
||||||
- **0** => ClamAV is disabled
|
- **0** => ClamAV is disabled
|
||||||
|
|
|
@ -119,10 +119,16 @@ ENABLE_OPENDMARC=1
|
||||||
# - **1** => Enabled
|
# - **1** => Enabled
|
||||||
ENABLE_POLICYD_SPF=1
|
ENABLE_POLICYD_SPF=1
|
||||||
|
|
||||||
# 1 => Enables POP3 service
|
# Enables POP3 service
|
||||||
# empty => disables POP3
|
# - **0** => Disabled
|
||||||
|
# - 1 => Enabled
|
||||||
ENABLE_POP3=
|
ENABLE_POP3=
|
||||||
|
|
||||||
|
# Enables IMAP service
|
||||||
|
# - 0 => Disabled
|
||||||
|
# - **1** => Enabled
|
||||||
|
ENABLE_IMAP=1
|
||||||
|
|
||||||
# Enables ClamAV, and anti-virus scanner.
|
# Enables ClamAV, and anti-virus scanner.
|
||||||
# 1 => Enabled
|
# 1 => Enabled
|
||||||
# **0** => Disabled
|
# **0** => Disabled
|
||||||
|
|
|
@ -6,12 +6,10 @@ function _setup_dovecot() {
|
||||||
cp -a /usr/share/dovecot/protocols.d /etc/dovecot/
|
cp -a /usr/share/dovecot/protocols.d /etc/dovecot/
|
||||||
# disable pop3 (it will be eventually enabled later in the script, if requested)
|
# disable pop3 (it will be eventually enabled later in the script, if requested)
|
||||||
mv /etc/dovecot/protocols.d/pop3d.protocol /etc/dovecot/protocols.d/pop3d.protocol.disab
|
mv /etc/dovecot/protocols.d/pop3d.protocol /etc/dovecot/protocols.d/pop3d.protocol.disab
|
||||||
|
# disable imap (it will be eventually enabled later in the script, if requested)
|
||||||
|
mv /etc/dovecot/protocols.d/imapd.protocol /etc/dovecot/protocols.d/imapd.protocol.disab
|
||||||
mv /etc/dovecot/protocols.d/managesieved.protocol /etc/dovecot/protocols.d/managesieved.protocol.disab
|
mv /etc/dovecot/protocols.d/managesieved.protocol /etc/dovecot/protocols.d/managesieved.protocol.disab
|
||||||
sed -i -e 's|#ssl = yes|ssl = yes|g' /etc/dovecot/conf.d/10-master.conf
|
sedfile -i 's|^postmaster_address = .*$|postmaster_address = '"${POSTMASTER_ADDRESS}"'|g' /etc/dovecot/conf.d/15-lda.conf
|
||||||
sed -i -e 's|#port = 993|port = 993|g' /etc/dovecot/conf.d/10-master.conf
|
|
||||||
sed -i -e 's|#port = 995|port = 995|g' /etc/dovecot/conf.d/10-master.conf
|
|
||||||
sed -i -e 's|#ssl = yes|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
|
|
||||||
sed -i 's|^postmaster_address = .*$|postmaster_address = '"${POSTMASTER_ADDRESS}"'|g' /etc/dovecot/conf.d/15-lda.conf
|
|
||||||
|
|
||||||
if ! grep -q -E '^stats_writer_socket_path=' /etc/dovecot/dovecot.conf; then
|
if ! grep -q -E '^stats_writer_socket_path=' /etc/dovecot/dovecot.conf; then
|
||||||
printf '\n%s\n' 'stats_writer_socket_path=' >>/etc/dovecot/dovecot.conf
|
printf '\n%s\n' 'stats_writer_socket_path=' >>/etc/dovecot/dovecot.conf
|
||||||
|
@ -37,9 +35,21 @@ function _setup_dovecot() {
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ ${ENABLE_POP3} -eq 1 || ${ENABLE_IMAP} -eq 1 ]]; then
|
||||||
|
sedfile -i -e 's|#ssl = yes|ssl = yes|g' /etc/dovecot/conf.d/10-master.conf
|
||||||
|
sedfile -i -e 's|#ssl = yes|ssl = required|g' /etc/dovecot/conf.d/10-ssl.conf
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${ENABLE_POP3} -eq 1 ]]; then
|
if [[ ${ENABLE_POP3} -eq 1 ]]; then
|
||||||
_log 'debug' 'Enabling POP3 services'
|
_log 'debug' 'Enabling POP3 services'
|
||||||
mv /etc/dovecot/protocols.d/pop3d.protocol.disab /etc/dovecot/protocols.d/pop3d.protocol
|
mv /etc/dovecot/protocols.d/pop3d.protocol.disab /etc/dovecot/protocols.d/pop3d.protocol
|
||||||
|
sedfile -i -e 's|#port = 995|port = 995|g' /etc/dovecot/conf.d/10-master.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${ENABLE_IMAP} -eq 1 ]]; then
|
||||||
|
_log 'debug' 'Enabling IMAP services'
|
||||||
|
mv /etc/dovecot/protocols.d/imapd.protocol.disab /etc/dovecot/protocols.d/imapd.protocol
|
||||||
|
sedfile -i -e 's|#port = 993|port = 993|g' /etc/dovecot/conf.d/10-master.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -f /tmp/docker-mailserver/dovecot.cf ]] && cp /tmp/docker-mailserver/dovecot.cf /etc/dovecot/local.conf
|
[[ -f /tmp/docker-mailserver/dovecot.cf ]] && cp /tmp/docker-mailserver/dovecot.cf /etc/dovecot/local.conf
|
||||||
|
@ -89,23 +99,23 @@ function _setup_dovecot_quota() {
|
||||||
# disable dovecot quota in docevot confs
|
# disable dovecot quota in docevot confs
|
||||||
if [[ -f /etc/dovecot/conf.d/90-quota.conf ]]; then
|
if [[ -f /etc/dovecot/conf.d/90-quota.conf ]]; then
|
||||||
mv /etc/dovecot/conf.d/90-quota.conf /etc/dovecot/conf.d/90-quota.conf.disab
|
mv /etc/dovecot/conf.d/90-quota.conf /etc/dovecot/conf.d/90-quota.conf.disab
|
||||||
sed -i \
|
sedfile -i \
|
||||||
"s|mail_plugins = \$mail_plugins quota|mail_plugins = \$mail_plugins|g" \
|
"s|mail_plugins = \$mail_plugins quota|mail_plugins = \$mail_plugins|g" \
|
||||||
/etc/dovecot/conf.d/10-mail.conf
|
/etc/dovecot/conf.d/10-mail.conf
|
||||||
sed -i \
|
sedfile -i \
|
||||||
"s|mail_plugins = \$mail_plugins imap_quota|mail_plugins = \$mail_plugins|g" \
|
"s|mail_plugins = \$mail_plugins imap_quota|mail_plugins = \$mail_plugins|g" \
|
||||||
/etc/dovecot/conf.d/20-imap.conf
|
/etc/dovecot/conf.d/20-imap.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# disable quota policy check in postfix
|
# disable quota policy check in postfix
|
||||||
sed -i "s|check_policy_service inet:localhost:65265||g" /etc/postfix/main.cf
|
sedfile -i "s|check_policy_service inet:localhost:65265||g" /etc/postfix/main.cf
|
||||||
else
|
else
|
||||||
if [[ -f /etc/dovecot/conf.d/90-quota.conf.disab ]]; then
|
if [[ -f /etc/dovecot/conf.d/90-quota.conf.disab ]]; then
|
||||||
mv /etc/dovecot/conf.d/90-quota.conf.disab /etc/dovecot/conf.d/90-quota.conf
|
mv /etc/dovecot/conf.d/90-quota.conf.disab /etc/dovecot/conf.d/90-quota.conf
|
||||||
sed -i \
|
sedfile -i \
|
||||||
"s|mail_plugins = \$mail_plugins|mail_plugins = \$mail_plugins quota|g" \
|
"s|mail_plugins = \$mail_plugins|mail_plugins = \$mail_plugins quota|g" \
|
||||||
/etc/dovecot/conf.d/10-mail.conf
|
/etc/dovecot/conf.d/10-mail.conf
|
||||||
sed -i \
|
sedfile -i \
|
||||||
"s|mail_plugins = \$mail_plugins|mail_plugins = \$mail_plugins imap_quota|g" \
|
"s|mail_plugins = \$mail_plugins|mail_plugins = \$mail_plugins imap_quota|g" \
|
||||||
/etc/dovecot/conf.d/20-imap.conf
|
/etc/dovecot/conf.d/20-imap.conf
|
||||||
fi
|
fi
|
||||||
|
@ -113,11 +123,11 @@ function _setup_dovecot_quota() {
|
||||||
local MESSAGE_SIZE_LIMIT_MB=$((POSTFIX_MESSAGE_SIZE_LIMIT / 1000000))
|
local MESSAGE_SIZE_LIMIT_MB=$((POSTFIX_MESSAGE_SIZE_LIMIT / 1000000))
|
||||||
local MAILBOX_LIMIT_MB=$((POSTFIX_MAILBOX_SIZE_LIMIT / 1000000))
|
local MAILBOX_LIMIT_MB=$((POSTFIX_MAILBOX_SIZE_LIMIT / 1000000))
|
||||||
|
|
||||||
sed -i \
|
sedfile -i \
|
||||||
"s|quota_max_mail_size =.*|quota_max_mail_size = ${MESSAGE_SIZE_LIMIT_MB}$([[ ${MESSAGE_SIZE_LIMIT_MB} -eq 0 ]] && echo "" || echo "M")|g" \
|
"s|quota_max_mail_size =.*|quota_max_mail_size = ${MESSAGE_SIZE_LIMIT_MB}$([[ ${MESSAGE_SIZE_LIMIT_MB} -eq 0 ]] && echo "" || echo "M")|g" \
|
||||||
/etc/dovecot/conf.d/90-quota.conf
|
/etc/dovecot/conf.d/90-quota.conf
|
||||||
|
|
||||||
sed -i \
|
sedfile -i \
|
||||||
"s|quota_rule = \*:storage=.*|quota_rule = *:storage=${MAILBOX_LIMIT_MB}$([[ ${MAILBOX_LIMIT_MB} -eq 0 ]] && echo "" || echo "M")|g" \
|
"s|quota_rule = \*:storage=.*|quota_rule = *:storage=${MAILBOX_LIMIT_MB}$([[ ${MAILBOX_LIMIT_MB} -eq 0 ]] && echo "" || echo "M")|g" \
|
||||||
/etc/dovecot/conf.d/90-quota.conf
|
/etc/dovecot/conf.d/90-quota.conf
|
||||||
|
|
||||||
|
@ -127,7 +137,7 @@ function _setup_dovecot_quota() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# enable quota policy check in postfix
|
# enable quota policy check in postfix
|
||||||
sed -i -E \
|
sedfile -i -E \
|
||||||
"s|(reject_unknown_recipient_domain)|\1, check_policy_service inet:localhost:65265|g" \
|
"s|(reject_unknown_recipient_domain)|\1, check_policy_service inet:localhost:65265|g" \
|
||||||
/etc/postfix/main.cf
|
/etc/postfix/main.cf
|
||||||
fi
|
fi
|
||||||
|
@ -188,5 +198,5 @@ function _setup_dovecot_dhparam() {
|
||||||
|
|
||||||
function _setup_dovecot_hostname() {
|
function _setup_dovecot_hostname() {
|
||||||
_log 'debug' 'Applying hostname to Dovecot'
|
_log 'debug' 'Applying hostname to Dovecot'
|
||||||
sed -i "s|^#hostname =.*$|hostname = '${HOSTNAME}'|g" /etc/dovecot/conf.d/15-lda.conf
|
sedfile -i "s|^#hostname =.*$|hostname = '${HOSTNAME}'|g" /etc/dovecot/conf.d/15-lda.conf
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ function __environment_variables_general_setup() {
|
||||||
VARS[ENABLE_OPENDMARC]="${ENABLE_OPENDMARC:=1}"
|
VARS[ENABLE_OPENDMARC]="${ENABLE_OPENDMARC:=1}"
|
||||||
VARS[ENABLE_POLICYD_SPF]="${ENABLE_POLICYD_SPF:=1}"
|
VARS[ENABLE_POLICYD_SPF]="${ENABLE_POLICYD_SPF:=1}"
|
||||||
VARS[ENABLE_POP3]="${ENABLE_POP3:=0}"
|
VARS[ENABLE_POP3]="${ENABLE_POP3:=0}"
|
||||||
|
VARS[ENABLE_IMAP]="${ENABLE_IMAP:=1}"
|
||||||
VARS[ENABLE_POSTGREY]="${ENABLE_POSTGREY:=0}"
|
VARS[ENABLE_POSTGREY]="${ENABLE_POSTGREY:=0}"
|
||||||
VARS[ENABLE_QUOTAS]="${ENABLE_QUOTAS:=1}"
|
VARS[ENABLE_QUOTAS]="${ENABLE_QUOTAS:=1}"
|
||||||
VARS[ENABLE_RSPAMD]="${ENABLE_RSPAMD:=0}"
|
VARS[ENABLE_RSPAMD]="${ENABLE_RSPAMD:=0}"
|
||||||
|
|
Loading…
Reference in a new issue