My OpenSMTPd Quest

#OpenSMTPdDiary

I have been volunteering for a non profit for a couple months now. It is run by a very experienced man who outright offered to mentor me as Linux Systems Admin. The opportunity to get direct production experience early in my career with technologies that fascinate me, under the guidance of someone experienced, is worth the lack of pay.

One of the many projects we've been working on is the building of a self hosted email server, using OpenSMTPd on OpenBSD. I have been instructed to works different levels of complexity in its configuration, receiving help and guidance as needed.

A major frustration in this project has been the lack of examples that demonstrate different concepts/configurations in OpenSMTPD. Many guides and configurations exist, but all are for woefully outdated versions of OpenSMTPd that can no longer be used by beginners as a reference. You know if they are out of date when they include many opensmtpd.conf lines containing "accept for ..." [The following can be used as a reference for older versions](https://coderwall.com/p/eejzja/simple-smtp-server-with-opensmtpd):

accept from any for domain “spamd.worrbase.com” alias deliver to mbox

To help others with this problem. I will be trying to leave example configurations as I work through this project, so that others can see how to work through similar projects themselves.

Opensmtpd.conf.local (THIS CONFIGURATION IS NOT SECURE; DO NOT USE ON PUBLIC INTERNET):

This configuration allows local users, ones that you can manage with useradd and passwd, to send and receive email from eachother and external emails via telnet with the received mail being deposited in ~/Maildir

Users can receive email if the server has a correct MX record, and the username is used as the user @ that domain: user@domain.com

Aliases

ext_if = “fxp0”

Basic Functions

listen on $ext_if

action “local” maildir

Matching rules required for anything to happen

match from any for local action “local”

More complex rules for relay control options

smtp max-message-size 50M