dda5c746ce
- PLESK_BACKEND={manual,api,ssh}: manual als Default für Shared Hosts,
api unverändert, ssh ruft `plesk bin mail` per paramiko auf.
- POP3_PORT default 995, POP3_SSL mit Auto-Erkennung anhand Port.
- Kerio: User wird mit mayChangePassword=False angelegt.
- Zusätzliche Minimal-PDF (nur Email + Cloud) pro Konto + Sammel-Variante,
IMAP-Port konfigurierbar.
- CLI-Flag --pdf-only und entsprechender GUI-Button "📄 Nur PDF".
- GUI: Lösch-Button "✕ löschen" sichtbarer, letzte Zeile löschbar.
- PDFs sind kunden-tauglich (kein Status-Block, kein ACHTUNG-Hinweis);
Anlage-Status separat in _admin_report_<ts>.txt.
- README dokumentiert die Skip-Logik pro Dienst und ihre Caveats.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60 lines
2.3 KiB
Python
60 lines
2.3 KiB
Python
import os
|
||
from dotenv import load_dotenv
|
||
|
||
load_dotenv()
|
||
|
||
|
||
def _bool(v: str, default: bool = False) -> bool:
|
||
if v is None:
|
||
return default
|
||
return v.strip().lower() in ("1", "true", "yes", "on", "ja")
|
||
|
||
|
||
class Config:
|
||
# Plesk-Backend:
|
||
# "manual" – Tool legt nichts an, das Mailpostfach muss von Hand
|
||
# im Plesk-Webinterface angelegt werden (Shared-Host-Fall).
|
||
# Die Zugangsdaten werden trotzdem im PDF ausgegeben, damit
|
||
# der Admin sie 1:1 ins Plesk-Webinterface eintragen kann.
|
||
# "api" – Plesk REST-API (braucht API-Key oder Admin-Login)
|
||
# "ssh" – SSH zum Plesk-Server, ruft `plesk bin mail` auf
|
||
PLESK_BACKEND = (os.getenv("PLESK_BACKEND") or "manual").strip().lower()
|
||
|
||
# Plesk REST-API
|
||
PLESK_API_KEY = os.getenv("PLESK_API_KEY") or ""
|
||
PLESK_USER = os.getenv("PLESK_USER") or ""
|
||
PLESK_PASSWORD = os.getenv("PLESK_PASSWORD") or ""
|
||
PLESK_PORT = int(os.getenv("PLESK_PORT", "8443"))
|
||
|
||
# Plesk SSH-Backend
|
||
PLESK_SSH_PORT = int(os.getenv("PLESK_SSH_PORT", "22"))
|
||
PLESK_SSH_USER = os.getenv("PLESK_SSH_USER") or ""
|
||
PLESK_SSH_PASSWORD = os.getenv("PLESK_SSH_PASSWORD") or ""
|
||
PLESK_SSH_KEY = os.getenv("PLESK_SSH_KEY") or ""
|
||
PLESK_SSH_KEY_PASSPHRASE = os.getenv("PLESK_SSH_KEY_PASSPHRASE") or ""
|
||
PLESK_SSH_USE_SUDO = _bool(os.getenv("PLESK_SSH_USE_SUDO"), False)
|
||
|
||
KERIO_USER = os.getenv("KERIO_ADMIN_USER") or "Admin"
|
||
KERIO_PASSWORD = os.getenv("KERIO_ADMIN_PASSWORD") or ""
|
||
KERIO_PORT = int(os.getenv("KERIO_ADMIN_PORT", "4040"))
|
||
|
||
NEXTCLOUD_USER = os.getenv("NEXTCLOUD_ADMIN_USER") or ""
|
||
NEXTCLOUD_PASSWORD = os.getenv("NEXTCLOUD_ADMIN_PASSWORD") or ""
|
||
|
||
POP3_PORT = int(os.getenv("POP3_PORT", "995"))
|
||
POP3_KEEP_DAYS = int(os.getenv("POP3_KEEP_DAYS", "14"))
|
||
SMTP_PORT = int(os.getenv("SMTP_PORT", "465"))
|
||
IMAP_PORT = int(os.getenv("IMAP_PORT", "993"))
|
||
|
||
# SSL für POP3-Sammler:
|
||
# - explizit per POP3_SSL=true|false setzbar
|
||
# - sonst Auto-Erkennung anhand des Ports:
|
||
# 110 (Plain POP3) → SSL aus, alles andere (995, 465, …) → SSL an
|
||
_pop3_ssl_env = os.getenv("POP3_SSL")
|
||
if _pop3_ssl_env is None or _pop3_ssl_env == "":
|
||
POP3_SSL = POP3_PORT != 110
|
||
else:
|
||
POP3_SSL = _bool(_pop3_ssl_env, True)
|
||
|
||
VERIFY_TLS = _bool(os.getenv("VERIFY_TLS"), True)
|