Just ready-to-use configuration, no more. Created for Docker Mailserver.
- Your domain
- Docker and Docker Compose
- External IP address, exposed to the Internet
- A low-resource and scalable mail server.
- Easy backup and restore functionality through Docker named volumes! (located in
/var/lib/docker/volumes...)
- Make sure, you're installed Docker and Docker Compose.
- Create the volumes described in
compose.yamlor create volumes with your name and adjust the values incompose.yaml. - Clone or download this repository in chosen folder. (or create folder for mailserver)
- Replace the following values:
*PLACEHOLDERS*incompose.yamlandmailserver.env. (for basic server operation)- For what suits you in
mailserver.env. (advanced server configuration)
- Make folder "certs" in container folder and in it generate EC keys for encryption module through this command:
openssl ecparam -name prime256v1 -genkey | openssl pkey -out ecprivkey.pem | openssl pkey -in ecprivkey.pem -pubout -out ecpubkey.pem. - Generate cerificates for secure connections:
sudo certbot --apache/--nginx/--certonly -d example.com. (replace example.com with your mail domain and use one of preffered options for certificate obtaining) - Make
dkimfolder in container folder. - All set for first deploy, use
sudo docker-compose up -dfor the first run! - But I think you want emails to reach their senders, right? So now we need to configure the DKIM. For this we need make folder in container for DKIM or mount folder in
compose.yaml. (already mounted) - In container, in
/etc/rspamd/dkim, use this command for creation DKIM key pairs,rspamadm dkim_keygen -s mail -d example.com -k mail.keyand copy or remember line like thismail._domainkey IN TXT ( "v=DKIM1; k=rsa;" "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTwN...". (afterp=...is written your key for DKIM) - After this, set some file permissions:
sudo chown -R _rspamd:_rspamd /etc/rspamd/dkim/ && sudo chmod 600 /etc/rspamd/dkim/*.key. - Modify your DNS with next record:
mail._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=...*YOUR_GENERATED_KEY*"and submit this to your DNS. (replace example.com with your domain) - Shutdown your container with
sudo docker-compose down. - Find and modify
example.comin yourdkim_signing.confand replace with your domain. - Restart your container with
sudo docker-compose up -d.
And your mail server is ready to go! Congratulations!
You can deeply modify this server later, if you want.
Full-Text Search may not work or may give errors while running. I haven't been able to resolve this yet :(
Wanna contribute to this project? Refer to Unified Contribtuion Guide and submit a issue+pull request!