added backup and email client

This commit is contained in:
2026-02-01 00:02:35 +01:00
parent ff857be01a
commit e4fdfbc95f
210 changed files with 24211 additions and 742 deletions
+22
View File
@@ -0,0 +1,22 @@
docker exec plesk-test bash -c '
# Entferne alte submission-Konfiguration falls vorhanden
sed -i "/^submission/,/^[^ ]/{ /^submission/d; /^ -o/d; }" /etc/postfix/master.cf
# Neue Konfiguration mit Dovecot SASL hinzufügen
cat >> /etc/postfix/master.cf << EOF
# Submission Port 587 für STARTTLS
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=/run/dovecot/auth-client
-o smtpd_sasl_security_options=noanonymous
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
EOF
postfix reload
echo "Done! Port 587 mit Dovecot SASL konfiguriert"
'
+20 -3
View File
@@ -8,13 +8,30 @@ services:
ports:
- "8443:8443" # Plesk Panel (HTTPS)
- "8880:8880" # Plesk Panel (HTTP)
- "25:25" # SMTP
- "465:465" # SMTPS
- "587:587" # Submission
- "143:143" # IMAP
- "993:993" # IMAPS
- "110:110" # POP3
- "995:995" # POP3S
volumes:
# Named Volume statt Bind-Mount (keine Permission-Probleme)
- plesk-data:/var/lib/plesk
# Plesk speichert Daten an mehreren Orten
- psa-data:/var/lib/psa # Hauptdaten (Domains, Konfiguration)
- psa-etc:/etc/psa # Plesk-Konfiguration
- mysql-data:/var/lib/mysql # Datenbank
- vhosts:/var/www/vhosts # Webseiten/Domains
- mail:/var/mail # Mailboxen
- postfix:/var/spool/postfix # Mail-Queue
restart: unless-stopped
privileged: true
volumes:
plesk-data:
psa-data:
psa-etc:
mysql-data:
vhosts:
mail:
postfix:
# Nach dem Start: ./setup-domain.sh ausführen
+18
View File
@@ -0,0 +1,18 @@
docker exec plesk-test bash -c '
# Postfix komplett neustarten (nicht nur reload)
postfix stop
postfix start
echo "Postfix neugestartet"
# Warte kurz
sleep 2
# Teste die Verbindung direkt im Container
echo ""
echo "=== Teste STARTTLS lokal ==="
echo "EHLO test" | timeout 5 openssl s_client -connect localhost:587 -starttls smtp 2>&1 | head -30
echo ""
echo "=== Letzte Mail-Logs ==="
tail -20 /var/log/maillog 2>/dev/null || tail -20 /var/log/mail.log 2>/dev/null || journalctl -u postfix --no-pager -n 20 2>/dev/null
'
+13
View File
@@ -0,0 +1,13 @@
docker exec plesk-test bash -c '
echo "=== Dovecot Auth Socket suchen ==="
find /var -name "auth*" -type s 2>/dev/null
find /run -name "auth*" -type s 2>/dev/null
echo ""
echo "=== Dovecot Auth Config ==="
grep -r "unix_listener" /etc/dovecot/ 2>/dev/null | head -20
echo ""
echo "=== Postfix SASL Config ==="
postconf smtpd_sasl_type smtpd_sasl_path 2>/dev/null
'
+68
View File
@@ -81,6 +81,72 @@ EOF'
docker exec $CONTAINER bash -c 'systemctl restart fail2ban 2>/dev/null || service fail2ban restart 2>/dev/null || true'
echo " -> Bantime auf 60 Sekunden gesetzt"
echo ""
echo "Aktiviere SMTP auf Port 587 (Submission/STARTTLS)..."
# Konfiguriere Dovecot Auth-Socket für Postfix-Zugriff
docker exec $CONTAINER bash -c '
# 1. Postfix-Benutzer zur Dovecot-Gruppe hinzufügen für Socket-Zugriff
usermod -aG dovecot postfix 2>/dev/null || true
echo "Postfix zur Dovecot-Gruppe hinzugefügt"
# 2. Dovecot-Konfiguration für Postfix SASL erweitern
# Prüfen ob auth-client bereits für Postfix konfiguriert ist
if ! grep -q "unix_listener auth-client" /etc/dovecot/conf.d/*auth*.conf 2>/dev/null; then
# Neue Auth-Socket Konfiguration für Postfix hinzufügen
cat >> /etc/dovecot/conf.d/10-master.conf << DOVECONF
# Auth-Socket für Postfix SASL (OpenCRM Setup)
service auth {
unix_listener auth-client {
mode = 0660
user = postfix
group = postfix
}
}
DOVECONF
echo "Dovecot Auth-Socket für Postfix konfiguriert"
# Dovecot neu laden
doveadm reload 2>/dev/null || systemctl reload dovecot 2>/dev/null || true
fi
# 3. Entferne alte submission-Konfiguration falls vorhanden
if grep -q "^submission" /etc/postfix/master.cf; then
echo "Entferne alte submission-Konfiguration..."
awk "/^submission/{skip=1; next} /^[^ \t]/ && skip{skip=0} !skip" /etc/postfix/master.cf > /tmp/master.cf.new
mv /tmp/master.cf.new /etc/postfix/master.cf
fi
# 4. Neue Submission-Konfiguration hinzufügen
cat >> /etc/postfix/master.cf << EOF
# Submission Port 587 für STARTTLS (OpenCRM Setup)
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=/run/dovecot/auth-client
-o smtpd_sasl_security_options=noanonymous
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
EOF
echo "Port 587 mit Dovecot SASL konfiguriert"
# 5. Dovecot neustarten damit Socket-Berechtigungen wirksam werden
systemctl restart dovecot 2>/dev/null || service dovecot restart 2>/dev/null || true
sleep 1
# 6. Socket-Berechtigungen als Fallback direkt setzen
chmod 666 /run/dovecot/auth-client 2>/dev/null || true
echo "Auth-Socket Berechtigungen gesetzt"
# 7. Postfix komplett neustarten (nicht nur reload)
postfix stop 2>/dev/null || true
postfix start
echo "Postfix neugestartet"
'
echo " -> SMTP Submission Port 587 konfiguriert"
echo ""
echo "Setze Admin-Passwort..."
docker exec $CONTAINER plesk bin admin --set-admin-password -passwd "$ADMIN_PASSWORD" 2>&1
@@ -124,6 +190,8 @@ echo " -> Policy auf 'None' setzen"
echo "4. Websites & Domains > Add Domain"
echo "5. Domain: stressfrei-wechseln.de"
echo "6. Mail-Service aktivieren"
echo "7. Optional: Tools & Settings > Mail Server Settings"
echo " -> 'Enable SMTP service on port 587' aktivieren (bereits per Script konfiguriert)"
echo ""
echo "============================================"
echo "OpenCRM Einstellungen"
+16
View File
@@ -0,0 +1,16 @@
# Teste SMTP direkt vom Container
docker exec -it plesk-test bash -c '
echo "Teste Port 587..."
# Prüfe ob Port 587 hört
ss -tlnp | grep 587
# Prüfe Postfix master.cf
echo ""
echo "=== Submission Config ==="
grep -A 10 "^submission" /etc/postfix/master.cf
# Prüfe SASL
echo ""
echo "=== SASL Status ==="
ls -la /var/spool/postfix/private/auth 2>/dev/null || echo "Auth socket nicht gefunden"
'