33 lines
1.1 KiB
Bash
33 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
echo "=== Proxmox VE 8 Benachrichtigungssystem konfigurieren ==="
|
|
|
|
read -p "SMTP Server: " SMTP_SERVER
|
|
read -p "SMTP Port [587]: " SMTP_PORT
|
|
SMTP_PORT=${SMTP_PORT:-587}
|
|
|
|
read -p "SMTP Benutzer: " SMTP_USER
|
|
read -s -p "SMTP Passwort: " SMTP_PASS
|
|
echo
|
|
|
|
read -p "Absender-Adresse: " MAIL_FROM
|
|
read -p "Mail-Zieladresse: " MAIL_TO
|
|
|
|
# Sender erstellen
|
|
pvesh create /config/notifications/senders/default --mailname "$(hostname -f)" \
|
|
--mailfrom "$MAIL_FROM" --smarthost "$SMTP_SERVER:$SMTP_PORT" \
|
|
--authuser "$SMTP_USER" --password "$SMTP_PASS" --type smtp
|
|
|
|
# Ziel konfigurieren
|
|
pvesh create /config/notifications/targets/mail-admin --type sendmail \
|
|
--mailto "$MAIL_TO"
|
|
|
|
# Policy setzen (optional)
|
|
pvesh set /config/notifications/policy/default --targets mail-admin --sender default
|
|
|
|
echo
|
|
echo "==> Testmail wird versendet..."
|
|
proxmox-notify test --target mail-admin --subject "Test von $(hostname)" --body "Das ist eine Testmail vom neuen Benachrichtigungssystem (PVE 8)."
|
|
|
|
echo "==> Konfiguration abgeschlossen. Überprüfbar in der Web-GUI unter Rechenzentrum → Benachrichtigungen."
|