mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 13:01:09 +02:00
- MAIL_SERVER_DEDICATED.md: Full guide for dedicated mail server on Raspberry Pi 5 or Mini-PC (future setup) - MAIL_SERVER_MAC_MINI_TEMP.md: Temporary solution running on Mac Mini using Mailcow Docker (ready to implement) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
11 KiB
11 KiB
Mail-Server auf dediziertem Gerät
Status: Geplant für später Priorität: Mittel Voraussetzung: Separates Gerät (Raspberry Pi 5 oder Mini-PC)
Übersicht
Einrichtung eines vollständigen Mail-Servers auf einem separaten Gerät für:
- Eigene Email-Adressen (@manacore.ai, @mana.how)
- Ausfallsichere Alert-Benachrichtigungen
- Unabhängigkeit von Gmail/externen Diensten
Hardware-Empfehlung
Option A: Raspberry Pi 5 (Empfohlen)
| Komponente | Produkt | Preis |
|---|---|---|
| Board | Raspberry Pi 5 8GB | ~75€ |
| Netzteil | Official USB-C 27W | ~15€ |
| Gehäuse | Argon ONE V3 (passiv) | ~25€ |
| Storage | Samsung 256GB NVMe + Adapter | ~40€ |
| Gesamt | ~155€ |
Bezugsquellen:
- BerryBase: https://www.berrybase.de
- Reichelt: https://www.reichelt.de
- Amazon
Option B: Mini-PC Intel N100
| Produkt | Preis |
|---|---|
| Beelink Mini S12 Pro (16GB/500GB) | ~180€ |
| Minisforum UN100 | ~170€ |
| Trigkey G4 | ~160€ |
Vorteile gegenüber Pi:
- x86-Architektur (mehr Software-Kompatibilität)
- Mehr RAM/Storage out-of-the-box
- SATA/NVMe bereits integriert
Software-Stack: Mailcow
Mailcow ist eine Docker-basierte Mail-Server-Suite mit allem dabei:
┌─────────────────────────────────────────────────────────────┐
│ Mailcow Dockerized │
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Postfix │ │ Dovecot │ │ Rspamd │ │ SOGo │ │
│ │ (SMTP) │ │ (IMAP) │ │ (Spam) │ │ (Webmail) │ │
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
│ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ MySQL │ │ Redis │ │ Nginx │ │ ClamAV │ │
│ │(Database) │ │ (Cache) │ │ (Proxy) │ │ (Antivir) │ │
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Mailcow Admin UI (https://mail.manacore.ai) │ │
│ │ - Domain-Verwaltung │ │
│ │ - Postfach-Erstellung │ │
│ │ - Alias-Management │ │
│ │ - Spam-Regeln │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Systemanforderungen
| Ressource | Minimum | Empfohlen |
|---|---|---|
| RAM | 2 GB | 4 GB |
| CPU | 2 Cores | 4 Cores |
| Disk | 20 GB | 50 GB+ |
| OS | Debian 11/12, Ubuntu 22.04 | Debian 12 |
Netzwerk-Architektur
Internet
│
├── Port 25 (SMTP)
├── Port 465 (SMTPS)
├── Port 587 (Submission)
├── Port 993 (IMAPS)
└── Port 443 (Webmail)
│
▼
┌─────────────────┐
│ Router/Modem │
│ Port-Forwards │
└─────────────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ Mail-Server │ │ Mac Mini │
│ (Pi/Mini-PC) │◄────►│ (ManaCore) │
│ 192.168.1.x │ LAN │ 192.168.1.x │
└─────────────────┘ └─────────────────┘
DNS-Konfiguration
Für manacore.ai bei Cloudflare:
MX Record
Type: MX
Name: @
Content: mail.manacore.ai
Priority: 10
Proxy: DNS only (grey cloud)
A Record für Mail-Server
Type: A
Name: mail
Content: <Öffentliche-IP>
Proxy: DNS only (grey cloud) # WICHTIG: Kein Proxy für Mail!
SPF Record
Type: TXT
Name: @
Content: v=spf1 mx a:mail.manacore.ai ~all
DKIM Record
Type: TXT
Name: dkim._domainkey
Content: <wird von Mailcow generiert>
DMARC Record
Type: TXT
Name: _dmarc
Content: v=DMARC1; p=quarantine; rua=mailto:dmarc@manacore.ai
Autodiscover (für Mail-Clients)
Type: CNAME
Name: autodiscover
Content: mail.manacore.ai
Type: CNAME
Name: autoconfig
Content: mail.manacore.ai
Type: SRV
Name: _autodiscover._tcp
Content: 0 1 443 mail.manacore.ai
Installation
1. Betriebssystem installieren
Raspberry Pi:
# Raspberry Pi Imager verwenden
# OS: Raspberry Pi OS Lite (64-bit)
# Hostname: mail
# SSH aktivieren
# User: till
Mini-PC:
# Debian 12 Netinstall
# Minimal installation
# SSH server
2. System vorbereiten
# System updaten
sudo apt update && sudo apt upgrade -y
# Docker installieren
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Docker Compose installieren
sudo apt install docker-compose-plugin -y
# Neustart
sudo reboot
3. Mailcow installieren
# Ins opt-Verzeichnis
cd /opt
# Mailcow klonen
sudo git clone https://github.com/mailcow/mailcow-dockerized
cd mailcow-dockerized
# Konfiguration generieren
sudo ./generate_config.sh
# Hostname eingeben: mail.manacore.ai
# Timezone: Europe/Berlin
# Container starten
sudo docker compose pull
sudo docker compose up -d
4. Admin-Zugang
URL: https://mail.manacore.ai
User: admin
Password: moohoo (SOFORT ÄNDERN!)
5. Domain hinzufügen
- Admin UI → Configuration → Mail Setup → Domains
- "Add domain" →
manacore.ai - DKIM-Key generieren und in DNS eintragen
6. Postfächer erstellen
- Admin UI → Configuration → Mail Setup → Mailboxes
- "Add mailbox":
- Username:
till - Domain:
manacore.ai - Password: sicheres Passwort
- Quota: 5 GB
- Username:
Postfächer-Plan
| Adresse | Typ | Verwendung |
|---|---|---|
| till@manacore.ai | Postfach | Haupt-Email |
| alerts@manacore.ai | Postfach | Server-Benachrichtigungen |
| noreply@manacore.ai | Alias → till | Automatische Emails |
| support@manacore.ai | Alias → till | Kundenanfragen |
| info@manacore.ai | Alias → till | Allgemeine Anfragen |
| *@manacore.ai | Catch-All → till | Alles andere |
Integration mit Mac Mini
Alerts vom Mac Mini
Nach Mail-Server Setup, .env.notifications anpassen:
# Email über eigenen Server
EMAIL_TO=alerts@manacore.ai
EMAIL_FROM=alerts@manacore.ai
SMTP_HOST=mail.manacore.ai
SMTP_PORT=587
SMTP_USER=alerts@manacore.ai
SMTP_PASS=<password>
msmtp Konfiguration
# ~/.msmtprc auf Mac Mini
account manacore
host mail.manacore.ai
port 587
from alerts@manacore.ai
user alerts@manacore.ai
password <password>
auth on
tls on
account default : manacore
Wartung
Updates
cd /opt/mailcow-dockerized
sudo ./update.sh
Backup
# Backup-Skript
cd /opt/mailcow-dockerized
sudo ./helper-scripts/backup_and_restore.sh backup all
# Speicherort: /opt/mailcow-dockerized/backup/
Logs
# Alle Logs
sudo docker compose logs -f
# Nur Postfix
sudo docker compose logs -f postfix-mailcow
# Spam-Logs
sudo docker compose logs -f rspamd-mailcow
Monitoring
Mailcow Status
cd /opt/mailcow-dockerized
sudo docker compose ps
Queue prüfen
sudo docker compose exec postfix-mailcow postqueue -p
Mail-Test
# Test-Email senden
echo "Test" | mail -s "Test" till@manacore.ai
Kosten-Übersicht
Einmalig
| Position | Preis |
|---|---|
| Hardware (Pi 5 Kit oder Mini-PC) | 150-180€ |
| Gesamt einmalig | ~165€ |
Monatlich
| Position | Preis |
|---|---|
| Strom (~5W × 24h × 30d × 0.30€) | ~1€ |
| Domain (bereits vorhanden) | 0€ |
| Gesamt monatlich | ~1€ |
Vergleich mit Alternativen
| Lösung | Monatlich | Jährlich |
|---|---|---|
| Eigener Server | 1€ | 12€ + 165€ einmalig |
| Google Workspace | 6€/User | 72€/User |
| Microsoft 365 | 5€/User | 60€/User |
| Mailbox.org | 3€ | 36€ |
| Hetzner Mail | 1€ | 12€ |
→ Ab Jahr 2 ist eigener Server die günstigste Lösung!
Troubleshooting
Emails landen im Spam
- SPF/DKIM/DMARC prüfen: https://mxtoolbox.com
- IP-Reputation prüfen: https://www.spamhaus.org/lookup/
- Blacklist-Check: https://multirbl.valli.org
Keine Emails empfangen
- MX-Record prüfen:
dig MX manacore.ai - Port 25 offen?
telnet mail.manacore.ai 25 - Firewall/Router Portforwarding prüfen
Zertifikat-Fehler
# SSL erneuern
cd /opt/mailcow-dockerized
sudo docker compose exec acme-mailcow /etc/scripts/renew-ssl.sh
Checkliste vor Inbetriebnahme
- Hardware bestellt und eingerichtet
- Statische IP oder DynDNS konfiguriert
- Ports 25, 465, 587, 993, 443 weitergeleitet
- Debian/Ubuntu installiert
- Docker installiert
- Mailcow installiert
- DNS-Records erstellt (MX, A, SPF, DKIM, DMARC)
- Admin-Passwort geändert
- Domain hinzugefügt
- DKIM-Key in DNS eingetragen
- Postfächer erstellt
- Test-Emails gesendet und empfangen
- Spam-Test bestanden (mail-tester.com)
- Backup eingerichtet
- Mac Mini auf neuen Server umgestellt
Zeitplan
| Phase | Dauer | Beschreibung |
|---|---|---|
| Hardware beschaffen | 1-3 Tage | Bestellung/Lieferung |
| OS installieren | 30 min | Debian/Ubuntu Setup |
| Mailcow installieren | 1 Stunde | Docker + Mailcow |
| DNS konfigurieren | 30 min | Records anlegen |
| Postfächer einrichten | 15 min | Users anlegen |
| Testing | 1-2 Stunden | Senden/Empfangen testen |
| Mac Mini umstellen | 15 min | msmtp anpassen |
| Gesamt | ~1 Tag |