Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
email:mailscanner [2025/06/16 08:08] – created - external edit 127.0.0.1 | email:mailscanner [2025/06/16 09:51] (current) – willy | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== N) Mail Scanner ====== | ====== N) Mail Scanner ====== | ||
- | The DNS (Domain Name Service) plays a critical role in email delivery. You need to create | + | [[https:// |
- | The basic record to setup is the MX record, which tells the email servers //which server(s)// handle email for your domain. | + | MailScanner Gentoo latest package |
- | This page will make a general overview of all the needed records, more details are presented in each configuration section later on. | + | Download generic 'Nix tarball from [[https:// |
- | Please __note__ that you will need **more** that the records defined in this page for a domain to operate properly: this is only for email. | + | decompress and run install.sh |
+ | <code bash> | ||
+ | mkdir / | ||
+ | cd / | ||
+ | wget ... | ||
+ | tar xvf < | ||
+ | cd MailScanner-xxx | ||
+ | ./ | ||
+ | ln -s / | ||
+ | rc-update add msmilter-init default | ||
+ | </ | ||
+ | follow instructions and answer the various questions. | ||
- | ===== Reverse DNS ===== | + | MailScanner |
- | + | /etc/MailScanner.conf: | |
- | A reverse DNS setup is how you translate an IP to a DNS name. This is the //opposite// of DNS, where you translate a domain to an IP. | + | |
- | + | ||
- | This is important to be properly set, and is usually defined aside from your actual DNS management panel of your provider. | + | |
- | + | ||
- | If you cannot set it, some providers don't support it, it's ok. Better set it up, if possible. When set, it will help email deliverability. | + | |
- | + | ||
- | + | ||
- | ===== MX record ===== | + | |
- | + | ||
- | An **MX** record (mandatory) tells who manages emails for your domain. You can have more than one, to build a chain of backup servers, but that is outside the scope of this guide. I assume your MX record points to **mail.mydomain.com**. | + | |
- | + | ||
- | Please note that this implies as well the existence of an **A** record for //mail.mydomain.com//. | + | |
- | + | ||
- | Example: | + | |
< | < | ||
- | mail.mydomain.com. | + | Run As User = postfix |
- | webmail.mydomain.com. mail.mydomain.com. | + | Run As Group = postfix |
- | @ 10 mail.mydomain.com. 3600 MX | + | Incoming Queue Dir = / |
+ | Outgoing Queue Dir = / | ||
+ | MTA = msmail | ||
+ | MSMail Queue Type = short | ||
+ | MSMail Delivery Method = QMQP | ||
+ | MSMail Socket Type = inet | ||
+ | MSMail Socket Dir = / | ||
+ | MSMail Relay Port = 628 | ||
+ | MSMail Relay Address = 127.0.0.1 | ||
</ | </ | ||
- | + | / | |
- | ===== SPF record ===== | + | |
- | + | ||
- | For SPF to work, you need to setup a proper TXT record like the following: | + | |
< | < | ||
- | @ v=spf1 mx a -all 3600 TXT | + | run_mailscanner=1 |
</ | </ | ||
- | + | Postfix setup. | |
- | ===== DKIM record ===== | + | main.cf: |
- | + | ||
- | The DKIM record contains the public part of your domain DKIM keys: | + | |
< | < | ||
- | mydomain.com._domainkey. " | + | # MailScanner milter |
+ | # | ||
+ | # MailScanner milter may use QMQP for delivery | ||
+ | qmqpd_authorized_clients | ||
+ | </code> | ||
+ | master.cf: | ||
+ | <code> | ||
+ | 628 | ||
</ | </ | ||
- | In the above example //<< mykey >>// is a very long random characters string. | ||
+ | ====== Install MailWatch ====== | ||
- | ===== DMARC record ===== | + | [[https:// |
- | The DMARC record is used to publish your domain DMARC strategy | + | Follow docs [[https:// |
+ | |||
+ | / | ||
< | < | ||
- | _dmarc.mydomain.com. "v=DMARC1; p=reject; rua=mailto: | + | Always Looked Up Last = & |
- | _smtp_tls.mydomain.com. """ | + | Detailed Spam Report |
+ | Quarantine Whole Message | ||
+ | Quarantine Whole Messages As Queue Files = no | ||
+ | Include Scores In SpamAssassin Report = yes | ||
+ | Quarantine User = root | ||
+ | Quarantine Group = apache (this should be the same group as your web server) | ||
+ | Quarantine Permissions | ||
</ | </ | ||
+ | Set queues permissions: | ||
+ | <code bash> | ||
+ | usermod -a -G postfix apache | ||
+ | chmod g+rx / | ||
+ | chmod g+rx / | ||
+ | chgrp postfix / | ||
+ | chgrp postfix / | ||
+ | </ | ||
- | ===== Discoverability records ===== | ||
- | The following set of SRV records facilitate mail clients to discover your IMAP and SMTP servers: | ||
- | < | ||
- | _imaps._tcp.mail.mydomain.com. 0 1 993 mail.mydomain.com. 3600 SRV | ||
- | _submissions._tcp.mail.mydomain.com. 0 1 465 mail.mydomain.com. 3600 SRV | ||
- | _imap._tcp.mail.mydomain.com. 0 1 143 mail.mydomain.com. 3600 SRV | ||
- | _submission._tcp.mail.mydomain.com. 0 1 587 mail.mydomain.com. 3600 SRV | ||
- | </ | ||