Skip to content

Dockerized Postal SMTP Server based on Alpine Linux and Ruby

License

Notifications You must be signed in to change notification settings

siebsie23/docker-postal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker-Postal

GitHub release Build Status


About

This is a fork of the tiredofit/docker-postal repository that is updated to use the latest version of Postal and fix some bugs.

Docker-Postal is a Dockerfile to build a Postal SMTP server for sending and receiving SMTP / HTTP API email.

  • Contains Fail2Ban for blocking repeat authentication offenders

Prerequisites

Installation

Use the pre-built package

Prebuilt images are available on Docker Hub at siebsie23/docker-postal and are built daily.

Available tags:

Image tag Description
main Postal image built on the 'main' branch containing the latest and in-development features (Stuff will break, use at your own risk!)
latest Latest postal v3 release
*.*.* Postal image built on a release tag. To view all available images visit siebsie23/docker-postal/tags

Build from Source

Clone this repository and build the image with make build POSTAL_VERSION="version" version being a valid postal branch or tag.

Configuration

Quick Start

Persistent Storage

The following directories are used for configuration and can be mapped for persistent storage.

Directory Description
/config/ Auto generated Postal Config and Signing Key resides here
/logs/ Logfiles
/assets/custom Optional Use this to drop files overop of the Postal sourcode for cherry picked overrides of files

Environment Variables

Base Images used

This image relies on an Alpine Linux base image that relies on an init system for added capabilities. Outgoing SMTP capabilities are handlded via msmtp. Individual container performance monitoring is performed by zabbix-agent. Additional tools include: bash,curl,less,logrotate, nano,vim.

Be sure to view the following repositories to understand all the customizable options:

Image Description
OS Base Customized Image based on Alpine Linux

Admin Accounts

Parameter Description Default
ADMIN_EMAIL Email address of admin [email protected]
ADMIN_FNAME Name of Admin First Name Postal
ADMIN_LNAME Name of Admin Last Name Admin
ADMIN_PASS Password of Admin user PostalMailServer

Application Settings

Parameter Description Default
MAXIMUM_DELIVERY_ATTEMPTS Maximum Delivery Attempts before failing 18
MAXIMUM_HOLD_EXPIRY_DAYS Maximum Holding days before expiring 7
SUPPRESSION_LIST_AUTOMATIC_REMOVAL_DAYS Suppression List expiry in days 30

DNS Settings

Parameter Description Default
DNS_HELO_HOSTNAME HELO Domain Name Mail Server postal.example.com
DNS_MX MX Record Hostnames - Seperate multiple with commas
DNS_SPF_INCLUDE SPF Hostname spf.$DNS_HELO_HOSTNAME
DNS_RETURN_PATH_DOMAIN Return path Hostname rp.$DNS_HELO_HOSTNAME
DNS_ROUTE_DOMAIN Routing Domain routes.$DNS_HELO_HOSTNAME
DNS_TRACK_DOMAIN Tracking Domain track.$DNS_HELO_HOSTNAME
DNS_DKIM_IDENTIFIER DKIM Identifier postal
DNS_DOMAIN_VERIFY_PREFIX Domain verification prefix postal-verification
DNS_RETURN_PATH_PREFIX Custom Return Path Prefix psrp

Security Settings

Parameter Description Default
ENABLE_FAIL2BAN Block hsots that repeatedly fail authentication TRUE
FAIL2BAN_LOG_FILE Log Location for Fail2ban /logs/fail2ban/fail2ban.log
FAIL2BAN_TIME_FIND Track failures for this time period 10m
FAIL2BAN_TIME_BAN Time to ban repeat offenders 10m
FAIL2BAN_MAX_RETRY Ban after how many tries during time period 5

Performance Settings

Parameter Description Default
WORKERS_THREADS Amount of Threads per worker. 2
WEB_MAX_THREADS Maximum amount of webserver threads 5

Logging Settings

Parameter Description Default
LOG_CONSOLE Log to Stdout Console true or false true
LOG_PATH Log Location /logs/
LOG_SIZE_MAX Maximum Log Size in KB 9999

Database Settings

Parameter Description Default
DB_HOST Hostname of MariaDB Container e.g. postal-db
DB_NAME Name of MariaDB Database e.g. postal
DB_USER Database Username e.g. postal
DB_PASS Password for Above User e.g. password
DB_PORT MariaDB Server Port 3306
DB_ROOT_PASS Needed for first boot - Assigns privileges to $DB_USER. This is your MariaDB Root Pass

Anti Spam Settings

Parameter Description Default
ENABLE_SPAMASSASSIN Enable Spamassassin true or false false
SPAMASSASSIN_HOST Hostname of Spamassassin daemon
SPAMASSASSIN_PORT TCP Port of spamassassin daemon 737
Parameter Description Default
ENABLE_RSPAMD Enable RSpamD checking true or false false
RSPAMD_FLAGS Flags to pass to rspamd daemon null
RSPAMD_HOST Hostname of rspamd daemon
RSPAMD_PASS RSpamd controller password null
RSPAMD_PORT TCP Port of rspamd daemon 11334
RSPAMD_SSL Use SSL for connecting to rspamd FALSE
Parameter Description Default
SPAM_THRESHOLD Amount to classify as Spam 5
SPAM_FAILURE_THRESHOLD Amount to fail as Spam 20

Anti Virus Settings

Parameter Description Default
ENABLE_CLAMAV Enable ClamAV true or false false
CLAMAV_HOST Hostname of Clamd Server
CLAMAV_PORT TCP Port of Clamd Server 3310

SMTP Settings

Client
Parameter Description Default
SMTP_CLIENT_OPEN_TIMEOUT Timeout for an Open Connection in seconds 30
SMTP_CLIENT_READ_TIMEOUT Timeout for Reading Data in seconds 30
Server
Parameter Description Default
SMTP_SERVER_HOSTNAME SMTP Server hostname $DNS_HELO_HOSTNAME
SMTP_SERVER_ENABLE_TLS Enable TLS false
SMTP_SERVER_LOG_CONNECTIONS Log SMTP Connections false
SMTP_SERVER_MAX_MESSAGE_SIZE Max message size in Megabytes 50
SMTP_SERVER_PORT Listening Port for Postal Main SMTP Server 25
SMTP_SERVER_PROXY_PROTOCOL Utilize Proxy Protocol false
SMTP_SERVER_TLS_SSL_VERSION SSL Versions SSLv23
SMTP_SERVER_TLS_CERT TLS Cert Location (Will authgenerate if not exist) /certs/cert.pem
SMTP_SERVER_TLS_CIPHERS TLS Ciphers to use
SMTP_SERVER_TLS_KEY TLS Key Location (Will autogenerate if not exist) /certs/key.pem
Management System
Parameter Description Default
SMTP_FROM_ADDRESS From Address for Postam Management System [email protected]
SMTP_FROM_NAME From Name for Postal Management System Postal
SMTP_HOST SMTP Server to be used to send messages from Postal Management System to users 127.0.0.1
SMTP_PORT SMTP Port to be used to send messages from Postal Management System to Users 25
SMTP_USER Username to authenticate to SMTP Server
SMTP_PASS Password to authenticate to SMTP Server

Other Settings

Parameter Description Default
CONFIG_FILE Configuration File postal.yml
CONFIG_PATH Configuration Path /config/
FAST_SERVER_BIND_IP Bind IP for the Web Interface 0.0.0.0
FAST_SERVER_BIND_PORT_TLS Bind Port for the TLS Tracking Service 8443
FAST_SERVER_BIND_PORT Bind Port for the Tracking Server 8080
SETUP_TYPE Choose AUTO or MANUAL Setup type - Auto uses these environment variables AUTO
SIGNING_KEY_FILE Signing Key File signing.key
SIGNING_KEY_SIZE Signing Key Size 1024
WEB_BIND_ADDRESS Bind IP for the Web Interface 0.0.0.0
WEB_PORT Bind Port for the Web Interface 5000
WEB_HOSTNAME Hostname for Web Interface postal.example.com
WEB_PROTOCOL Protocol for Web Interface http or https http
WORKER_HEALTH_SERVER_BIND_ADDRESS Bind IP for the worker health server 0.0.0.0
WORKER_HEALTH_SERVER_PORT Bind Port for the worker health server 9090

Networking

Port Description
25 SMTP
80 Web Interface
8080 Fast Server /Tracking
8443 Fast Server / Tracking
5000 Puma`

Maintenance

Shell Access

For debugging and maintenance purposes you may want access the containers shell.

bash docker exec -it (whatever your container name is) bash

Support

Bugfixes

  • Please, submit a Bug Report if something isn't working as expected. I'll do my best to issue a fix in short order.

License

MIT. See LICENSE for more details.

References

About

Dockerized Postal SMTP Server based on Alpine Linux and Ruby

Resources

License

Stars

Watchers

Forks

Languages

  • Dockerfile 61.5%
  • Makefile 38.5%