Tuesday, January 25, 2022

opensmtpd

 Installation

  • pacman -S opensmtpd, opensmtpd-filter-dkimsign

Basic concept

mailbox

dovecot decide where to store email. it is /var/mail/user for mbox according to mail.local

dkim

dkim use private/public key to sign email. private key used to sign email and public key in DNS record to verify private key.
selector is name, you could choose what you want.
see smtpd.conf regardin how to use opensmtpd-filter-dkimsign to sign dkim. dkimproxy couls also be used but no formal/AUR package in Archlinux.

MAIL FROM and FROM

MAIL FROM is in envolope and mapping to Return-Path. "senders <users>" in smtp.config listen command is used to mapping user to email address, or example hongy19 -> hongy19@hongy19.net.
FROM is not in envelope and included into data. SMTP protocol doesn't care it. Mutt could change it. "masquerade" on smtp.config use to change it, for example hongy19 -> hongy19@hongy19.net

action and match

"When mail arrives, each “RCPT TO:” command generates a mail envelope. If an envelope matches any of a pre-designated set of criteria (using the match directive), the message is accepted for delivery. A copy of the message, as well as its associated envelopes, is saved in the mail queue and later dispatched according to an associated set of actions (using the action directive). If an envelope does not match any options, it is rejected. The match rules are evaluated sequentially, with the first match winning." according to smtpd.conf
For out-email (relay in action), need to relay only authorization email (through match auth), otherwise spam email will forwarded.

Checking queue

  • smtpctl show queue

No comments: