Docker-Mailserver
Based off the official docker-mailserver.
Install
Get the install script and make it executable:
DMS_GITHUB_URL='https://raw.githubusercontent.com/docker-mailserver/docker-mailserver/master'
wget "${DMS_GITHUB_URL}/docker-compose.yml"
wget "${DMS_GITHUB_URL}/mailserver.env"
wget "${DMS_GITHUB_URL}/setup.sh"
chmod a+x ./setup.sh
Environment Variables
Set hostname and domain in the docker-compose.yml, for example, mail and privacyroot.org. The hostname + domain should equal the FQDN that will be used as MX, ie, mail.privacyroot.org.
Review the environment options and modify mailserver.env accordingly:
- LOG_EVEL=info
- POSTMASTER_ADDRESS=postmaster@privacyroot.org
- POSTFIX_INET_PROTOCOLS=ipv4
- ENABLE_POP3=1
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_MANAGESIEVE=1
- SSL_TYPE=letsencrypt
- SPOOF_PROTECTION=1
- POSTFIX_MAILBOX_SIZE_LIMIT=5120000000 (5GB)
- ENABLE_MANAGESIEVE=1
- ENABLE_SPAMASSASSIN=1
- ENABLE_FETCHMAIL=1
- FETCHMAIL_POLL=60
- DOVECOT_DEFAULT_PASS_SCHEME=ARGON2ID
- SRS_SENDER_CLASSES=envelope_sender,header_sender
DNS
The final DNS configuration should look something like this. Not all values can be set up immediately, be prepared to come back to it as needed while going through the setup.
A autoconfig -> 161.97.84.6
A autodiscover -> 161.97.84.6
A mail -> 161.97.84.6
A privacyroot.org -> 161.97.84.6
CNAME activesync -> mail.privacyroot.org
CNAME imap -> mail.privacyroot.org
CNAME pop3 -> mail.privacyroot.org
CNAME pop3s -> mail.privacyroot.org
CNAME smtp -> mail.privacyroot.org
CNAME webmail -> privacyroot.org
MX mail -> mail.privacyroot.org
MX privacyroot.org -> mail.privacyroot.org
SRV _autodiscover._tcp 0 0 443 autodiscover.privacyroot.org
SRV _imaps._tcp 0 0 993 mail.privacyroot.org
SRV _imap._tcp 0 0 143 mail.privacyroot.org
SRV _pop3s._tcp 0 0 995 mail.privacyroot.org
SRV _pop3._tcp 0 0 110 mail.privacyroot.org
SRV _sieve._tcp 0 0 4190 mail.privacyroot.org
SRV _smtps._tcp 0 0 465 mail.privacyroot.org
SRV _submission._tcp 0 0 587 mail.privacyroot.org
TXT _dmarc v=DMARC1; p=none; rua=mailto:dmarc.report@privacyroot.org; ruf=mailto:dmarc.report@privacyroot.org; sp=none; ri=86400
TXT mail._domainkey v=DKIM1; h=sha256; k=rsa; p=<gibberish>
docker-compose.yml
Again, you might need to tweak this a couple times along the way, but the final compose should look something like this:
services:
mailserver:
image: docker.io/mailserver/docker-mailserver:latest
container_name: mailserver
hostname: mail.privacyroot.org
env_file: mailserver.env
environment:
- SSL_TYPE=letsencrypt
- VIRTUAL_HOST=mail.privacyroot.org,imap.privacyroot.org,smtp.privacyroot.org,pop3.privacyroot.org,pop3s.privacyroot.org
- LETSENCRYPT_HOST=mail.privacyroot.org,imap.privacyroot.org,smtp.privacyroot.org,pop3.privacyroot.org,pop3s.privacyroot.org
- LETSENCRYPT_DOMAIN=mail.privacyroot.org,imap.privacyroot.org,smtp.privacyroot.org,pop3.privacyroot.org,pop3s.privacyroot.org
- ENABLE_MANAGESIEVE=1
ports:
- "25:25" # SMTP (explicit TLS => STARTTLS)
- "110:110" # POP3
- "143:143" # IMAP4 (explicit TLS => STARTTLS)
- "465:465" # ESMTP (implicit TLS)
- "587:587" # ESMTP (explicit TLS => STARTTLS)
- "993:993" # IMAP4 (implicit TLS)
- "995:995" # POP3S (with TLS)
- "4190:4190" # Sieve
volumes:
- ./certs:/certs
- ./docker-data/acme-companion/certs/:/etc/letsencrypt/live/:ro
- ./docker-data/dms/mail-data/:/var/mail/
- ./docker-data/dms/mail-state/:/var/mail-state/
- ./docker-data/dms/mail-logs/:/var/log/mail/
- ./docker-data/dms/config/:/tmp/docker-mailserver/
- ./docker-data/dms/config/dovecot/fts-xapian-plugin.conf:/etc/dovecot/conf.d/10-plugin.conf:ro
- ./docker-data/dms/config/dovecot/15-mailboxes.conf:/etc/dovecot/conf.d/15-mailboxes.conf:ro
- ./docker-data/dms/config/dovecot/10-custom.conf:/etc/dovecot/conf.d/10-custom.conf
- ./docker-data/dms/config/dovecot/dovecot.conf:/etc/dovecot/dovecot.conf
- ./docker-data/dms/config/amavis/50-user:/etc/amavis/conf.d/50-user
- ./docker-data/dms/config/postgrey/whitelist_clients.local:/etc/postgrey/whitelist_clients.local
- ./docker-data/dms/config/main.cf:/etc/postfix/main.cf
- ./docker-data/dms/config/spamassassin/local.cf:/etc/spamassassin/local.cf
- /etc/localtime:/etc/localtime:ro
restart: always
stop_grace_period: 1m
cap_add:
- NET_ADMIN
- SYS_PTRACE
networks:
- mailserver
reverse-proxy:
image: nginxproxy/nginx-proxy
container_name: nginx-proxy
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./docker-data/nginx-proxy/html/:/usr/share/nginx/html/
- ./docker-data/nginx-proxy/vhost.d/:/etc/nginx/vhost.d/
- ./docker-data/nginx-proxy/conf.d/:/etc/nginx/conf.d/
- ./docker-data/acme-companion/certs/:/etc/nginx/certs/:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
- dhparam:/etc/nginx/dhparam
networks:
- mailserver
- nginx
acme-companion:
image: nginxproxy/acme-companion
container_name: nginx-proxy-acme
restart: always
environment:
- NGINX_PROXY_CONTAINER=nginx-proxy
volumes:
- ./docker-data/nginx-proxy/html/:/usr/share/nginx/html/
- ./docker-data/nginx-proxy/vhost.d/:/etc/nginx/vhost.d/
- ./docker-data/acme-companion/certs/:/etc/nginx/certs/:rw
- ./docker-data/acme-companion/acme-state/:/etc/acme.sh/
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- mailserver
- nginx
autodiscover-privacyroot:
image: monogramm/autodiscover-email-settings:latest
container_name: autodiscover-privacyroot
ports:
- 8000:8000
environment:
- VIRTUAL_HOST=autodiscover.privacyroot.org,autoconfig.privacyroot.org
- LETSENCRYPT_HOST=autodiscover.privacyroot.org,autoconfig.privacyroot.org
- COMPANY_NAME=privacyroot.org
- SUPPORT_URL=https://autodiscover.privacyroot.org
- DOMAIN=privacyroot.org
# IMAP configuration (host mandatory to enable)
- IMAP_HOST=imap.privacyroot.org
- IMAP_PORT=993
- IMAP_SOCKET=SSL
# POP configuration (host mandatory to enable)
- POP_HOST=pop3s.privacyroot.org
- POP_PORT=995
- POP_SOCKET=SSL
# SMTP configuration (host mandatory to enable)
- SMTP_HOST=smtp.privacyroot.org
- SMTP_PORT=465
- SMTP_SOCKET=SSL
# MobileSync/ActiveSync configuration (url mandatory to enable)
- MOBILESYNC_URL=https://activesync.privacyroot.org
- MOBILESYNC_NAME=activesync.privacyroot.org
# Apple mobile config identifiers (identifier mandatory to enable)
- PROFILE_IDENTIFIER=org.privacyroot.autodiscover
- PROFILE_UUID=92943D26-CAB3-4086-897D-DC6C0D8B1E86
- MAIL_UUID=7A981A9E-D5D0-4EF8-87FE-39FD6A506FAC
- LDAP_UUID=6ECB6BA9-2208-4ABF-9E60-4E9F4CD7309E
networks:
- mailserver
roundcube:
image: roundcube/roundcubemail:latest
container_name: roundcube
restart: always
volumes:
- ./roundcube/webmail:/var/www/html
- ./roundcube/keys:/var/roundcube/keys
ports:
- 9002:80
environment:
- VIRTUAL_HOST=webmail.privacyroot.org
- LETSENCRYPT_HOST=webmail.privacyroot.org
- ROUNDCUBEMAIL_DB_TYPE=sqlite
- ROUNDCUBEMAIL_SKIN=elastic
- ROUNDCUBEMAIL_DEFAULT_HOST=tls://imap.privacyroot.org
- ROUNDCUBEMAIL_SMTP_SERVER=tls://smtp.privacyroot.org
networks:
- mailserver
volumes:
dhparam:
networks:
mailserver:
external: true
nginx:
external: true
Ensure any mounted volumes exist before starting the stack.
DKIM
Create the DKIM keys with: ./setup.sh config dkim keysize 2048
It should output something like:
Creating DKIM private key /tmp/docker-mailserver/opendkim/keys/privacyroot.org/mail.private
Edit as needed if malformed, a properly formatted one should look like this with no extra quotes or spaces:
mail._domainkey IN TXT "v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApMU3Fud7e/nls42ZFhQatGG1/Z4Ne70HzLiB3r+stKXn+X2DHcIiX64FJ91C2SIof8PexLflFrn+VDGRlNNgQAlNjDU0B3fMIsUBDqkKUbSFYnIX3hRV/1XHWTzpA023Dt7ZBzS4OMRvmgQ9J1AcvMzE6t9N9owVwRo+XIqigdfK9JG+P9fr20FGF+tCQJk0nysRwZGQr3LoXf5nR9kKhSWBJiQCqbm5BFIS4A91NpSKwlHeiIB8RYc7OGSTtP973s1M1mk9LmwCBTgAvg1CY5xf3PO/LbxPVGq15+DMuW4wMdPjEoeHA9dk9TCfzS7P1/qTuRS8cbOipUw5Arx4FQIDAQAB"
Copy the key and add it to DNS which should look something like this:
TXT mail._domainkey v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApMU3Fud7e/nls42ZFhQatGG1/Z4Ne70HzLiB3r+stKXn+X2DHcIiX64FJ91C2SIof8PexLflFrn+VDGRlNNgQAlNjDU0B3fMIsUBDqkKUbSFYnIX3hRV/1XHWTzpA023Dt7ZBzS4OMRvmgQ9J1AcvMzE6t9N9owVwRo+XIqigdfK9JG+P9fr20FGF+tCQJk0nysRwZGQr3LoXf5nR9kKhSWBJiQCqbm5BFIS4A91NpSKwlHeiIB8RYc7OGSTtP973s1M1mk9LmwCBTgAvg1CY5xf3PO/LbxPVGq15+DMuW4wMdPjEoeHA9dk9TCfzS7P1/qTuRS8cbOipUw5Arx4FQIDAQAB
Verify the status after giving time for DNS propagation with:
dig mail._domainkey.privacyroot.org TXT
It may display malformed output there, that's OK.
;; ANSWER SECTION:
mail._domainkey.privacyroot.org. 239 IN TXT "v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApMU3Fud7e/nls42ZFhQatGG1/Z4Ne70HzLiB3r+stKXn+X2DHcIiX64FJ91C2SIof8PexLflFrn+VDGRlNNgQAlNjDU0B3fMIsUBDqkKUbSFYnIX3hRV/1XHWTzpA023Dt7ZBzS4OMRvmgQ9J1AcvMzE6t9N9owVwRo+XIqigdfK9JG+P9fr20F" "GF+tCQJk0nysRwZGQr3LoXf5nR9kKhSWBJiQCqbm5BFIS4A91NpSKwlHeiIB8RYc7OGSTtP973s1M1mk9LmwCBTgAvg1CY5xf3PO/LbxPVGq15+DMuW4wMdPjEoeHA9dk9TCfzS7P1/qTuRS8cbOipUw5Arx4FQIDAQAB"
Verify the logs with docker-compose logs -f that shows something like mail opendkim[235]: AC4B624E0318: DKIM-Signature field added.
DMARC
Add a DNS TXT record for _dmarc.privacyroot.org wtih value of:
v=DMARC1; p=none; rua=mailto:dmarc.report@privacyroot.org; ruf=mailto:dmarc.report@privacyroot.org; sp=none; ri=86400
MX & SPF
Add an MX and SPF record to DNS:
privacyroot.org IN MX 1 mail.privacyroot.org
privacyroot.org IN TXT "v=spf1 mx ~all"
Encryption-at-rest
Enable Dovecot official Mail-Crypt plugin for server-side encryption-at-rest. First create config file ./config/dovecot/10-custom.conf with:
# Enables mail_crypt for all services (imap, pop3, etc)
mail_plugins = $mail_plugins mail_crypt
plugin {
mail_crypt_global_private_key = </certs/ecprivkey.pem
mail_crypt_global_public_key = </certs/ecpubkey.pem
mail_crypt_save_version = 2
}
Shut down mailserver if it's running with docker-compose down. Create cert folder ./certs and cd into it to create encryption keys.
Generate global private EC key:
openssl ecparam -name prime256v1 -genkey | openssl pkey -out ecprivkey.pem
Generate public key from it:
openssl pkey -in ecprivkey.pem -pubout -out ecpubkey.pem
Ensure the ./certs folder is correctly mounted as a volume in the Docker.
Autodiscover / Autoconfig
Based off monogramm/autodiscover-email-settings. Ensure the DNS and Docker configurations are correct for this as above.
Added nginx configuration file in ./docker-data/nginx-proxy/conf.d/autodiscover:
server {
listen 80;
server_name autodiscover.privacyroot.org autoconfig.privacyroot.org;
location / {
proxy_pass http://172.27.0.5:8000;
}
}
The IP needs to match the autodiscover container IP (using container name might work better).
Full-text Search
Create Dovecot configuration file at: ./docker-data/dms/config/dovecot/fts-xapian-plugin.conf:
mail_plugins = $mail_plugins fts fts_xapian
plugin {
fts = xapian
fts_xapian = partial=3 full=20 verbose=0
fts_autoindex = yes
fts_enforced = yes
# disable indexing of folders
# fts_autoindex_exclude = \Trash
# Index attachements
# fts_decoder = decode2text
}
service indexer-worker {
# limit size of indexer-worker RAM usage, ex: 512MB, 1GB, 2GB
vsz_limit = 2GB
}
# service decode2text {
# executable = script /usr/libexec/dovecot/decode2text.sh
# user = dovecot
# unix_listener decode2text {
# mode = 0666
# }
# }
Ensure appropriate bind mount is in the Docker:
Initialize indexing for all mail, all users with:
docker-compose exec mailserver doveadm index -A -q *
Add that to daily cron:
docker-compose exec mailserver doveadm fts optimize -A
Roundcube + PGP
Ensure the DNS and Docker are configured as above.
Once running, get into the container, create keys and set permissions:
docker exec -it roundcube bash
cd /var/roundcube
mkdir keys
chown www-data keys
chmod www-data keys
chmod 700 keys
Copy Enigma config:
cp /var/www/html/plugins/enigma/config.inc.php.dist /var/www/html/plugins/enigma/config.inc.php
Edit the config.inc.php to include key homedir:
$config['enigma_pgp_homedir'] = '/var/roundcube/keys';
Now edit Roundcube config at /var/www/html/config/config.inc.php to include the plugin:
$config['plugins'] = [
'enigma',
];
Be sure to restart the container.
Backups
Back up the config and mail folders with:
tar --gzip -cf "backup-$(date +%F).tar.gz" ./docker-data/dms
Restore with:
tar --gzip -xf backup-date.tar.gz
It might be a good idea to combine this with Borg or Kopia.
ManageSieve
Edit mailserver.env and set ENABLE_MANAGESIEVE=1. Ensure port 4190 is open in the firewall and Docker.
Enable managesieve plugin in Roundcube:
sudo nano ./roundcube/webmail/config/config.inc.php
$config['plugins'] = [
'enigma',
'archive',
'managesieve',
'password',
];
Set managesieve plugin configuration:
sudo nano ./roundcube/webmail/plugins/managesieve/config.inc.php:
<?php
// managesieve server port. When empty the port will be determined automatically
// using getservbyname() function, with 4190 as a fallback.
$config['managesieve_port'] = 4190;
// managesieve server address, default is localhost.
// Replacement variables supported in host name:
// %h - user's IMAP hostname
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// For example %n = mail.domain.tld, %d = domain.tld
$config['managesieve_host'] = 'tls://imap.privacyroot.org';
$config['managesieve_conn_options'] = array(
'ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)
);
// authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
// or none. Optional, defaults to best method supported by server.
// $config['managesieve_auth_type'] = null;
// Optional managesieve authentication identifier to be used as authorization proxy.
// Authenticate as a different user but act on behalf of the logged in user.
// Works with PLAIN and DIGEST-MD5 auth.
// $config['managesieve_auth_cid'] = null;
// Optional managesieve authentication password to be used for imap_auth_cid
// $config['managesieve_auth_pw'] = null;
// use or not TLS for managesieve server connection
// Note: tls:// prefix in managesieve_host is also supported
// $config['managesieve_usetls'] = false;
// Connection socket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation
//$config['managesieve_conn_options'] = [
// 'ssl' => [
// 'verify_peer' => true,
// 'verify_depth' => 3,
// 'cafile' => '/etc/openssl/certs/ca.crt',
// ],
// ];
// Note: These can be also specified as an array of options indexed by hostname
// $config['managesieve_conn_options'] = null;
// A file with default script content (e.g. spam filter)
$config['managesieve_default'] = '/etc/dovecot/sieve/global';
// The name of the script which will be used when there's no user script
$config['managesieve_script_name'] = 'managesieve';
// Sieve RFC says that we should use UTF-8 encoding for mailbox names,
// but some implementations work with UTF7-IMAP encoding only.
// Defaults to UTF7-IMAP
$config['managesieve_mbox_encoding'] = 'UTF-8';
// I need this because my dovecot (with listescape plugin) uses
// ':' delimiter, but creates folders with dot delimiter
$config['managesieve_replace_delimiter'] = '';
// disabled sieve extensions (body, copy, date, editheader, encoded-character,
// envelope, environment, ereject, fileinto, ihave, imap4flags, index,
// mailbox, mboxmetadata, regex, reject, relational, servermetadata,
// spamtest, spamtestplus, subaddress, vacation, variables, virustest, etc.
// Note: not all extensions are implemented
$config['managesieve_disabled_extensions'] = [];
// Enables debugging of conversation with sieve server. Logs it into <log_dir>/sieve
$config['managesieve_debug'] = false;
// Enables features described in http://wiki.kolab.org/KEP:14
$config['managesieve_kolab_master'] = false;
// Script name extension used for scripts including. Dovecot uses '.sieve',
// Cyrus uses '.siv'. Doesn't matter if you have managesieve_kolab_master disabled.
$config['managesieve_filename_extension'] = '.sieve';
// List of reserved script names (without extension).
GNU nano 4.8 roundcube/webmail/plugins/managesieve/config.inc.php
// List of domains limiting destination emails in redirect action
// If not empty, user will need to select domain from a list
$config['managesieve_domains'] = [];
// Default list of entries in header selector
$config['managesieve_default_headers'] = ['Subject', 'From', 'To'];
// Enables separate management interface for vacation responses (out-of-office)
// 0 - no separate section (default),
// 1 - add Vacation section,
// 2 - add Vacation section, but hide Filters section
$config['managesieve_vacation'] = 0;
// Enables separate management interface for setting forwards (redirect to and copy to)
// 0 - no separate section (default),
// 1 - add Forward section,
// 2 - add Forward section, but hide Filters section
$config['managesieve_forward'] = 0;
// Default vacation interval (in days).
// Note: If server supports vacation-seconds extension it is possible
// to define interval in seconds here (as a string), e.g. "3600s".
$config['managesieve_vacation_interval'] = 0;
// Some servers require vacation :addresses to be filled with all
// user addresses (aliases). This option enables automatic filling
// of these on initial vacation form creation.
$config['managesieve_vacation_addresses_init'] = false;
// Sometimes you want to always reply with mail email address
// This option enables automatic filling of :from field on initial vacation form creation.
$config['managesieve_vacation_from_init'] = false;
// Supported methods of notify extension. Default: 'mailto'
$config['managesieve_notify_methods'] = ['mailto'];
// Enables scripts RAW editor feature
$config['managesieve_raw_editor'] = true;
// Disabled actions. Prevents user from performing specific actions by disabling
// the UI elements:
// - list_sets,
// Note: disabling list_sets removes the Filter sets widget from the UI and means
// the set defined in managesieve_script_name will always be used (and activated)
// - enable_disable_set,
// - delete_set,
// - new_set,
// - download_set,
// - new_filter,
// - delete_filter,
// - redirect: This one will remove 'redirect' option from the filter actions selector
// Note: This will not remove it for redirect actions already existing in the script.
// Note: This has no impact on the Forwarding UI
$config['managesieve_disabled_actions'] = [];
// List of hosts that support managesieve.
// Activate managesieve for selected hosts only. If this is not set all hosts are allowed.
// Example: $config['managesieve_allowed_hosts'] = ['host1.mydomain.com', 'host2.mydomain.com'];
$config['managesieve_allowed_hosts'] = null;
Amavis / ClamAV
This kept appending "UNCHECKED". Fixed by mounting Amavis config 50-user:
./docker-data/dms/config/amavis/50-user:/etc/amavis/conf.d/50-user and added:
$admin_maps_by_ccat{CC_UNCHECKED.',1'} = undef;
and:
$undecipherable_subject_tag = undef;
And restart.
WKD
Web Key Directory (WKD) allows PGP pubkeys to be auto-discovered. Followed the guide here.
Created the folder: mkdir -p /home/md/hugo/privacyroot.org/public/.well-known/openpgpkey/hu
Then created the empty file: touch /home/md/hugo/privacyroot.org/public/.well-known/openpgpkey/policy
Then created a hash of the key: gpg --with-wkd-hash -k (take note of the hash@domain.tld)
Then export the pubkey in binary format: gpg --no-armor --epxort email@example.com > hash and upload that file to the ./well-known/openpgpkey/hu directory. Done!
Administration
Set an alias:
alias mailserver="/home/marc/docker/docker-mailserver/setup.sh"
Make it permanent by adding it to ~/.bashrc.
Now you can do this globally:
mailserver email add userName@privacyroot.org somePassword
Some more commands include:
- Create account:
mailserver email add user@privacyroot.org password - Update password:
mailserver email update user@privacyroot.org newPassword - Delete email:
mailserver email del user@privacyroot.org - Set quota:
mailserver quota set user@privacyroot.org 10G - Add alias:
mailserver alias add newAlias@privacyroot.org user@privacyroot.org - Delete alias:
mailserver alias del alias@privacyroot.org user@privacyroot.org - Disable sending:
mailserver email restrict add send user@privacyroot.org - Disable receiving:
mailserver email restrict add receive user@privacyroot.org - List send disabled:
mailserver email restrict list send - List receive disabled:
mailserver email restrict list receive - Enable sending:
mailserver email restrict del send user@privacyroot.org - Enable receiving:
mailserver email restrict del receive user@privacyroot.org - List emails:
mailserver email list - List aliases:
mailserver alias list
Deliverability
Go through MS checklist.
Troubleshooting
Set the LOG_LEVEL in mailserver.env to debug.
Check /var/log and /var/log/mail and /var/log/supervisor in the container.
From host machine, check fail2ban:
mailserver debug fail2ban
Unban:
mailserver debug fail2ban unban x.x.x.x
Show logs:
mailserver debug show-mail-logs