OpenSMTPD Howto (1)
Installation
Remove conflicting package:
emerge --unmerge 'mail-mta/nullmailer'
Synchronize the repository and show dependencies:
emaint --auto sync
emerge --update --pretend 'mail-mta/opensmtpd'
Install the package:
emerge --update 'mail-mta/opensmtpd'
Configuration
Change file permissions:
cd '/var/spool'
chown 'root:mail' 'mail'
chmod 03775 'mail'
mkdir --mode=0711 'smtpd'
cd 'smtpd'
mkdir --mode=0700 'corrupt' 'incoming' 'purge' 'queue' 'temporary'
chown 'smtpq:root' 'corrupt' 'incoming' 'purge' 'queue' 'temporary'
mkdir --mode=0770 'offline'
chown 'root:smtpq' 'offline'
Create a Google App Password.
Create file with the credentials:
cd '/etc/opensmtpd'
install --owner='root' --group='smtpd' --mode=0640 '/dev/null' 'secrets'
echo 'gmail alex.the.lion@gmail.com:**********' >>'secrets'
makemap 'secrets'
Edit the following files:
Validate the configuration:
smtpd -n
Start the daemon:
/etc/init.d/smtpd start
Include the daemon to the start procedure:
rc-update add 'smtpd' 'default'
rc-update show | grep 'smtpd'
Output:
smtpd | default
Test
- Test the listener's availability
netstat --numeric --program --listening --all --tcp --udp | grep ':25 '
Output:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 23444/smtpd: pony e
- Send a test email
sendmail -t -v
Content:
To: root
Subject: Test OpenSMTPD
This an OpenSMTPD test!