Configure OmniOS to use an authenticated SMTP relay (smarthost)

       375 words, 2 minutes

All my servers use an SMTP relay to communicate via email. I have setup “service” accounts that they use to authenticate themselves on a smarthost. My OmniOS server is no exception.

By default, OmniOS has no SMTP daemon running and ships with the DragonFly Mail Agent . Without any configuration, the emails getting out of this server may not be delivered properly - think about rDNS, FCrDNS, SPF, DKIM, DMARC…

Have a careful look at the dma(8) manpage .

Configure the DragonFly Mail Agent to use a smarthost with authenticated and encrypted communication.

# cd /etc/dma

# diff -U2 dma.conf{.orig,}
--- dma.conf.orig       Sat Jan 27 18:43:06 2024
+++ dma.conf    Sun Jan 28 14:30:28 2024
@@ -1,11 +1,11 @@
 # Your smarthost (also called relayhost).  Leave blank if you don't want
 # smarthost support.
-#SMARTHOST
+SMARTHOST smarthost.example

 # Use this SMTP port.  Most users will be fine with the default (25)
-#PORT 25
+PORT 587

 # Path to your alias file.  Just stay with the default.
-#ALIASES /etc/aliases
+ALIASES /etc/aliases

 # Path to your spooldir.  Just stay with the default.
@@ -13,12 +13,12 @@

 # SMTP authentication
-#AUTHPATH /etc/dma/auth.conf
+AUTHPATH /etc/dma/auth.conf

 # Uncomment if you want TLS/SSL support
-#SECURETRANSFER
+SECURETRANSFER

 # Uncomment if you want STARTTLS support (only used in combination with
 # SECURETRANSFER)
-#STARTTLS
+STARTTLS

 # Pin the server certificate by specifying its SHA256 fingerprint.
@@ -52,5 +52,5 @@
 # will be used as the hostname.
 #MAILNAME mail.example.net
-MAILNAME example
+MAILNAME omnios.example

 # Masquerade envelope from addresses with this address/hostname.
@@ -64,4 +64,5 @@
 #              e.g. fish@percolator
 # MASQUERADE herb@ert  will send all mails as herb@ert
+MASQUERADE example

 # Directly forward the mail to the SMARTHOST bypassing aliases and local

Configure the credentials that will be used to authenticate the SMTP sessions.

# diff -U2 auth.conf{.orig,}
--- auth.conf.orig      Sun Nov  5 13:28:37 2023
+++ auth.conf   Sun Jan 28 14:32:26 2024
@@ -3,2 +3,3 @@
 # SMTP authentication entries (currently AUTH LOGIN only)
 # Format: user|my.smarthost.example.com:password
+changeMe|smarthost.example:changeThisPassword

Have every email be sent to a single address.

# diff -U2 aliases{.orig,}
--- aliases.orig        Sun Nov  5 13:28:42 2023
+++ aliases     Sun Jan 28 14:33:35 2024
@@ -8,3 +8,3 @@
 # if you don't want any local mail to be delivered.
 ##
-
+*: hostmaster@example

Done. Happy notifications!