mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
To retrieve emails from external mail accounts.
This commit is contained in:
parent
8b289f6717
commit
e7de8b9245
|
@ -7,7 +7,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update -q --fix-missing && \
|
||||||
apt-get -y install --no-install-recommends \
|
apt-get -y install --no-install-recommends \
|
||||||
postfix dovecot-core dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved gamin amavisd-new spamassassin razor pyzor libsasl2-modules \
|
postfix dovecot-core dovecot-imapd dovecot-pop3d dovecot-sieve dovecot-managesieved gamin amavisd-new spamassassin razor pyzor libsasl2-modules \
|
||||||
clamav clamav-daemon libnet-dns-perl libmail-spf-perl bzip2 file gzip p7zip unzip arj rsyslog \
|
clamav clamav-daemon libnet-dns-perl libmail-spf-perl bzip2 file gzip p7zip unzip arj rsyslog \
|
||||||
opendkim opendkim-tools opendmarc curl fail2ban ed iptables && \
|
opendkim opendkim-tools opendmarc curl fail2ban ed iptables fetchmail && \
|
||||||
curl -sk http://neuro.debian.net/lists/trusty.de-m.libre > /etc/apt/sources.list.d/neurodebian.sources.list && \
|
curl -sk http://neuro.debian.net/lists/trusty.de-m.libre > /etc/apt/sources.list.d/neurodebian.sources.list && \
|
||||||
apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu:80 0xA5D32F012649A5A9 && \
|
apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu:80 0xA5D32F012649A5A9 && \
|
||||||
apt-get update -q --fix-missing && apt-get -y upgrade fail2ban && \
|
apt-get update -q --fix-missing && apt-get -y upgrade fail2ban && \
|
||||||
|
@ -51,6 +51,10 @@ ADD target/opendkim/default-opendkim /etc/default/opendkim
|
||||||
ADD target/opendmarc/opendmarc.conf /etc/opendmarc.conf
|
ADD target/opendmarc/opendmarc.conf /etc/opendmarc.conf
|
||||||
ADD target/opendmarc/default-opendmarc /etc/default/opendmarc
|
ADD target/opendmarc/default-opendmarc /etc/default/opendmarc
|
||||||
|
|
||||||
|
# Configure fetchmail
|
||||||
|
ADD target/fetchmail/fetchmailrc /etc/fetchmailrc_general
|
||||||
|
RUN sed -i 's/START_DAEMON=no/START_DAEMON=yes/g' /etc/default/fetchmail
|
||||||
|
|
||||||
# Configures Postfix
|
# Configures Postfix
|
||||||
ADD target/postfix/main.cf target/postfix/master.cf /etc/postfix/
|
ADD target/postfix/main.cf target/postfix/master.cf /etc/postfix/
|
||||||
|
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -51,6 +51,13 @@ run:
|
||||||
--cap-add=NET_ADMIN \
|
--cap-add=NET_ADMIN \
|
||||||
-h mail.my-domain.com -t $(NAME)
|
-h mail.my-domain.com -t $(NAME)
|
||||||
sleep 20
|
sleep 20
|
||||||
|
docker run -d --name mail_fetchmail \
|
||||||
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
|
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
||||||
|
-e ENABLE_FETCHMAIL=1 \
|
||||||
|
--cap-add=NET_ADMIN \
|
||||||
|
-h mail.my-domain.com -t $(NAME)
|
||||||
|
sleep 20
|
||||||
docker run -d --name mail_disabled_amavis \
|
docker run -d --name mail_disabled_amavis \
|
||||||
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
||||||
|
@ -97,4 +104,4 @@ tests:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
# Remove running test containers
|
# Remove running test containers
|
||||||
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin mail_disabled_clamav
|
docker rm -f mail mail_pop3 mail_smtponly mail_fail2ban mail_fetchmail fail-auth-mailer mail_disabled_amavis mail_disabled_spamassassin mail_disabled_clamav
|
||||||
|
|
|
@ -16,6 +16,7 @@ Includes:
|
||||||
- opendkim
|
- opendkim
|
||||||
- opendmarc
|
- opendmarc
|
||||||
- fail2ban
|
- fail2ban
|
||||||
|
- fetchmail
|
||||||
- basic [sieve support](https://github.com/tomav/docker-mailserver/wiki/Configure-Sieve-filters) using dovecot
|
- basic [sieve support](https://github.com/tomav/docker-mailserver/wiki/Configure-Sieve-filters) using dovecot
|
||||||
- [LetsEncrypt](https://letsencrypt.org/) and self-signed certificates
|
- [LetsEncrypt](https://letsencrypt.org/) and self-signed certificates
|
||||||
- [integration tests](https://travis-ci.org/tomav/docker-mailserver)
|
- [integration tests](https://travis-ci.org/tomav/docker-mailserver)
|
||||||
|
@ -111,6 +112,10 @@ Otherwise, `iptables` won't be able to ban IPs.
|
||||||
- **empty** => Managesieve service disabled
|
- **empty** => Managesieve service disabled
|
||||||
- 1 => Enables Managesieve on port 4190
|
- 1 => Enables Managesieve on port 4190
|
||||||
|
|
||||||
|
##### ENABLE_FETCHMAIL
|
||||||
|
- **empty** => `fetchmail` disabled
|
||||||
|
- 1 => `fetchmail` enabled
|
||||||
|
|
||||||
##### SA_TAG
|
##### SA_TAG
|
||||||
|
|
||||||
- **2.0** => add spam info headers if at, or above that level
|
- **2.0** => add spam info headers if at, or above that level
|
||||||
|
|
13
config/fetchmail.cf
Normal file
13
config/fetchmail.cf
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
## Example configuration: IMAP
|
||||||
|
#poll imap.example.com with proto IMAP
|
||||||
|
# user 'username' there with
|
||||||
|
# password 'secret'
|
||||||
|
# is 'user1@domain.tld'
|
||||||
|
# here ssl
|
||||||
|
|
||||||
|
## Example configuration: POP3
|
||||||
|
#poll pop3.example.com with proto POP3
|
||||||
|
# user 'username' there with
|
||||||
|
# password 'secret'
|
||||||
|
# is 'user2@domain.tld'
|
||||||
|
# here options keep ssl
|
7
target/fetchmail/fetchmailrc
Normal file
7
target/fetchmail/fetchmailrc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# General options
|
||||||
|
|
||||||
|
set daemon 300
|
||||||
|
set syslog
|
||||||
|
|
||||||
|
# Fetch rules
|
||||||
|
|
|
@ -352,6 +352,15 @@ if [ -f /tmp/docker-mailserver/dovecot.cf ]; then
|
||||||
/usr/sbin/dovecot reload
|
/usr/sbin/dovecot reload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Enable fetchmail daemon
|
||||||
|
if [ "$ENABLE_FETCHMAIL" = 1 ]; then
|
||||||
|
if [ -f /tmp/docker-mailserver/fetchmail.cf ]; then
|
||||||
|
cat /etc/fetchmailrc_general /tmp/docker-mailserver/fetchmail.cf > /etc/fetchmailrc
|
||||||
|
fi
|
||||||
|
echo "Fetchmail enabled"
|
||||||
|
/etc/init.d/fetchmail start
|
||||||
|
fi
|
||||||
|
|
||||||
# Start services related to SMTP
|
# Start services related to SMTP
|
||||||
if ! [ "$DISABLE_SPAMASSASSIN" = 1 ]; then
|
if ! [ "$DISABLE_SPAMASSASSIN" = 1 ]; then
|
||||||
/etc/init.d/spamassassin start
|
/etc/init.d/spamassassin start
|
||||||
|
|
5
test/config/fetchmail.cf
Normal file
5
test/config/fetchmail.cf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
poll pop3.example.com with proto POP3
|
||||||
|
user 'username' there with
|
||||||
|
password 'secret'
|
||||||
|
is 'user2@domain.tld'
|
||||||
|
here options keep ssl
|
|
@ -37,6 +37,16 @@
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "checking process: fetchmail (disabled in default configuration)" {
|
||||||
|
run docker exec mail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/bin/fetchmail'"
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "checking process: fetchmail (fetchmail server enabled)" {
|
||||||
|
run docker exec mail_fetchmail /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/bin/fetchmail'"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "checking process: amavis (amavis disabled by DISABLE_AMAVIS)" {
|
@test "checking process: amavis (amavis disabled by DISABLE_AMAVIS)" {
|
||||||
run docker exec mail_disabled_amavis /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/amavisd-new'"
|
run docker exec mail_disabled_amavis /bin/bash -c "ps aux --forest | grep -v grep | grep '/usr/sbin/amavisd-new'"
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
|
@ -436,6 +446,20 @@
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# fetchmail
|
||||||
|
#
|
||||||
|
|
||||||
|
@test "checking fetchmail: gerneral options in fetchmailrc are loaded" {
|
||||||
|
run docker exec mail_fetchmail grep 'set syslog' /etc/fetchmailrc
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "checking fetchmail: fetchmail.cf is loaded" {
|
||||||
|
run docker exec mail_fetchmail grep 'pop3.example.com' /etc/fetchmailrc
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# system
|
# system
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue