summaryrefslogtreecommitdiffhomepage
path: root/smtpd/smtpd.conf
diff options
context:
space:
mode:
Diffstat (limited to 'smtpd/smtpd.conf')
-rw-r--r--smtpd/smtpd.conf47
1 files changed, 47 insertions, 0 deletions
diff --git a/smtpd/smtpd.conf b/smtpd/smtpd.conf
new file mode 100644
index 0000000..e8a5042
--- /dev/null
+++ b/smtpd/smtpd.conf
@@ -0,0 +1,47 @@
1# This is the smtpd server system-wide configuration file.
2# See smtpd.conf(5) for more information, refs:
3# https://man.openbsd.org/smtpd.conf.5
4# https://unixdigest.com/tutorials/arch-linux-mail-server-tutorial-part-2-opensmtpd-dovecot-dkimproxy-and-lets-encrypt.html
5
6# TIPS: Add a new/group vamil for processing dirty stuffs:
7# useradd -m -c "Virtual Mail" -d /var/vmail -s /sbin/nologin vmail
8
9# Certificates from Let's Encrypt.
10pki mail.topo.tw cert "/etc/mail/ssl/fullchain.cer"
11pki mail.topo.tw key "/etc/mail/ssl/mail.topo.tw.key"
12
13# DKIM, command:
14# sudo PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install --force git+https://github.com/palant/opensmtpd-filters.git
15# refs: https://palant.info/2020/11/09/adding-dkim-support-to-opensmtpd-with-custom-filters/
16filter dkimsign proc-exec "/usr/local/bin/dkimsign topo.tw:dkim:/etc/mail/dkim.key"
17filter dkimverify proc-exec "/usr/local/bin/dkimverify topo.tw"
18filter dkim chain {"dkimsign", "dkimverify"}
19
20# refs: https://man.openbsd.org/table.5
21table passwd file:/etc/mail/passwd
22
23# To also accept external mail over IPv4 or IPv6,
24# respectively replace "listen on localhost" with:
25#
26# listen on 0.0.0.0
27# listen on ::
28listen on lo
29listen on enp1s0 inet4 hostname "mail.topo.tw" port 25 tls pki mail.topo.tw filter "dkim"
30listen on enp1s0 inet4 hostname "mail.topo.tw" port 587 tls-require mask-src pki mail.topo.tw auth-optional <passwd> filter "dkim"
31
32# Allow delivery from local or domain-owned-by-me
33action "me" maildir "/home/pham/Maildir" virtual { "@" = "pham" }
34match from any for domain "topo.tw" action "me"
35match from local for local action "me"
36
37# Allow outgoing emails: authenticated connection only
38action "relay" relay
39#match from local for any action "relay"
40match auth ! from local for any action "relay"
41match from local for any action "relay"
42
43# SPAM: deliver spam to custom mda
44action "spam" mda "/etc/mail/spam" virtual { "@" = "pham" }
45#match from any for rcpt-to "valxxx@megamail.com.br" action "relay"
46#match from any for any action "spam"
47#match for any reject