linux  mailserver

  Inhaltsverzeichnis:

mailcow: dockerized - 🐮 + 🐳 = 💕

Zitat: Die Mailserver-Suite mit dem 'moo'
Webseite
Dokumentation

Install

sudo -i
umask
# 0022 # <- Überprüfen, dass es 0022 ist
cd /opt
git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized

./generate_config.sh
# Mail server hostname (FQDN) - this is not your mail domain, but your mail servers hostname: mail.heister.email
# Timezone [Etc/UTC]: Europe/Berlin
# Which branch of mailcow do you want to use?

# Available Branches:
# - master branch (stable updates) | default, recommended [1]
# - nightly branch (unstable updates, testing) | not-production ready [2]
# Choose the Branch with it´s number [1/2] 1
# Already on 'master'
# Your branch is up to date with 'origin/master'.
# Generating snake-oil certificate...
# ...+..+...
# Copying snake-oil certificate...
# Detecting if your IP is listed on Spamhaus Bad ASN List...
# Check completed! Your IP is clean

Config

nano /opt/mailcow-dockerized/mailcow.conf
	HTTP_PORT=8080
	HTTPS_PORT=8443
	# SMTP_PORT=25
	# SMTPS_PORT=465
	# SUBMISSION_PORT=587
	# IMAP_PORT=143
	# IMAPS_PORT=993
	# POP_PORT=110
	# POPS_PORT=995
	# SIEVE_PORT=4190

sudo ufw allow 25
#sudo ufw allow 110
#sudo ufw allow 143
sudo ufw allow 465
sudo ufw allow 587
sudo ufw allow 993
# sudo ufw allow 995
# sudo ufw allow 4190

ReverseProxy

mail.heister.email
	#mailcow GUI
	SSLProxyEngine On
	SSLProxyVerify none
	SSLProxyCheckPeerCN off
	SSLProxyCheckPeerName off
	SSLProxyCheckPeerExpire off
	ProxyPass / https://127.0.0.1:8443/
	ProxyPassReverse / https://127.0.0.1:8443/

webmail.heister.email #nicht mehr aktiv, durch snappymail ersetzt!
	# SOGo ist zu erreichen unter mail.heister.email/SOGo
	# ! Zusatz zum Reverse-Proxy zur Weiterleitung an SOGo
	RewriteEngine on
	RewriteCond %{REQUEST_URI} !^/SOGo
	RewriteRule ^(.*?)/? /SOGo/$1 [R=301]

Starten/Stoppen

sudo docker compose up -d
sudo docker compose down

Default Login

admin/moohoo

Weiterleitung

System -> Information -> Protokolle -> Rspamd
   Rausfinden welcher Host geblockt wird bei einer Weiterleitung...

System -> Konfiguration -> Einstellungen -> Weiterleitungs-Host
   Host als Weiterleitungs-Host eintragen!
      Sie können entweder IPv4-/IPv6-Adressen, Netzwerke in CIDR-Notation, Hostnamen ... 
         a1b2:c3d4:e5f6:a1b2::/120 = a1b2:c3d4:e5f6:a1b2:: - fd4d:6169:6c63:6f77::ff = 256 Adressen...

Sicherung

rm -r -d /opt/mailcow-dockerized-backup/* 2>&1 >>${BACKUPLOGFILE}
ExitLog $? "mailcow remove-backup"
MAILCOW_BACKUP_LOCATION=/opt/mailcow-dockerized-backup/ /opt/mailcow-dockerized/helper-scripts/backup_and_restore.sh backup all 2>&1 >>${BACKUPLOGFILE}
ExitLog $? "mailcow backup"
DoBackup "mailcow" "/opt/mailcow-dockerized-backup/" 5 noincrement

Reporting Pflogsum-Doku

Install

install pflogsumm

Reporting

sudo nano -n /usr/local/bin/mailcow--statistics.sh
docker logs --since 24h $(docker ps -qf name=postfix-mailcow) | perl /usr/sbin/pflogsumm --verbose_msg_detail

sudo chmod +x /usr/local/bin/mailcow--statistics.sh

sudo crontab -e
00      00      *       *       *       /usr/local/bin/mailcow--statistics.sh

Update

cd /opt/mailcow-dockerized
sudo ./update.sh --check
sudo ./update.sh
#ggf. mehrfach ausführen, steht aber in den Anweisungen. Also LESEN!
# -> update.sh changed, please run this script again, exiting.

Info-Mail über verfügbare Updates...

sudo nano -n /usr/local/bin/mailcow-update--check.sh
#!/bin/bash

#Hinweise:
# Editieren/Erstellen
#   sudo nano /usr/local/bin/mailcow-update--check.sh
# Ausführbar machen
#   sudo chmod +x /usr/local/bin/mailcow-update--check.sh
#
# Alle 4 Stunden...
#       sudo crontab -e
#               0      */4      *       *       *       /usr/local/bin/mailcow-update--check.sh

LOG=/tmp/mailcow-update--check.log

cd /opt/mailcow-dockerized
sudo ./update.sh --check >${LOG}
echo "" >>${LOG}
echo "###" >>${LOG}
echo "" >>${LOG}
git log --oneline --since="30 days ago" >>${LOG}

LOGCONTENT=$(cat ${LOG})
if [[ ! $LOGCONTENT =~ .*No\ updates\ available.* ]]; then
    MAILCONTENT=$(cat -E ${LOG})
    MAILCONTENT=$(echo ${MAILCONTENT} | sed 's/\$ /<br>/g')

    #mailutils debian
    echo ${MAILCONTENT} | mail -s "mailcow update available..." -a "Content-type: text/html" $HOSTNAME@heister.email
fi

sudo chmod +x /usr/local/bin/mailcow-update--check.sh

sudo crontab -e
00 00 * * * /usr/local/bin/mailcow-update--check.sh

SOGo Theme #inwork

Dokumentation