commit 74ea2dfb6fc45743c02d0e54d8ad70597f2271bc Author: Thor Harald Johansen Date: Sat May 23 18:55:12 2020 +0200 Initial commit diff --git a/smtpd.conf b/smtpd.conf new file mode 100644 index 0000000..567b57b --- /dev/null +++ b/smtpd.conf @@ -0,0 +1,54 @@ +# Load and assign certificates for your mail server. You can use the certbot certificate +# for your web domains, so long as it contains your mail server's hostname. This hostname +# needs to match the FQDN hostname of your server or container. +pki host.tld cert "/etc/ssl/cert.pem" +pki host.tld key "/etc/ssl/private/cert.key" + +# These tables are referenced as in the options below: + +# This file contains the passwords for your email accounts, as generated with +# smtpctl encrypt (alternatively, leave the password for stdin input) +table vpassword "/etc/smtpd/virtual/password" + +# This file contains a list of your virtual domains (should not include the local domain) +table vdomain "/etc/smtpd/virtual/domain" + +# This file contains a list of emails you want to route to your email accounts +table valias "/etc/smtpd/virtual/alias" + +# This file contains a list of UIDs, GIDs and home directories for your email accounts +# For a virtual host setup, you would typically create a UNIX user.group like vmail.vmail +# and chown all your mailbox directories to it. +table vmailbox "/etc/smtpd/virtual/mailbox" + +# Listen to the various SMTP ports, using the keys we loaded above to prove we are host.tld +listen on eth0 tls pki host.tld +listen on eth0 port 465 smtps pki host.tld auth +listen on eth0 port 587 tls-require pki host.tld auth + +# These are actions that get triggered by the match rules below: + +# Action to receive mail locally and send it to a maildir (~/Maildir by default but +# here we put them straight in the user's home directory as listed in ). +# The manpage doesn't mention it, but the order of these clauses is significant; +# you will get a syntax error if you don't follow the listing order in the manpage. +action receive maildir "%{user.directory}" userbase virtual + +# Action to send mail to remote SMTP server +action send relay + +# Match mail from any source to your local domain (server hostname) +match from any for local action receive + +# Match mail from any source to your virtual domains +match from any for domain action receive + +# Match mail from your local network to anywhere (useful for contaners that sit on +# the same subnet and need to send email without authentication) +#match from src x.x.x.x/x for any action send + +# This accepts mail from your local machine to anywhere (typical configuration) +match from local for any action send + +# This accepts mail from any authenticated user to anywhere +match from any auth for any action send diff --git a/virtual/alias b/virtual/alias new file mode 100644 index 0000000..803d28a --- /dev/null +++ b/virtual/alias @@ -0,0 +1,6 @@ +user1@vhost.tld vmail +user2@vhost.tld vmail +user3@vhost.tld vmail +@vhost1.tld vmail +@vhost2.tld vmail +@vhost3.tld vmail diff --git a/virtual/domain b/virtual/domain new file mode 100644 index 0000000..a46936d --- /dev/null +++ b/virtual/domain @@ -0,0 +1,3 @@ +vhost1.tld +vhost2.tld +vhosr3.tld diff --git a/virtual/mailbox b/virtual/mailbox new file mode 100644 index 0000000..c5f741c --- /dev/null +++ b/virtual/mailbox @@ -0,0 +1,3 @@ +user1 999:999:/home/user1 +user2 999:999:/home/user2 +user3 999:999:/home/user3 diff --git a/virtual/password b/virtual/password new file mode 100644 index 0000000..912567f --- /dev/null +++ b/virtual/password @@ -0,0 +1,3 @@ +user1 smtpctl-generated-password-1 +user2 smtpctl-generated-password-2 +user3 smtpctl-generated-password-3