run postfix with smtp authentication (sasldb) in a docker container. with STARTLS and OpenDKIM support.
Repository contains sample key and crt for postfix. Create your own keys with:
cd root/etc/postfix/certs
openssl req -newkey rsa:4096 -nodes -sha512 -x509 -days 3650 -nodes -out postfix.crt -keyout postfix.keyRepository contains sample dkim with selector = jupiter._domainkey. Create your own keys with:
cd root/etc/opendkim/domainkeys/
opendkim-genkey -s jupiter -d hacking-lab.comConfigure SMTP Users in your docker-compose.yml. The accounts will be created in the SASLDB.
environment:
TZ: Europe/Zurich
# Uncomment to enable debugging messages:
#LOGXI: '*'
maildomain: hacking-lab.com
smtp_user: ivan.buetler:EBp5CJNcykf7cgmb,no-reply:FIj8qVxZXINXjJOCUse the ENV in the docker-compose.yml
STARTLS is not supported on port 25
./smtptest.py -v -n 25 -t -u ivan.buetler -p EBp5CJNcykf7cgmb <sender-mail> <recipient-mail> <hostname>
./smtptest.py -v -n 25 -t -u no-reply -p FIj8qVxZXINXjJOC <sender-mail> <recipient-mail> <hostname> or
apt install swaks
swaks --to <recipient-mail> --from <sender-mail> --server localhost --port 25 STARTLS is supported on port 587
./smtptest.py -v -n 587 -t -u ivan.buetler -p EBp5CJNcykf7cgmb <sender-mail> <recipient-mail> <hostname>
./smtptest.py -v -n 587 -t -u no-reply -p FIj8qVxZXINXjJOC <sender-mail> <recipient-mail> <hostname> or
swaks --port 587 --tls \
--auth LOGIN --auth-user ivan.buetler \
--auth-password EBp5CJNcykf7cgmb \
--to <recipient-mail> \
--from <sender-mail> \
--server localhost