- About
- Installation
- Running the Mailserver
- Accessing Modoboa's Webinterface
- Enabling DKIM-signed Emails
- Using CalDAV and CardDAV for synchronized calendars and contacts
- DNS Settings
- Replacing SSL-Certificates and -Keys
- Technical background
- Avoiding the necessity of sudo
- Supported CPU Architectures
- Links
The mklive.sh script builds a customized mdb-live Docker Image.
The mdb-live Docker Image provides a fully featured dockerized Mailserver including
- Modoboa Webinterface for
- domain and user management
- webmailer
- managing calenders and contacts
- managing autoresponse emails
- SpamAssassin Anti-Spam-Filter
- Postfix SMTP Server
- Dovecot IMAP Server
- ClamAV Virus Scanner
- AutoMX for automated mail account configuration in email clients
- Radicale CalDAV and CardDAV Server
- MariaDB Database Server
- OpenDKIM for automaticly signing outgoing emails to reduce risk of emails being falsely classified as spam
- Apache Webserver for handling requests to the Modoboa Webinterface, AutoMX and Radicale within the Docker Container running mdb-live
- Nginx Reverse Proxy for forwarding requests from the outside world to the Apache Webserver
(for more details see Technical background)
- Clone this repository to your harddrive, e.g. by running
$ git clone https://github.com/tsitle/dockercontainer-mdb_dc_mklive.git - Change the working directory, e.g. by running
$ cd dockercontainer-mdb_dc_mklive - Copy the file config-SAMPLE.sh to config.sh
- Edit config.sh if you want to change the defaults
- run
$ sudo ./mklive.sh
At this point the Docker Image mdb-live should have been installed.
You could remove the Docker Image mdb-install now if you wanted to.
Now you'll need to set the Docker Container environment up:
- Create a directory for the dockerized Mailserver, e.g. ./dockercontainer-mailserver/
- Copy the files
build-output/dockercontainer/docker-compose.yaml and
build-output/dockercontainer/mariadb-dbs-vanilla.tgz and
build-output/dockercontainer/dc-mdb.sh
from the mdb-dc-mklive directory to
./dockercontainer-mailserver/
If you experience problems with docker-compose you might need a more recent version of docker-compose.
E.g. if you see an error message that begins with "free(): invalid pointer" when using docker-compose you definitely need a newer version.
See GitHub Repositories for docker-compose below.
Change the working directory, e.g. by running
$ cd ./dockercontainer-mailserver
To create and start the Mail- and Database-Server's Docker Containers run
$ sudo ./dc-mdb.sh up
Please note that it will take about 30s until all services inside the mdb-live container are running.
When started for the first time ClamAV will update its virus signatures which can take a couple of minutes.
Until all services are running you'll see "502 Bad Gateway" when accessing Modoboa's Webinterface.
You can verify whether all services have been started by running
$ sudo ./dc-mdb.sh logs -f modo
and wait until you see the line
All services have been started
Then hit CTRL-C to detach from the logs.
To stop the Mail- and Database-Server run
$ sudo ./dc-mdb.sh stop
To start the Mail- and Database-Server again run
$ sudo ./dc-mdb.sh start
To remove the Mail- and Database-Server's Docker Containers again run
$ sudo ./dc-mdb.sh down
For troubleshooting you can access the console output from the Docker Container's startup script by running:
$ sudo ./dc-mdb.sh logs
Change the working directory, e.g. by running
$ cd ./dockercontainer-mailserver
Extract the raw DB files
$ tar xf mariadb-dbs-vanilla.tgz
To create and start the Mail- and Database-Server's Docker Containers run
$ sudo docker-compose -p mdb up --no-start && docker-compose -p mdb start
To stop the Mail- and Database-Server run
$ sudo docker-compose -p mdb stop
To start the Mail- and Database-Server again run
$ sudo docker-compose -p mdb start
To remove the Mail- and Database-Server's Docker Containers again run
$ sudo docker-compose -p mdb down
For troubleshooting you can access the console output from the Docker Container's startup script by running:
$ sudo docker-compose -p mdb logs modo
It is highly recommended to remove the file mariadb-dbs-vanilla.tgz after you have verified that everything is working.
Accidently unpacking the archive after you have set your mailserver up would overwrite the databases and therefor delete your domains, users, etc.
If you're using the Docker Image mdb-nginx then you should be able to log into Modoboa's Webinterface by opening
https://<MAILHOSTNAME>.<MAILDOMAIN>
(e.g. https://mail.localdomain.local)
in your browser.
Default login for Modoboa's Webinterface:
User: admin
Password: password
When creating a new domain you may enable DKIM-signed emails by activating the option Enable DKIM signing in the create domain entry dialog in Modoboa's webinterface.
You may also enable that option for existing domains.
A key length of 2048 is advisable since 1024 is considered weak and 4096 may not be supported by all email servers.
Also see the section DNS Settings
- Log into Modoboa's Webinterface as a regular user (i.e. not the admin user)
- go to the calendar page
- click on "+ New calendar" on the left side of the page
- enter a name for the calendar and
- click on the "Create" button
You should now have created a new calendar.
To access the calendar from another application, like Mozilla Thunderbird, you'll need the calendar's URL.
To obtain the URL click on your calendar's entry on the left side of the page and then on "Information" in the context menu.
Note that the CalDAV server (= Radicale) does not seem to be compatible with all versions of Apple's Calendar app.
- Log into Modoboa's Webinterface as a regular user (i.e. not the admin user)
- click on your username in the upper right corner of the page
and click on "Settings" in the context menu - click on "Settings" on the left side of the page
- click on the "Contacts" tab
- set "Synchonize address book using CardDAV?" to "yes"
- save the settings
To access your contacts from another application, like Mozilla Thunderbird, you'll need the URL.
To obtain the URL, go to the contacts page and click on the "i" (Information) button on the right side of the page next to the "+ Add" button.
You'll need to add a MX Record like the following to your webhoster's DNS settings:
<HOSTNAME> IN A <PUBLIC IP ADDRESS>
IN MX <HOSTNAME>.<DOMAIN>.
where
<HOSTNAME> might be mail
<DOMAIN> might be somedomain.org
<PUBLIC IP ADDRESS> might be 111.222.33.44
For using DKIM-signed emails you'll need to add a TXT Record to your webhoster's DNS settings:
- Log in as admin in Modoboa's webinterface
- Go to the Domains page
- Click on your domain's entry
- In the tab DNS click on Show key next to DKIM key
- Use the text in the second box (Bind/named format) for adding the TXT Record.
Depending on your webhoster you might need to strip the text from all quotemarks, line-breaks and tabulator-chars.
Before replacing SSL-Certificates and -Keys in the Docker Container's mountpoints
mountpoints-modo/ssl-certs/ and mountpoints-modo/ssl-keys/,
you should
- stop the Docker Containers (e.g. by using
$ ./dc-mdb.sh stop), - replace the files and then
- start the Docker Containers again (e.g. by using
$ ./dc-mdb.sh start)
mklive.sh uses Docker-in-Docker to generate the output Docker Image and other files.
Therefor it needs access to the socket /var/run/docker.sock, which the mklive.sh script bind-mounts upon execution.
What mklive.sh does:
- generate DB root password
- create DB schemes for Modoboa/Amavis/Spamassassin
create DB users + passwords for Modoboa/... DB schemes
remove DB dumps from Install-Image - generate default password for user accounts that Modoboa automaticly creates
- generate secret key for Modoboa's crypto module
- generate docker-compose.yaml
- create tarball of DB Server's mointpoint with raw DB files
- create Docker Image mdb-live based on mdb-install
- create tarball of Docker Image mdb-live - suitable for importing the image with Docker
To run Docker commands without having to use sudo all the time,
you'll need to add your user to the 'docker' usergroup:
$ sudo usermod -a -G docker <USERNAME>
Then log out from your current shell (or close the terminal window)
and log in again (or open a new terminal window).
Be aware of possible security implications though.
See Docker daemon attack surface link below for more information.
- amd64/x86_64
- aarch64/arm64v8/arm64
- armv7l/arm32v7/armhf
- Docker Image mdb-mkinstall
- Docker Container mdb-dc-mkinstall
- Docker Image mdb-mklive
- Docker Container mdb-dc-mklive
- docker-compose binary for
amd64/x86_64
aarch64/arm64v8/arm64
armv7l/arm32v7/armhf
- Docker Hub Repositories tsle/