Open Source Mail Server Maddy Deployment Tutorial
Introduction
Before I introduced a complete email service RainLoop, this time we introduce another open source mail server Maddy. Maddy is written entirely in Go language, which is lightweight and easy to use.
Next, I will introduce to you how to use Maddy to build a personal email server.
In general, refer to Maddy’s official website and it can basically be built. If not, you can refer to my tutorial
Steps
Apply for an SSL certificate
Apply for
mx1.yourdomain.com
certificate fromhttps://sslforfree.com
Download and get
certificate.crt
andprivate.key
Deploy the SSL certificate
First rename the downloaded certificates to
fullchain.pem
andprivkey.pem
, and transfer them to the/software/email/maddy/certs/mx1.yourdomain.com/
directory of your own serverModify the Maddy configuration file
Take the maddy.conf file from github, transfer it to the
/software/email/maddy
directory and modify the content of the configuration file, replace with your own domain name$(hostname) = mx1.yourdomain.com $(primary_domain) = yourdomain.com
Server configuration
docker start maddy
docker run \ --name maddy \ -e MADDY_HOSTNAME=mx1.yourdomain.com \ -e MADDY_DOMAIN=yourdomain.com \ -v /software/email/maddy/certs:/etc/maddy/certs/ \ -v /software/email/maddy:/data \ -p 25:25 \ -p 143:143 \ -p 587:587 \ -p 993:993 \ -d foxcpp/maddy:latest
If the server pulls the docker image too slowly, you can pull it locally and then package and upload it to the server. I won’t go into details here. The key commands are the following two.
docker save --output busybox.tar busybox docker load --input busybox.tar
DNS configuration
Go to the background management interface of the server manufacturer to configure DNS
; Basic domain->IP records, you probably already have them. example.org.A 10.2.3.4 example.org.AAAA 2001:beef::1 ; It says that "server mx1.example.org is handling messages for example.org". example.org.MX 10 mx1.example.org. ; Of course, mx1 should have A/AAAA entry as well: mx1.example.org.A 10.2.3.4 mx1.example.org.AAAA 2001:beef::1 ; Use SPF to say that the servers in "MX" above are allowed to send email ; for this domain, and nobody else. example.org.TXT "v=spf1 mx ~all" ; It is recommended to server SPF record for both domain and MX hostname mx1.example.org.TXT "v=spf1 mx ~all" ; Opt-in into DMARC with permissive policy and request reports about broken ; messages. _dmarc.example.org.TXT "v=DMARC1; p=quarantine; ruf=mailto:postmaster@example.org" ; Mark domain as MTA-STS compatible (see the next section) ; and request reports about failures to be sent to postmaster@example.org _mta-sts.example.org.TXT "v=STSv1; id=1" _smtp._tls.example.org.TXT "v=TLSRPTv1;rua=mailto:postmaster@example.org" default._domainkey.example.org.TXT "v=DKIM1; k=ed25519; p=nAcUUozPlhc4VPhp7hZl+owES7j7OlEv0laaDEDBAqg="
Create a new user
docker exec -it maddy sh maddyctl creds create postmaster@yourdomain.com # Password will prompt you to enter yourdomain maddyctl imap-acct create postmaster@yourdomain.com #
Conclusion
The above is the simple tutorial I summarized about using Maddy to build a personal mail server. Welcome to support this Go open source project.
Comments