Set up your own mail server

Most people have casual emails such as Gmail, Yahoo, Microsoft or other free providers: that might be OK, in a sense. Most companies in the IT industry have their own domain names for professional use, but they entirely give up the ownership of their data by subscribing to the same services that random users have for unprofessional, sporadic use.

This is stupid.

I think companies and institution should by default own their data.

Managing your own mail server is a way to own your data.

All you need

  • a domain name

  • a linux machine with access to internet

  • a Debian 9 / 10 install: it can be another distro, but you will probably have to adapt the scripts to your needs.

All you don't need

  • a GUI
  • weirder tools than ssh

Software we will use

A good setup

Get the mailware scripts and unpack them, you will get this tree:

./mail-server-install.sh
./template
./template/pam.d
./template/pam.d/imap
./template/pam.d/vsftpd
./template/dovecot
./template/dovecot/dovecot.conf
./template/procmailrc
./template/postfix
./template/postfix/main.cf.m4
./template/postfix/master.cf
./template/opendkim
./template/opendkim/key_table.m4
./template/opendkim/opendkim.conf
./template/opendkim/trusted_hosts.m4
./template/opendkim/signing_table.m4
./mail-setup.cfg

Edit the content of mail-setup.cfg with the name of your host and the domain that you are going to create a mailserver for, like this:

MAILSERVER_NAME="mail.mydomain.com"
DOMAIN_NAME="mydomain.com"

That's all the input that the mail-server-install.sh script needs. You should just be able to run it like this:

./mail-server-install.sh

This will create a mailserver where each unix user of the machine will become a mail account. If you want to add an email account for your domain, just add a unix user with the corresponding name, without the @mydomain.com part.

Contact

If you feel like:

  • the above can be important stuff for yourself, but still need some help implementing/deploying

  • you would like to automate the process, for example by integrating into your CI/CD infrastructure

  • you would like a custom script for your specific system

  • you would like to discuss some other aspects

you are encouraged to reach out and [contact us](mailto:contact@kevwe.se?subject=Support Request - mailserver): you'll get a focused professional to address your needs.

Resources

mailware.tar.gz

References:

About OpenDKIM

SPF and DKIM on debian

Domain Keys on CentOS

OpenDKIM

OpenDKIM on archlinux

SPF and DKIM on Ubuntu



Keywords: [ linux ]

Share: