Files
setup-email-pve-pbs/setup-email-pve.sh

50 lines
1.3 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -e
echo "🔧 Konfiguration von Proxmox VE Benachrichtigungen (PVE 8.x)"
echo
# Abfragen
read -rp "▶️ SMTP-Absenderadresse (z.B. pve@example.com): " MAILFROM
read -rp "▶️ SMTP-Hostname (z.B. smtp.example.com:587): " SMTPHOST
read -rp "▶️ SMTP-Benutzername: " SMTPUSER
read -rsp "▶️ SMTP-Passwort: " SMTPPASS
echo
read -rp "▶️ Empfängeradresse für Benachrichtigungen: " RCPT
SENDER_NAME="default"
TARGET_NAME="mail-admin"
POLICY_NAME="default"
MAILNAME=$(hostname -f)
echo
echo "🚀 Konfiguriere SMTP-Sender '$SENDER_NAME'..."
pvesh set /config/notifications/senders/$SENDER_NAME \
--type smtp \
--mailfrom "$MAILFROM" \
--mailname "$MAILNAME" \
--smarthost "$SMTPHOST" \
--authuser "$SMTPUSER" \
--password "$SMTPPASS"
echo "✅ Sender eingerichtet."
echo "🚀 Konfiguriere Ziel '$TARGET_NAME'..."
pvesh set /config/notifications/targets/$TARGET_NAME \
--type sendmail \
--mailto "$RCPT"
echo "✅ Ziel eingerichtet."
echo "🚀 Setze Standard-Policy '$POLICY_NAME'..."
pvesh set /config/notifications/policy/$POLICY_NAME \
--targets "$TARGET_NAME" \
--sender "$SENDER_NAME"
echo "✅ Policy eingerichtet."
echo
echo "🎉 Benachrichtigungs-Konfiguration abgeschlossen!"
echo " Du kannst sie unter 'Rechenzentrum → Benachrichtigungen' in der WebUI ansehen und testen."