Configure OpenSMTPD to relay on a network

NILWith the new OpenSMTPD syntax change which landed with OpenBSD 6.4

release, changes are needed for making opensmtpd to act as a lan relay

to a smtp server. This case wasn't covered in my previous article

about opensmtpd, I was only writing about relaying from the local

machine, not for a network. Mike (a reader of the blog) shared that it

would be nice to have an article about it. Here it is! :)

A simple configuration would look like the following:

listen on em0

listen on lo0

table aliases db:/etc/mail/aliases.db

table secrets db:/etc/mail/secrets.db

action "local" mbox alias <aliases>

action "relay" relay host smtps://myrelay@remote-smtpd.tld auth <secrets>

match for local action "local"

match from local for any action "relay"

match from src 192.168.1.0/24 for action relay

The daemon will listen on em0 interface, and mail delivered from the

network will be relayed to remote-smtpd.tld.

For a relay using authentication, the login and passwords must be

defined in the file /etc/mail/secrets like this: `myrelay

login:Pa$$W0rd`

smtpd.conf(5) explains creation

of /etc/mail/secrets like this:

touch /etc/mail/secrets

chmod 640 /etc/mail/secrets

chown root:_smtpd /etc/mail/secrets

Proxy Information
Original URL
gemini://perso.pw/blog//articles/opensmtpd-relay.gmi
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
138.982283 milliseconds
Gemini-to-HTML Time
0.39038 milliseconds

This content has been proxied by September (ba2dc).