Sign inSign up

brglasser/mailserver

By brglasser

•Updated over 5 years ago

fork of mailfurious-mailserver

Image
0

266

brglasser/mailserver repository overview

⁠malfurious/mailserver

⁠What is this ?

Simple and full-featured mail server as a set of multiple docker images includes :

  • Postfix : a full set smtp email server supporting custom rules
  • Dovecot : secure imap and pop3 email server
  • Rspamd : anti-spam filter with SPF, DKIM, DMARC, ARC, ratelimit and greylisting capabilities
  • Clamav : antivirus with automatic updates
  • Zeyple : automatic GPG encryption of all your e-mails
  • Sieve : email filtering (vacation auto-responder, auto-forward...etc)
  • Fetchmail : fetch e-mails from external IMAP/POP3 server into local mailbox
  • Unbound: recursive caching DNS resolver with DNSSEC support
  • NSD : authoritative DNS server with DNSSEC support
  • SSL : lets encrypt, custom and self-signed certificates support
  • Supporting multiple virtual domains over MySQL backend
  • Integration tests with Travis CI
  • Automated builds on DockerHub
  • Redis Server Cache Built-In
⁠Important Note

This docker was built to be used with malfurious/roundcube-postfixadmin. Goto https://github.com/Malfurious/roundcube-postfixadmin⁠ for more information!

⁠System Requirements

Please check, if your system meets the following minimum system requirements :

TypeWithout ClamAVWith ClamAV
CPU1 GHz1 GHz
RAM1 GiB2 GiB
Disk5 GiB (without emails)5 GiB (without emails)
Systemx86_64x86_64
⁠Environment variables
VariableDescriptionTypeDefault value
UIDpostfixadmin user idoptional991
GIDpostfixadmin group idoptional991
MYSQL_HOSTMariaDB instance ip/hostnamerequirednull
POST_USERMariaDB Postfix usernameoptionalpostfix
POST_PASSMariaDB Postfix passwordrequirednull
POST_DBMariaDB Postfix Database Nameoptionalpostfix
MAIL_HOSTMail Server Namerequiredmail.domain.com
RSPAMD_PASSWORDRspamd WebUI and controller passwordrequirednull
PASS_CRYPTPasswords encryption methodoptionalSHA512-CRYPT
ADD_DOMAINSAdd additional domains to the mailserver separated by commas (needed for dkim keys etc.)optionalnull
RELAY_NETWORKSAdditional IPs or networks the mailserver relays without authenticationoptionalnull
DISABLE_CLAMAVDisable virus scanningoptionalfalse
DISABLE_SIEVEDisable ManageSieve protocoloptionalfalse
DISABLE_SIGNINGDisable DKIM/ARC signingoptionalfalse
DISABLE_GREYLISTINGDisable greylisting policyoptionalfalse
DISABLE_RATELIMITINGDisable ratelimiting policyoptionalfalse
ENABLE_POP3Enable POP3 protocoloptionalfalse
ENABLE_FETCHMAILEnable fetchmail forwardingoptionalfalse
FETCHMAIL_INTERVALFetchmail polling intervaloptional10
RECIPIENT_DELIMITERRFC 5233 subaddress extension separator (single character only)optional+
VMAILUIDvmail user idoptional1024
VMAILGIDvmail group idoptional1024
VMAIL_SUBDIRIndividual mailbox' subdirectoryoptionalmail
OPENDKIM_KEY_LENGTHSize of your DKIM RSA key pairoptional1024
⁠Relaying from other networks

The RELAY_NETWORKS is a space separated list of additional IP addresses and subnets (in CIDR notation) which the mailserver relays without authentication. Hostnames are possible, but generally disadvised. IPv6 addresses must be surrounded by square brackets. You can also specify an absolut path to a file with IPs and networks so you can keep it on a mounted volume. Note that the file is not monitored for changes.

You can use this variable to allow other local containers to relay via the mailserver. Typically you would set this to the IP range of the default docker bridge (172.17.0.0/16) or the default network of your compose. If you are unable to determine, you might just add all RFC 1918 addresses 192.168.0.0/16 172.16.0.0/12 10.0.0.0/8

:warning: A value like 0.0.0.0/0 will turn your mailserver into an open relay!

⁠SSL certificates
⁠Let's Encrypt certificate authority

This mail setup uses 4 domain names that should be covered by your new certificate :

⁠Domains for Malfurious/Mailserver
  • mail.domain.com (mandatory)
  • spam.domain.com (recommended)
⁠Domains if also using Malfurious/roundcube-postfixadmin
  • postfix.domain.com (recommended)
  • webmail.domain.com (optional)

To use the Let's Encrypt certificates, you need to add a volume mount to the mailserver docker:

  • /mnt/docker/nginx/certs:/etc/letsencrypt

And request the certificate with xataz/letsencrypt⁠ or cerbot⁠ :

docker run -it --rm \
  -v /mnt/docker/nginx/certs:/etc/letsencrypt \
  -p 80:80 -p 443:443 \
  xataz/letsencrypt \
    certonly --standalone \
    --rsa-key-size 4096 \
    --agree-tos \
    -m [email protected] \
    -d mail.domain.com \ # <--- Mail FQDN is the first domain name, very important !
    -d webmail.domain.com \
    -d postfix.domain.com \
    -d spam.domain.com
⁠Email client settings :
  • IMAP/SMTP username : [email protected]⁠
  • Incoming IMAP server : mail.domain.com (your FQDN)
  • Outgoing SMTP server : mail.domain.com (your FQDN)
  • IMAP port : 993
  • SMTP port : 587
  • IMAP Encryption protocol : SSL/TLS
  • SMTP Encryption protocol : STARTTLS
⁠Installation (Manually, not using UnRAID Template)

Run the following command to pull the latest image: 'docker pull malfurious/mailserver:latest' Now, Run this to start the docker:

docker run -d --name=mailserver \
  -p 25:25 -p 143:143 -p 587:587 -p 993:993 -p 4190:4190 -p 11334:11334 \
  -e MAIL_HOST=mail.domain.com -e POST_USER=postfix -e POST_PASS=password \
  -e POST_DB=postfix -e MYSQL_HOST=mariadb_ipaddress -e RSPAMD_PASSWORD=password \
  -v /mnt/docker/mailserver:/var/mail -v /mnt/docker/redis:/data \
  malfurious/mailserver:latest

https://github.com/Malfurious/mailserver/wiki/Reverse-Proxy-Configuration⁠

⁠Setup Complete!

⁠Credits

All credit for the actual mailserver part of this docker goes to Hardware, I merely integrated the Redis server, and made it usable on UnRAID Servers via a template. Follow the link below to view his original project.

Tag summary

Content type

Image

Digest

Size

128.5 MB

Last updated

over 5 years ago

docker pull brglasser/mailserver