Remove docs
parent
eb6bc9e738
commit
2f4e9305eb
|
@ -1,301 +0,0 @@
|
|||
## SSL (and: How to use Let's Encrypt)
|
||||
|
||||
mailcow dockerized comes with a snakeoil CA "mailcow" and a server certificate in `data/assets/ssl`. Please use your own trusted certificates.
|
||||
|
||||
mailcow uses 3 domain names that should be covered by your new certificate:
|
||||
|
||||
- ${MAILCOW_HOSTNAME}
|
||||
- autodiscover.**example.org**
|
||||
- autoconfig.**example.org**
|
||||
|
||||
### Obtain multi-SAN certificate by Let's Encrypt
|
||||
|
||||
This is just an example of how to obtain certificates with certbot. There are several methods!
|
||||
|
||||
1\. Get the certbot client:
|
||||
``` bash
|
||||
wget https://dl.eff.org/certbot-auto -O /usr/local/sbin/certbot && chmod +x /usr/local/sbin/certbot
|
||||
```
|
||||
|
||||
2\. Make sure you set `HTTP_BIND=0.0.0.0` and `HTTP_PORT=80` in `mailcow.conf` or setup a reverse proxy to enable connections to port 80. If you changed HTTP_BIND, then rebuild Nginx:
|
||||
``` bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
3\. Request the certificate with the webroot method:
|
||||
``` bash
|
||||
cd /path/to/git/clone/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
certbot certonly \
|
||||
--webroot \
|
||||
-w ${PWD}/data/web \
|
||||
-d ${MAILCOW_HOSTNAME} \
|
||||
-d autodiscover.example.org \
|
||||
-d autoconfig.example.org \
|
||||
--email you@example.org \
|
||||
--agree-tos
|
||||
```
|
||||
|
||||
**Remember to replace the example.org domain with your own domain, this command will not work if you dont.**
|
||||
|
||||
4\. Create hard links to the full path of the new certificates. Assuming you are still in the mailcow root folder:
|
||||
``` bash
|
||||
mv data/assets/ssl/cert.{pem,pem.backup}
|
||||
mv data/assets/ssl/key.{pem,pem.backup}
|
||||
ln $(readlink -f /etc/letsencrypt/live/${MAILCOW_HOSTNAME}/fullchain.pem) data/assets/ssl/cert.pem
|
||||
ln $(readlink -f /etc/letsencrypt/live/${MAILCOW_HOSTNAME}/privkey.pem) data/assets/ssl/key.pem
|
||||
```
|
||||
|
||||
5\. Restart affected containers:
|
||||
```
|
||||
docker-compose restart postfix-mailcow dovecot-mailcow nginx-mailcow
|
||||
```
|
||||
|
||||
When renewing certificates, run the last two steps (link + restart) as post-hook in a script.
|
||||
|
||||
## Rspamd Web UI
|
||||
At first you may want to setup Rspamds web interface which provides some useful features and information.
|
||||
|
||||
1\. Generate a Rspamd controller password hash:
|
||||
```
|
||||
docker-compose exec rspamd-mailcow rspamadm pw
|
||||
```
|
||||
|
||||
2\. Replace the default hash in `data/conf/rspamd/override.d/worker-controller.inc` by your newly generated:
|
||||
```
|
||||
enable_password = "myhash";
|
||||
```
|
||||
|
||||
You can use `password = "myhash";` instead of `enable_password` to disable write-access in the web UI.
|
||||
|
||||
3\. Restart rspamd:
|
||||
```
|
||||
docker-compose restart rspamd-mailcow
|
||||
```
|
||||
|
||||
Open https://${MAILCOW_HOSTNAME}/rspamd in a browser and login!
|
||||
|
||||
## Optional: Reverse proxy
|
||||
|
||||
You don't need to change the Nginx site that comes with mailcow: dockerized.
|
||||
mailcow: dockerized trusts the default gateway IP 172.22.1.1 as proxy. This is very important to control access to Rspamd's web UI.
|
||||
|
||||
1\. Make sure you change HTTP_BIND and HTTPS_BIND in `mailcow.conf` to a local address and set the ports accordingly, for example:
|
||||
``` bash
|
||||
HTTP_BIND=127.0.0.1
|
||||
HTTP_PORT=8080
|
||||
HTTPS_PORT=127.0.0.1
|
||||
HTTPS_PORT=8443
|
||||
```
|
||||
** IMPORTANT: Do not use port 8081 **
|
||||
|
||||
Recreate affected containers by running `docker-compose up -d`.
|
||||
|
||||
2\. Configure your local webserver as reverse proxy:
|
||||
|
||||
### Apache 2.4
|
||||
``` apache
|
||||
<VirtualHost *:443>
|
||||
ServerName mail.example.org
|
||||
ServerAlias autodiscover.example.org
|
||||
ServerAlias autoconfig.example.org
|
||||
|
||||
[...]
|
||||
# You should proxy to a plain HTTP session to offload SSL processing
|
||||
ProxyPass / http://127.0.0.1:8080/
|
||||
ProxyPassReverse / http://127.0.0.1:8080/
|
||||
ProxyPreserveHost Off
|
||||
your-ssl-configuration-here
|
||||
[...]
|
||||
|
||||
# If you plan to proxy to a HTTPS host:
|
||||
#SSLProxyEngine On
|
||||
|
||||
# If you plan to proxy to an untrusted HTTPS host:
|
||||
#SSLProxyVerify none
|
||||
#SSLProxyCheckPeerCN off
|
||||
#SSLProxyCheckPeerName off
|
||||
#SSLProxyCheckPeerExpire off
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
### Nginx
|
||||
```
|
||||
server {
|
||||
listen 443;
|
||||
server_name mail.example.org autodiscover.example.org autoconfig.example.org;
|
||||
|
||||
[...]
|
||||
your-ssl-configuration-here
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080/;
|
||||
proxy_redirect http://127.0.0.1:8080/ $scheme://$host:$server_port/;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
[...]
|
||||
}
|
||||
```
|
||||
|
||||
## Optional: Setup a relayhost
|
||||
|
||||
Insert these lines to `data/conf/postfix/main.cf`. "relayhost" does already exist (empty), just change its value.
|
||||
```
|
||||
relayhost = [your-relayhost]:587
|
||||
smtp_sasl_password_maps = hash:/opt/postfix/conf/smarthost_passwd
|
||||
smtp_sasl_auth_enable = yes
|
||||
```
|
||||
|
||||
Create the credentials file:
|
||||
```
|
||||
echo "your-relayhost username:password" > data/conf/postfix/smarthost_passwd
|
||||
```
|
||||
|
||||
Run:
|
||||
```
|
||||
docker-compose exec postfix-mailcow postmap /opt/postfix/conf/smarthost_passwd
|
||||
docker-compose exec postfix-mailcow chown root:postfix /opt/postfix/conf/smarthost_passwd /opt/postfix/conf/smarthost_passwd.db
|
||||
docker-compose exec postfix-mailcow chmod 660 /opt/postfix/conf/smarthost_passwd /opt/postfix/conf/smarthost_passwd.db
|
||||
docker-compose exec postfix-mailcow postfix reload
|
||||
```
|
||||
|
||||
### Helper script
|
||||
|
||||
There is a helper script `mailcow-setup-relayhost.sh` you can run to setup a relayhost.
|
||||
|
||||
``` bash
|
||||
Usage:
|
||||
|
||||
Setup a relayhost:
|
||||
./mailcow-setup-relayhost.sh relayhost port (username) (password)
|
||||
Username and password are optional parameters.
|
||||
|
||||
Reset to defaults:
|
||||
./mailcow-setup-relayhost.sh reset
|
||||
```
|
||||
|
||||
## Optional: Log to Syslog
|
||||
|
||||
Enable Rsyslog to receive logs on 524/tcp:
|
||||
|
||||
```
|
||||
# This setting depends on your Rsyslog version and configuration format.
|
||||
# For most Debian derivates it will work like this...
|
||||
$ModLoad imtcp
|
||||
$TCPServerAddress 127.0.0.1
|
||||
$InputTCPServerRun 524
|
||||
|
||||
# ...while for Ubuntu 16.04 it looks like this:
|
||||
module(load="imtcp")
|
||||
input(type="imtcp" address="127.0.0.1" port="524")
|
||||
|
||||
# No matter your Rsyslog version, you should set this option to off
|
||||
# if you plan to use Fail2ban
|
||||
$RepeatedMsgReduction off
|
||||
```
|
||||
|
||||
Restart rsyslog after enabling the TCP listener.
|
||||
|
||||
Now setup Docker daemon to start with the syslog driver.
|
||||
This enables the syslog driver for all containers!
|
||||
|
||||
Debian users can change the startup configuration in `/etc/default/docker` while CentOS users find it in `/etc/sysconfig/docker`:
|
||||
```
|
||||
...
|
||||
DOCKER_OPTS="--log-driver=syslog --log-opt syslog-address=tcp://127.0.0.1:524"
|
||||
...
|
||||
```
|
||||
|
||||
**Caution:** For some reason Ubuntu 16.04 and some, but not all, systemd based distros do not read the defaults file parameters.
|
||||
|
||||
Just run `systemctl edit docker.service` and add the following content to fix it.
|
||||
|
||||
**Note:** If "systemctl edit" is not available, just copy the content to `/etc/systemd/system/docker.service.d/override.conf`.
|
||||
|
||||
The first empty ExecStart parameter is not a mistake.
|
||||
|
||||
```
|
||||
[Service]
|
||||
EnvironmentFile=/etc/default/docker
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS
|
||||
```
|
||||
|
||||
Restart the Docker daemon and run `docker-compose down && docker-compose up -d` to recreate the containers.
|
||||
|
||||
### Use Fail2ban
|
||||
|
||||
**This is a subsection of "Log to Syslog", which is required for Fail2ban to work.**
|
||||
|
||||
Open `/etc/fail2ban/filter.d/common.conf` and search for the prefix_line parameter, change it to ".*":
|
||||
|
||||
```
|
||||
__prefix_line = .*
|
||||
```
|
||||
|
||||
Create `/etc/fail2ban/jail.d/dovecot.conf`...
|
||||
```
|
||||
[dovecot]
|
||||
enabled = true
|
||||
filter = dovecot
|
||||
logpath = /var/log/syslog
|
||||
chain = FORWARD
|
||||
```
|
||||
|
||||
and `jail.d/postfix-sasl.conf`:
|
||||
```
|
||||
[postfix-sasl]
|
||||
enabled = true
|
||||
filter = postfix-sasl
|
||||
logpath = /var/log/syslog
|
||||
chain = FORWARD
|
||||
```
|
||||
|
||||
Restart Fail2ban.
|
||||
|
||||
## Install a local MTA
|
||||
|
||||
The easiest option would be to disable the listener on port 25/tcp.
|
||||
|
||||
**Postfix** users disable the listener by commenting the following line (starting with `smtp` or `25`) in `/etc/postfix/master.cf`:
|
||||
```
|
||||
#smtp inet n - - - - smtpd
|
||||
```
|
||||
Restart Postfix after applying your changes.
|
||||
|
||||
## Sender and receiver model
|
||||
|
||||
When a mailbox is created, a user is allowed to send mail from and receive mail for his own mailbox address.
|
||||
|
||||
Mailbox me@example.org is created. example.org is a primary domain.
|
||||
Note: a mailbox cannot be created in an alias domain.
|
||||
|
||||
me@example.org is only known as me@example.org.
|
||||
me@example.org is allowed to send as me@example.org.
|
||||
|
||||
We can add an alias domain for example.org:
|
||||
|
||||
Alias domain alias.com is added and assigned to primary domain example.org.
|
||||
me@example.org is now known as me@example.org and me@alias.com.
|
||||
me@example.org is now allowed to send as me@example.org and me@alias.com.
|
||||
|
||||
We can add aliases for a mailbox to receive mail for and to send from this new address.
|
||||
|
||||
It is important to know, that you are not able to receive mail for `my-alias@my-alias-domain.tld`. You would need to create this particular alias.
|
||||
|
||||
me@example.org is assigned the alias alias@example.org
|
||||
me@example.org is now known as alias@example.org, me@alias.com, alias@example.org
|
||||
|
||||
me@example.org is NOT known as alias@alias.com.
|
||||
|
||||
Administrators and domain administrators can edit mailboxes to allow specific users to send as other mailbox users ("delegate" them).
|
||||
|
||||
You can choose between mailbox users or completely disable the sender check for domains.
|
||||
|
||||
### SOGo "mail from" addresses
|
||||
|
||||
Mailbox users can, obviously, select their own mailbox address, as well as all alias addresses and aliases that exist through alias domains.
|
||||
|
||||
If you want to select another _existing_ mailbox user as your "mail from" address, this user has to delegate you access through SOGo (see SOGo documentation). Moreover a mailcow (domain) administrator
|
||||
needs to grant you access as described above.
|
|
@ -1,179 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="271.27399"
|
||||
height="298.871"
|
||||
viewBox="0 0 271.27398 298.871"
|
||||
enable-background="new 0 0 1600 1200"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="logo.svg"><metadata
|
||||
id="metadata144"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs142" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1203"
|
||||
inkscape:window-height="1168"
|
||||
id="namedview140"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.1125147"
|
||||
inkscape:cx="151.70799"
|
||||
inkscape:cy="136.82484"
|
||||
inkscape:window-x="561"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="g5"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0" /><g
|
||||
id="g3"
|
||||
transform="translate(-648.292,-401.988)"><g
|
||||
id="g5"><g
|
||||
id="email"
|
||||
transform="translate(0,-58)"><path
|
||||
style="fill:#5a3620"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path10"
|
||||
d="m 890.306,557.81 29.26,11.373 0,172.027 c 0,9.753 -7.895,17.649 -17.638,17.649 l -235.998,0 c -9.743,0 -17.638,-7.896 -17.638,-17.649 l 0,-172.026 29.259,-8.937" /><path
|
||||
style="fill:#fee70f;fill-opacity:0.89499996"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path12"
|
||||
d="M 758.871,656.221 649.49,747.45 c 2.507,6.648 8.901,11.409 16.44,11.409 l 235.998,0 c 7.536,0 13.933,-4.761 16.444,-11.409 l -107.402,-91.229 -52.099,0 z" /><g
|
||||
id="g14"><path
|
||||
style="fill:#f9e82d;fill-opacity:1"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path16"
|
||||
d="m 810.391,656.686 107.981,90.764 c -0.331,0.881 -0.744,1.726 -1.205,2.536 l 0.028,0.035 c 1.501,-2.596 2.371,-5.594 2.371,-8.81 l 0,-172.004 -109.175,87.479 z" /><path
|
||||
style="fill:#f9e82d;fill-opacity:1"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path18"
|
||||
d="m 649.49,747.45 108.864,-90.764 -110.061,-87.479 0,172.003 c 0,3.216 0.876,6.214 2.367,8.81 l 0.039,-0.035 c -0.466,-0.809 -0.877,-1.654 -1.209,-2.535 z" /></g></g><path
|
||||
style="opacity:0.1;fill:#3d5263"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path26"
|
||||
d="m 783.931,446.247 c -66.396,0 -120.223,53.827 -120.223,120.223 0,66.396 53.827,120.221 120.223,120.221 66.397,0 120.222,-53.825 120.222,-120.221 0,-66.395 -53.825,-120.223 -120.222,-120.223 z m -11.96,215.702 c -53.009,0 -95.982,-43.855 -95.982,-97.953 0,-54.098 42.973,-97.952 95.982,-97.952 53.007,0 95.98,43.855 95.98,97.952 -10e-4,54.098 -42.973,97.953 -95.98,97.953 z" /><g
|
||||
id="g28"><g
|
||||
id="g30"><polyline
|
||||
style="fill:#3d5263"
|
||||
id="polyline32"
|
||||
points="691.144,492.5 673.257,540.276 686.55,605.582 712.496,631.852 " /><g
|
||||
id="g34"><g
|
||||
id="g36"><polyline
|
||||
style="fill:#fef3df"
|
||||
id="polyline38"
|
||||
points="658.248,450.81 673.501,487.076 693.836,496.903 724.04,458.731 " /><g
|
||||
id="g40"><path
|
||||
style="fill:#b58765"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path42"
|
||||
d="m 710.634,473.205 c 0,0 -22.482,-25.556 -49.793,-18.975 0,0 4.667,34.118 46.349,44.019 l 2.61,8.533 c 0,0 -65.612,-9.689 -59.339,-67.593 0,0 49.008,-19.884 72.598,15.106" /><polyline
|
||||
style="fill:#fef3df"
|
||||
id="polyline44"
|
||||
points="909.697,450.81 894.447,487.076 874.114,496.903 843.907,458.731 " /><path
|
||||
style="fill:#b58765"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path46"
|
||||
d="m 857.314,473.205 c 0,0 22.48,-25.556 49.79,-18.975 0,0 -4.664,34.118 -46.347,44.019 l -2.613,8.533 c 0,0 65.611,-9.689 59.339,-67.593 0,0 -49.006,-19.884 -72.6,15.106" /></g></g><path
|
||||
sodipodi:nodetypes="cccscccccc"
|
||||
style="fill:#b58765"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path48"
|
||||
d="m 726.619,647.067 55.945,0 16.40428,-204.81407 c -55.814,0 -112.41728,30.01707 -112.41728,77.85207 0,1.454 0.085,2.787 0.121,4.175 0.127,3.934 0.448,7.585 0.856,11.135 1.689,14.816 5.451,27.177 8.461,43.383 1.452,7.831 5.002,23.374 5.002,23.374 0.056,0.408 0.165,0.804 0.224,1.211 2.535,16.546 11.832,32.027 25.404,43.684 z" /><path
|
||||
style="fill:#b58765"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path50"
|
||||
d="m 781.992,433.489 0,213.577 55.944,0 c 13.572,-11.657 22.867,-27.138 25.406,-43.684 0.058,-0.407 0.163,-0.803 0.221,-1.211 0,0 3.549,-15.543 5.002,-23.374 3.011,-16.206 6.774,-28.567 8.464,-43.381 0.405,-3.552 0.724,-7.203 0.846,-11.137 0.042,-1.388 0.126,-2.721 0.126,-4.175 0,-47.834 -40.191,-86.615 -96.009,-86.615 z" /><g
|
||||
id="g52"><g
|
||||
id="g54"><path
|
||||
style="fill:#fef3df"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path56"
|
||||
d="m 860.944,613.502 c 0,28.321 -35.091,51.289 -78.383,51.289 -43.299,0 -78.388,-22.968 -78.388,-51.289 0,-28.325 35.089,-51.289 78.388,-51.289 43.292,0 78.383,22.964 78.383,51.289 z" /></g></g><g
|
||||
id="g58"><g
|
||||
id="g60"><g
|
||||
id="g62"><path
|
||||
style="fill:#5a3620"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path64"
|
||||
d="m 747.044,605.582 c 0,6.215 -5.04,11.256 -11.261,11.256 -6.21,0 -11.253,-5.041 -11.253,-11.256 0,-6.223 5.043,-11.257 11.253,-11.257 6.22,0 11.261,5.034 11.261,11.257 z" /></g></g><g
|
||||
id="g66"><g
|
||||
id="g68"><path
|
||||
style="fill:#5a3620"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path70"
|
||||
d="m 840.856,605.582 c 0,6.215 -5.037,11.256 -11.257,11.256 -6.218,0 -11.259,-5.041 -11.259,-11.256 0,-6.223 5.041,-11.257 11.259,-11.257 6.22,0 11.257,5.034 11.257,11.257 z" /></g></g></g><g
|
||||
id="g72"><path
|
||||
style="fill:#87654a"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path74"
|
||||
d="m 875.228,525.835 c 0.354,-3.113 0.634,-6.311 0.743,-9.754 0.035,-1.218 0.109,-2.384 0.109,-3.661 0,-40.785 -33.369,-74.043 -80.237,-75.775 l -7.335,0.005 c -0.003,0 -0.003,0 -0.006,0 -0.007,0.018 -28.632,88.422 76.583,140.268 0.946,-4.317 2.078,-9.585 2.73,-13.088 2.64,-14.196 5.934,-25.021 7.413,-37.995 z" /></g><g
|
||||
id="g76"><g
|
||||
id="g78"><g
|
||||
id="g80"><g
|
||||
id="g82"><path
|
||||
style="fill:#5a3620"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path84"
|
||||
d="m 843.907,519.681 c 0,6.964 -5.65,12.611 -12.618,12.611 -6.963,0 -12.614,-5.646 -12.614,-12.611 0,-6.97 5.651,-12.614 12.614,-12.614 6.968,0 12.618,5.644 12.618,12.614 z" /></g></g></g><g
|
||||
id="g86"><g
|
||||
id="g88"><g
|
||||
id="g90"><path
|
||||
style="fill:#5a3620"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path92"
|
||||
d="m 752.028,519.681 c 0,6.964 -5.649,12.611 -12.612,12.611 -6.969,0 -12.612,-5.646 -12.612,-12.611 0,-6.97 5.642,-12.614 12.612,-12.614 6.964,0 12.612,5.644 12.612,12.614 z" /></g></g></g><g
|
||||
id="g94"><g
|
||||
id="g96"><path
|
||||
style="fill:#ffffff"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path98"
|
||||
d="m 748.75,515.894 c 0,2.558 -2.071,4.629 -4.63,4.629 -2.558,0 -4.633,-2.072 -4.633,-4.629 0,-2.552 2.076,-4.626 4.633,-4.626 2.559,0 4.63,2.073 4.63,4.626 z" /></g></g><g
|
||||
id="g100"><g
|
||||
id="g102"><path
|
||||
style="fill:#ffffff"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path104"
|
||||
d="m 839.771,515.894 c 0,2.558 -2.073,4.629 -4.629,4.629 -2.558,0 -4.631,-2.072 -4.631,-4.629 0,-2.552 2.072,-4.626 4.631,-4.626 2.555,0 4.629,2.073 4.629,4.626 z" /></g></g></g></g><path
|
||||
style="fill:#fef3df"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path106"
|
||||
d="m 734.557,443.625 c 0,0 -18.236,-25.199 0,-41.637 0,0 13.125,32.012 40.242,31.502" /><path
|
||||
style="fill:#fef3df"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path108"
|
||||
d="m 834.496,443.625 c 0,0 18.236,-25.199 0,-41.637 0,0 -13.126,32.012 -40.242,31.502" /><path
|
||||
style="fill:#f1f2f2"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path110"
|
||||
d="m 786.264,431.965 c -66.396,0 -120.223,53.827 -120.223,120.223 0,66.396 53.827,120.221 120.223,120.221 66.397,0 120.222,-53.825 120.222,-120.221 10e-4,-66.395 -53.825,-120.223 -120.222,-120.223 z m -11.96,215.702 c -53.009,0 -95.982,-43.855 -95.982,-97.953 0,-54.098 42.973,-97.952 95.982,-97.952 53.007,0 95.979,43.855 95.979,97.952 0,54.098 -42.972,97.953 -95.979,97.953 z" /></g><g
|
||||
id="g112"><path
|
||||
style="fill:#ffffff"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path114"
|
||||
d="m 781.737,436.751 c 66.396,0 120.221,53.827 120.221,120.223 0,30.718 -11.526,58.74 -30.482,79.991 21.636,-21.74 35.01,-51.708 35.01,-84.803 0,-66.395 -53.825,-120.222 -120.222,-120.222 -35.678,0 -67.721,15.549 -89.739,40.233 21.772,-21.879 51.91,-35.422 85.212,-35.422 z" /></g></g><path
|
||||
d="m 648.292,644.7595 0,46.15088 c 0,5.49435 7.88,9.94862 17.6,9.94862 l 236.073,0 c 9.72,0 17.6,-4.45427 17.6,-9.94862 l 0,-14.07618 c 10e-4,0 -175.814,20.0804 -271.273,-32.0747 z"
|
||||
id="path124"
|
||||
inkscape:connector-curvature="0"
|
||||
style="opacity:0.1;fill:#3d5263" /></g><g
|
||||
id="g126" /></g></svg>
|
Before Width: | Height: | Size: 11 KiB |
|
@ -1,53 +0,0 @@
|
|||
# mailcow: dockerized - 🐮 + 🐋 = 💕
|
||||
|
||||
[![Servercow](https://www.servercow.de/img/cow_globe_200.svg)](https://www.servercow.de)
|
||||
|
||||
If you want to support mailcow, consider hosting mailcow on a Servercow virtual machine @ Servercow!
|
||||
|
||||
## Screenshots
|
||||
|
||||
You can find screenshots [on Imgur](http://imgur.com/a/oewYt).
|
||||
|
||||
## Overview
|
||||
|
||||
mailcow dockerized comes with **12 containers** linked in **one bridged network**.
|
||||
Each container represents a single application.
|
||||
|
||||
- Dovecot
|
||||
- ClamAV
|
||||
- Memcached
|
||||
- Redis
|
||||
- MySQL
|
||||
- Bind9 (Resolver) (formerly PDNS Recursor)
|
||||
- PHP-FPM
|
||||
- Postfix
|
||||
- Nginx
|
||||
- Rmilter
|
||||
- Rspamd
|
||||
- SOGo
|
||||
|
||||
**7 volumes** to keep dynamic data - take care of them!
|
||||
|
||||
- vmail-vol-1
|
||||
- dkim-vol-1
|
||||
- redis-vol-1
|
||||
- mysql-vol-1
|
||||
- rspamd-vol-1
|
||||
- postfix-vol-1
|
||||
- crypt-vol-1
|
||||
|
||||
The integrated **mailcow UI** allows administrative work on your mail server instance as well as separated domain administrator and mailbox user access:
|
||||
|
||||
- DKIM key management
|
||||
- Black- and whitelists per domain and per user
|
||||
- Spam score managment per-user (reject spam, mark spam, greylist)
|
||||
- Allow mailbox users to create temporary spam aliases
|
||||
- Prepend mail tags to subject or move mail to subfolder (per-user)
|
||||
- Allow mailbox users to toggle incoming and outgoing TLS enforcement
|
||||
- Allow users to reset SOGo ActiveSync device caches
|
||||
- imapsync to migrate or pull remote mailboxes regularly
|
||||
- TFA: Yubi OTP and U2F USB (Google Chrome and derivates only)
|
||||
- Add domains, mailboxes, aliases, domain aliases and SOGo resources
|
||||
- Add whitelisted hosts to forward mail to mailcow
|
||||
|
||||
*[Looking for a farm to host your cow?](https://www.servercow.de)*
|
126
docs/install.md
126
docs/install.md
|
@ -1,126 +0,0 @@
|
|||
## Install mailcow
|
||||
|
||||
**WARNING**: Please use Ubuntu 16.04 instead of Debian 8 or [switch to the kernel 4.9 from jessie backports](https://packages.debian.org/jessie-backports/linux-image-amd64) because there is a bug (kernel panic) with the kernel 3.16 when running docker containers with healthchecks! Full details here: [github.com/docker/docker/issues/30402](https://github.com/docker/docker/issues/30402) and [forum.mailcow.email/t/solved-mailcow-docker-causes-kernel-panic-edit/448](https://forum.mailcow.email/t/solved-mailcow-docker-causes-kernel-panic-edit/448)
|
||||
|
||||
You need Docker and Docker Compose.
|
||||
|
||||
1\. Learn how to install [Docker](https://docs.docker.com/engine/installation/linux/) and [Docker Compose](https://docs.docker.com/compose/install/).
|
||||
|
||||
Quick installation for most operation systems:
|
||||
|
||||
- Docker
|
||||
```
|
||||
curl -sSL https://get.docker.com/ | sh
|
||||
```
|
||||
|
||||
- Docker-Compose
|
||||
```
|
||||
curl -L https://github.com/docker/compose/releases/download/$(curl -Ls https://www.servercow.de/docker-compose/latest.php)/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
Please use the latest Docker engine available and do not use the engine that ships with your distros repository.
|
||||
|
||||
2\. Clone the master branch of the repository
|
||||
```
|
||||
git clone https://github.com/andryyy/mailcow-dockerized && cd mailcow-dockerized
|
||||
```
|
||||
|
||||
3\. Generate a configuration file. Use a FQDN (`host.domain.tld`) as hostname when asked.
|
||||
```
|
||||
./generate_config.sh
|
||||
```
|
||||
|
||||
4\. Change configuration if you want or need to.
|
||||
```
|
||||
nano mailcow.conf
|
||||
```
|
||||
If you plan to use a reverse proxy, you can, for example, bind HTTPS to 127.0.0.1 on port 8443 and HTTP to 127.0.0.1 on port 8080.
|
||||
|
||||
You may need to stop an existing pre-installed MTA which blocks port 25/tcp. See [this chapter](https://andryyy.github.io/mailcow-dockerized/first_steps/#install-a-local-mta) to learn how to reconfigure Postfix to run besides mailcow after a successful installation.
|
||||
|
||||
5\. Pull the images and run the composer file. The paramter `-d` will start mailcow: dockerized detached:
|
||||
```
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Done!
|
||||
|
||||
You can now access **https://${MAILCOW_HOSTNAME}** with the default credentials `admin` + password `moohoo`.
|
||||
|
||||
The database will be initialized right after a connection to MySQL can be established.
|
||||
|
||||
## Update mailcow
|
||||
|
||||
There is no update routine. You need to refresh your pulled repository clone and apply your local changes (if any). Actually there are many ways to merge local changes.
|
||||
|
||||
### Step 1, method 1
|
||||
Stash all local changes, pull changes from the remote master branch and apply your stash on top of it. You will most likely see warnings about non-commited changes; you can ignore them:
|
||||
|
||||
```
|
||||
# Stash local changes
|
||||
git stash
|
||||
# Re-pull master
|
||||
git pull
|
||||
# Apply stash and remove it
|
||||
git stash pop
|
||||
```
|
||||
|
||||
### Step 1, method 2
|
||||
Fetch new data from GitHub, commit changes and merge remote repository:
|
||||
|
||||
```
|
||||
# Get updates/changes
|
||||
git fetch
|
||||
# Add all changed files to local clone
|
||||
git add -A
|
||||
# Commit changes, ignore git complaining about username and mail address
|
||||
git commit -m "Local config aat $(date)"
|
||||
# Merge changes
|
||||
git merge
|
||||
```
|
||||
|
||||
If git complains about conflicts, solve them! Example:
|
||||
```
|
||||
CONFLICT (content): Merge conflict in data/web/index.php
|
||||
```
|
||||
|
||||
Open `data/web/index.php`, solve the conflict, close the file and run `git add -A` + `git commit -m "Solved conflict"`.
|
||||
|
||||
### Step 1, method 3
|
||||
|
||||
Thanks to fabreg @ GitHub!
|
||||
|
||||
In case both methods do not work (for many reason like you're unable to fix the CONFLICTS or any other reasons) you can simply start all over again.
|
||||
|
||||
Keep in mind that all local changes _to configuration files_ will be lost. However, your volumes will not be removed.
|
||||
|
||||
- Copy mailcow.conf somewhere outside the mailcow-dockerized directory
|
||||
- Stop and remove mailcow containers: `docker-compose down`
|
||||
- Delete the directory or rename it
|
||||
- Clone the remote repository again (`git clone https://github.com/andryyy/mailcow-dockerized && cd mailcow-dockerized`). **Pay attention** to this step - the folder must have the same name of the previous one!
|
||||
- Copy back your previous `mailcow.conf` into the mailcow-dockerizd folder
|
||||
|
||||
If you forgot to stop Docker before deleting the cloned directoy, you can use the following commands:
|
||||
```
|
||||
docker stop $(docker ps -a -q)
|
||||
docker rm $(docker ps -a -q)
|
||||
```
|
||||
|
||||
### Step 2
|
||||
|
||||
Pull new images (if any) and recreate changed containers:
|
||||
|
||||
```
|
||||
docker-compose pull
|
||||
docker-compose up -d --remove-orphans
|
||||
```
|
||||
|
||||
### Step 3
|
||||
Clean-up dangling (unused) images and volumes:
|
||||
|
||||
```
|
||||
docker rmi -f $(docker images -f "dangling=true" -q)
|
||||
docker volume rm $(docker volume ls -qf dangling=true)
|
||||
```
|
536
docs/u_and_e.md
536
docs/u_and_e.md
|
@ -1,536 +0,0 @@
|
|||
## mailcow UI configuration
|
||||
|
||||
Several configuration parameters of the mailcow UI can be changed by creating a file `data/web/inc/vars.local.inc.php` which overrides defaults settings found in `data/web/inc/vars.inc.php`.
|
||||
|
||||
The local configuration file is persistent over updates of mailcow. Try not to change values inside `data/web/inc/vars.inc.php`, but use them as template for the local override.
|
||||
|
||||
mailcow UI configuration parameters can be to...
|
||||
|
||||
- ...change the default language*
|
||||
- ...change the default bootstrap theme
|
||||
- ...set a password complexity regex
|
||||
- ...add mailcow app buttons to the login screen
|
||||
- ...set a pagination trigger
|
||||
- ...set action after submitting forms (stay in form, return to previous page)
|
||||
|
||||
\* To change SOGos default language, you will need to edit `data/conf/sogo/sogo.conf` and replace "English" by your preferred language.
|
||||
|
||||
## Anonymize headers
|
||||
|
||||
Save as `data/conf/postfix/mailcow_anonymize_headers.pcre`:
|
||||
|
||||
```
|
||||
/^\s*Received:[^\)]+\)\s+\(Authenticated sender:(.+)/
|
||||
REPLACE Received: from localhost (localhost [127.0.0.1]) (Authenticated sender:$1
|
||||
/^\s*User-Agent/ IGNORE
|
||||
/^\s*X-Enigmail/ IGNORE
|
||||
/^\s*X-Mailer/ IGNORE
|
||||
/^\s*X-Originating-IP/ IGNORE
|
||||
/^\s*X-Forward/ IGNORE
|
||||
```
|
||||
|
||||
Add this to `data/conf/postfix/main.cf`:
|
||||
```
|
||||
smtp_header_checks = pcre:/opt/postfix/conf/mailcow_anonymize_headers.pcre
|
||||
```
|
||||
|
||||
## Backup and restore maildir (simple tar file)
|
||||
|
||||
### Backup
|
||||
|
||||
This line backups the vmail directory to a file backup_vmail.tar.gz in the mailcow root directory:
|
||||
```
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:jessie tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
```
|
||||
|
||||
You can change the path by adjusting ${PWD} (which equals to the current directory) to any path you have write-access to.
|
||||
Set the filename `backup_vmail.tar.gz` to any custom name, but leave the path as it is. Example: `[...] tar cvfz /backup/my_own_filename_.tar.gz`
|
||||
|
||||
### Restore
|
||||
```
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:jessie tar xvfz /backup/backup_vmail.tar.gz
|
||||
```
|
||||
|
||||
## Docker Compose Bash completion
|
||||
|
||||
For the tab-tab... :-)
|
||||
|
||||
```
|
||||
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
|
||||
```
|
||||
## Black and Whitelist
|
||||
|
||||
Edit a domain as (domain) administrator to add an item to the filter table.
|
||||
|
||||
Beware that a mailbox user can login to mailcow and override a domain policy filter item.
|
||||
|
||||
## Customize Dockerfiles
|
||||
|
||||
Make your changes in `data/Dockerfiles/$service` and build the image locally:
|
||||
|
||||
```
|
||||
docker build data/Dockerfiles/service -t mailcow/$service
|
||||
```
|
||||
|
||||
Now auto-recreate modified containers:
|
||||
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Disable sender addresses verification
|
||||
|
||||
This option is not best-practice and should only be implemented when there is no other option available to archive whatever you are trying to do.
|
||||
|
||||
Simply create a file `data/conf/postfix/check_sasl_access` and enter the following content. This user must exist in your installation and needs to authenticate before sending mail.
|
||||
```
|
||||
user-to-allow-everything@example.com OK
|
||||
```
|
||||
|
||||
Open `data/conf/postfix/main.cf` and find `smtpd_sender_restrictions`. Prepend `check_sasl_access hash:/opt/postfix/conf/check_sasl_access` like this:
|
||||
```
|
||||
smtpd_sender_restrictions = check_sasl_access hash:/opt/postfix/conf/check_sasl_access reject_authenticated_sender_login_mismatch [...]
|
||||
```
|
||||
|
||||
Run postmap on check_sasl_access:
|
||||
|
||||
```
|
||||
docker-compose exec postfix-mailcow postmap /opt/postfix/conf/check_sasl_access
|
||||
```
|
||||
|
||||
Restart the Postfix container.
|
||||
|
||||
## Install Roundcube
|
||||
|
||||
Download Roundcube 1.3.x (beta at the time of Feb 2017) to the web htdocs directory and extract it (here `rc/`):
|
||||
```
|
||||
cd data/web/rc
|
||||
wget -O - https://github.com/roundcube/roundcubemail/releases/download/1.3-beta/roundcubemail-1.3-beta-complete.tar.gz | tar xfvz -
|
||||
# Change folder name
|
||||
mv roundcubemail-1.3* rc
|
||||
# Change permissions
|
||||
chown -R root: rc/
|
||||
```
|
||||
|
||||
Create a file `data/web/rc/config/config.inc.php` with the following content.
|
||||
|
||||
**Change the `des_key` parameter to a random value.** It is used to temporarily store your IMAP password.
|
||||
|
||||
```
|
||||
<?php
|
||||
error_reporting(0);
|
||||
if (!file_exists('/tmp/mime.types')) {
|
||||
file_put_contents("/tmp/mime.types", fopen("http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types", 'r'));
|
||||
}
|
||||
$config = array();
|
||||
$config['db_dsnw'] = 'mysql://' . getenv('DBUSER') . ':' . getenv('DBPASS') . '@mysql/' . getenv('DBNAME');
|
||||
$config['default_host'] = 'tls://dovecot';
|
||||
$config['default_port'] = '143';
|
||||
$config['smtp_server'] = 'tls://postfix';
|
||||
$config['smtp_port'] = 587;
|
||||
$config['smtp_user'] = '%u';
|
||||
$config['smtp_pass'] = '%p';
|
||||
$config['support_url'] = '';
|
||||
$config['product_name'] = 'Roundcube Webmail';
|
||||
$config['des_key'] = 'rcmail-!24ByteDESkey*Str';
|
||||
$config['log_dir'] = '/dev/null';
|
||||
$config['temp_dir'] = '/tmp';
|
||||
$config['plugins'] = array(
|
||||
'archive',
|
||||
);
|
||||
$config['skin'] = 'larry';
|
||||
$config['mime_types'] = '/tmp/mime.types';
|
||||
$config['imap_conn_options'] = array(
|
||||
'ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)
|
||||
);
|
||||
$config['enable_installer'] = false;
|
||||
$config['smtp_conn_options'] = array(
|
||||
'ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)
|
||||
);
|
||||
```
|
||||
|
||||
Point your browser to `https://myserver/rc/installer` and follow the instructions.
|
||||
Initialize the database and leave the installer.
|
||||
|
||||
**Delete the directory `data/web/rc/installer` after a successful installation!**
|
||||
|
||||
### Enable change password function in Roundcube
|
||||
|
||||
Open `data/web/rc/config/config.inc.php` and enable the password plugin:
|
||||
|
||||
```
|
||||
...
|
||||
$config['plugins'] = array(
|
||||
'archive',
|
||||
'password',
|
||||
);
|
||||
...
|
||||
```
|
||||
|
||||
Open `data/web/rc/plugins/password/password.php`, search for `case 'ssha':` and add above:
|
||||
|
||||
```
|
||||
case 'ssha256':
|
||||
$salt = rcube_utils::random_bytes(8);
|
||||
$crypted = base64_encode( hash('sha256', $password . $salt, TRUE ) . $salt );
|
||||
$prefix = '{SSHA256}';
|
||||
break;
|
||||
```
|
||||
|
||||
Open `data/web/rc/plugins/password/config.inc.php` and change the following parameters (or add them at the bottom of that file):
|
||||
|
||||
```
|
||||
$config['password_driver'] = 'sql';
|
||||
$config['password_algorithm'] = 'ssha256';
|
||||
$config['password_algorithm_prefix'] = '{SSHA256}';
|
||||
$config['password_query'] = "UPDATE mailbox SET password = %P WHERE username = %u";
|
||||
```
|
||||
|
||||
## MySQL
|
||||
|
||||
### Connect
|
||||
```
|
||||
source mailcow.conf
|
||||
docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME}
|
||||
```
|
||||
|
||||
### Backup
|
||||
```
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker-compose exec mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > backup_${DBNAME}_${DATE}.sql
|
||||
```
|
||||
|
||||
### Restore
|
||||
```
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME} < backup_file.sql
|
||||
```
|
||||
|
||||
### Reset MySQL passwords
|
||||
|
||||
Stop the stack by running `docker-compose stop`.
|
||||
|
||||
When the containers came to a stop, run this command:
|
||||
|
||||
```
|
||||
docker-compose run --rm --entrypoint '/bin/sh -c "gosu mysql mysqld --skip-grant-tables & sleep 10 && mysql -hlocalhost -uroot && exit 0"' mysql-mailcow
|
||||
```
|
||||
|
||||
**1\. Find database name**
|
||||
|
||||
```
|
||||
MariaDB [(none)]> show databases;
|
||||
+--------------------+
|
||||
| Database |
|
||||
+--------------------+
|
||||
| information_schema |
|
||||
| mailcow_database | <=====
|
||||
| mysql |
|
||||
| performance_schema |
|
||||
+--------------------+
|
||||
4 rows in set (0.00 sec)
|
||||
```
|
||||
|
||||
**2\. Reset one or more users**
|
||||
|
||||
Both "password" and "authentication_string" exist. Currently "password" is used, but better set both.
|
||||
|
||||
```
|
||||
MariaDB [(none)]> SELECT user FROM mysql.user;
|
||||
+--------------+
|
||||
| user |
|
||||
+--------------+
|
||||
| mailcow_user | <=====
|
||||
| root |
|
||||
+--------------+
|
||||
2 rows in set (0.00 sec)
|
||||
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('gotr00t'), password = PASSWORD('gotr00t') WHERE User = 'root' AND Host = '%';
|
||||
MariaDB [(none)]> UPDATE mysql.user SET authentication_string = PASSWORD('mookuh'), password = PASSWORD('mookuh') WHERE User = 'mailcow' AND Host = '%';
|
||||
MariaDB [(none)]> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
You can use `docker-compose logs $service-name` for all containers.
|
||||
|
||||
Run `docker-compose logs` for all logs at once.
|
||||
|
||||
Follow the log output by running docker-compose with `logs -f`.
|
||||
|
||||
Limit the output by calling logs with `--tail=300` like `docker-compose logs --tail=300 mysql-mailcow`.
|
||||
|
||||
## Redirect port 80 to 443
|
||||
|
||||
Since February the 28th 2017 mailcow does come with port 80 and 443 enabled.
|
||||
|
||||
Open `mailcow.conf` and set `HTTP_BIND=0.0.0.0`.
|
||||
|
||||
Open `data/conf/nginx/site.conf` and add a new "catch-all" site at the top of that file:
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80 default_server;
|
||||
include /etc/nginx/conf.d/server_name.active;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
```
|
||||
|
||||
Restart the stack, changed containers will be updated:
|
||||
|
||||
`docker-compose up -d`
|
||||
|
||||
## Redis
|
||||
|
||||
### Client
|
||||
|
||||
```
|
||||
docker-compose exec redis-mailcow redis-cli
|
||||
```
|
||||
|
||||
## Remove persistent data
|
||||
|
||||
- Remove volume `mysql-vol-1` to remove all MySQL data.
|
||||
- Remove volume `redis-vol-1` to remove all Redis data.
|
||||
- Remove volume `vmail-vol-1` to remove all contents of `/var/vmail` mounted to `dovecot-mailcow`.
|
||||
- Remove volume `dkim-vol-1` to remove all DKIM keys.
|
||||
- Remove volume `rspamd-vol-1` to remove all Rspamd data.
|
||||
|
||||
Running `docker-compose down -v` will **destroy all mailcow: dockerized volumes** and delete any related containers.
|
||||
|
||||
## Reset admin password
|
||||
Reset mailcow admin to `admin:moohoo`:
|
||||
|
||||
```
|
||||
cd mailcow_path
|
||||
bash reset_admin.sh
|
||||
```
|
||||
|
||||
## Rspamd
|
||||
|
||||
### Learn spam and ham
|
||||
|
||||
Rspamd learns mail as spam or ham when you move a message in or out of the junk folder to any mailbox besides trash.
|
||||
This is archived by using the Dovecot plugin "antispam" and a simple parser script.
|
||||
|
||||
Rspamd also auto-learns mail when a high or low score is detected (see https://rspamd.com/doc/configuration/statistic.html#autolearning)
|
||||
|
||||
The bayes statistics are written to Redis as keys `BAYES_HAM` and `BAYES_SPAM`.
|
||||
|
||||
You can also use Rspamd's web ui to learn ham and/or spam.
|
||||
|
||||
### Learn ham or spam from existing directory
|
||||
|
||||
You can use a one-liner to learn mail in plain-text (uncompressed) format:
|
||||
```
|
||||
# Ham
|
||||
for file in /my/folder/cur/*; do docker exec -i $(docker-compose ps -q rspamd-mailcow) rspamc learn_ham < $file; done
|
||||
# Spam
|
||||
for file in /my/folder/.Junk/cur/*; do docker exec -i $(docker-compose ps -q rspamd-mailcow) rspamc learn_spam < $file; done
|
||||
```
|
||||
|
||||
Consider attaching a local folder as new volume to `rspamd-mailcow` in `docker-compose.yml` and learn given files inside the container. This can be used as workaround to parse compressed data with zcat. Example:
|
||||
|
||||
```
|
||||
for file in /data/old_mail/.Junk/cur/*; do rspamc learn_spam < zcat $file; done
|
||||
```
|
||||
|
||||
### CLI tools
|
||||
|
||||
```
|
||||
docker-compose exec rspamd-mailcow rspamc --help
|
||||
docker-compose exec rspamd-mailcow rspamadm --help
|
||||
```
|
||||
|
||||
See [Rspamd documentation](https://rspamd.com/doc/index.html)
|
||||
|
||||
## Adjust service configurations
|
||||
|
||||
The most important configuration files are mounted from the host into the related containers:
|
||||
|
||||
```
|
||||
data/conf
|
||||
├── bind9
|
||||
│ └── named.conf
|
||||
├── dovecot
|
||||
│ ├── dovecot.conf
|
||||
│ ├── dovecot-master.passwd
|
||||
│ ├── sieve_after
|
||||
│ └── sql
|
||||
│ ├── dovecot-dict-sql.conf
|
||||
│ └── dovecot-mysql.conf
|
||||
├── mysql
|
||||
│ └── my.cnf
|
||||
├── nginx
|
||||
│ ├── dynmaps.conf
|
||||
│ ├── site.conf
|
||||
│ └── templates
|
||||
│ ├── listen_plain.template
|
||||
│ ├── listen_ssl.template
|
||||
│ └── server_name.template
|
||||
├── pdns
|
||||
│ ├── pdns_custom.lua
|
||||
│ └── recursor.conf
|
||||
├── postfix
|
||||
│ ├── main.cf
|
||||
│ ├── master.cf
|
||||
│ ├── postscreen_access.cidr
|
||||
│ ├── smtp_dsn_filter
|
||||
│ └── sql
|
||||
│ ├── mysql_relay_recipient_maps.cf
|
||||
│ ├── mysql_tls_enforce_in_policy.cf
|
||||
│ ├── mysql_tls_enforce_out_policy.cf
|
||||
│ ├── mysql_virtual_alias_domain_catchall_maps.cf
|
||||
│ ├── mysql_virtual_alias_domain_maps.cf
|
||||
│ ├── mysql_virtual_alias_maps.cf
|
||||
│ ├── mysql_virtual_domains_maps.cf
|
||||
│ ├── mysql_virtual_mailbox_maps.cf
|
||||
│ ├── mysql_virtual_relay_domain_maps.cf
|
||||
│ ├── mysql_virtual_sender_acl.cf
|
||||
│ └── mysql_virtual_spamalias_maps.cf
|
||||
├── rmilter
|
||||
│ └── rmilter.conf
|
||||
├── rspamd
|
||||
│ ├── dynmaps
|
||||
│ │ ├── authoritative.php
|
||||
│ │ ├── settings.php
|
||||
│ │ ├── tags.php
|
||||
│ │ └── vars.inc.php -> ../../../web/inc/vars.inc.php
|
||||
│ ├── local.d
|
||||
│ │ ├── dkim.conf
|
||||
│ │ ├── metrics.conf
|
||||
│ │ ├── options.inc
|
||||
│ │ ├── redis.conf
|
||||
│ │ ├── rspamd.conf.local
|
||||
│ │ └── statistic.conf
|
||||
│ ├── lua
|
||||
│ │ └── rspamd.local.lua
|
||||
│ └── override.d
|
||||
│ ├── logging.inc
|
||||
│ ├── worker-controller.inc
|
||||
│ └── worker-normal.inc
|
||||
└── sogo
|
||||
├── sieve.creds
|
||||
└── sogo.conf
|
||||
|
||||
```
|
||||
|
||||
Just change the according configuration file on the host and restart the related service:
|
||||
```
|
||||
docker-compose restart service-mailcow
|
||||
```
|
||||
|
||||
## Tagging
|
||||
|
||||
Mailbox users can tag their mail address like in `me+facebook@example.org` and choose between to setups to handle this tag:
|
||||
|
||||
1\. Move this message to a subfolder "facebook" (will be created lower case if not existing)
|
||||
|
||||
2\. Prepend the tag to the subject: "[facebook] Subject"
|
||||
|
||||
## Two-factor authentication
|
||||
|
||||
So far two methods for TFA are implemented. Both work with the fantastic [Yubikey](https://www.yubico.com).
|
||||
|
||||
While Yubi OTP needs an active internet connection and an API ID and key, U2F will work with any FIDO U2F USB key out of the box, but can only be used when mailcow is accessed over HTTPS.
|
||||
|
||||
Both methods support multiple YubiKeys.
|
||||
|
||||
As administrator you are able to temporary disable a domain administrators TFA login until they successfully logged in.
|
||||
|
||||
The key used to login will be displayed in green, while other keys remain grey.
|
||||
|
||||
### Yubi OTP
|
||||
|
||||
The Yubi API ID and Key will be checked against the Yubico Cloud API. When setting up TFA you will be asked for your personal API account for this key.
|
||||
The API ID, API key and the first 12 characters (your YubiKeys ID in modhex) are stored in the MySQL table as secret.
|
||||
|
||||
### U2F
|
||||
|
||||
Only Google Chrome (+derivates) and Opera support U2F authentication to this day natively.
|
||||
For Firefox you will need to install the "U2F Support Add-on" as provided on [mozilla.org](https://addons.mozilla.org/en-US/firefox/addon/u2f-support-add-on/).
|
||||
|
||||
U2F works without an internet connection.
|
||||
|
||||
## Portainer
|
||||
|
||||
In order to enable Portainer, the docker-compose.yml and site.conf for nginx must be modified.
|
||||
|
||||
1\. docker-compose.yml: Insert this block for portainer
|
||||
```
|
||||
portainer-mailcow:
|
||||
image: portainer/portainer
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
restart: always
|
||||
dns:
|
||||
- 172.22.1.254
|
||||
dns_search: mailcow-network
|
||||
networks:
|
||||
mailcow-network:
|
||||
aliases:
|
||||
- portainer
|
||||
```
|
||||
2a\. data/conf/nginx/site.conf: Just beneath the opening line, at the same level as a server { block, add this:
|
||||
```
|
||||
upstream portainer {
|
||||
server portainer-mailcow:9000;
|
||||
}
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
```
|
||||
|
||||
2b\. data/conf/nginx/site.conf: Then, inside **both** (ssl and plain) server blocks, add this:
|
||||
```
|
||||
location /portainer/ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host; # required for docker client's sake
|
||||
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 900;
|
||||
|
||||
proxy_set_header Connection "";
|
||||
proxy_buffers 32 4k;
|
||||
proxy_pass http://portainer/;
|
||||
}
|
||||
|
||||
location /portainer/api/websocket/ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_pass http://portainer/api/websocket/;
|
||||
}
|
||||
```
|
||||
|
||||
Now you can simply navigate to https://${MAILCOW_HOSTNAME}/portainer/ to view your Portainer container monitoring page. You’ll then be prompted to specify a new password for the **admin** account. After specifying your password, you’ll then be able to connect to the Portainer UI.
|
||||
|
||||
## Change autodiscover setup type
|
||||
|
||||
This disables ActiveSync in the autodiscover service for Outlook and configures it with IMAP and SMTP instead:
|
||||
|
||||
Open `data/web/autodiscover.php` and set `'useEASforOutlook' => 'yes'` to `'useEASforOutlook' => 'no'`.
|
||||
|
||||
To always use IMAP and SMTP instead of EAS, set `'autodiscoverType' => 'imap'`.
|
||||
|
||||
## Why Bind?
|
||||
|
||||
For DNS blacklist lookups and DNSSEC.
|
||||
|
||||
Most systems use either a public or a local caching DNS resolver.
|
||||
That's a very bad idea when it comes to filter spam using DNS-based blackhole lists (DNSBL) or similar technics.
|
||||
Most if not all providers apply a rate limit based on the DNS resolver that is used to query their service.
|
||||
Using a public resolver like Googles 4x8, OpenDNS or any other shared DNS resolver like your ISPs will hit that limit very soon.
|
Loading…
Reference in New Issue