setup-email-pve.sh aktualisiert
This commit is contained in:
@@ -1,49 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔧 Konfiguration von Proxmox VE Benachrichtigungen (PVE 8.x)"
|
||||
read -rp "SMTP author (z.B. MH-PVE02 | MAIERHOME H33): " AUTHOR
|
||||
read -rp "SMTP from-address (z.B. MH-PVE02@vmd55888.de): " FROMADDR
|
||||
read -rp "SMTP server (z.B. mail.vmd55888.de): " SERVER
|
||||
read -rp "SMTP port (z.B. 587): " PORT
|
||||
read -rp "SMTP mode (starttls/ssl/none): " MODE
|
||||
read -rp "SMTP username: " USERNAME
|
||||
read -rsp "SMTP password: " PASSWORD
|
||||
echo
|
||||
read -rp "Mailto Adresse (Empfänger): " MAILTO
|
||||
|
||||
# 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="mailout"
|
||||
TARGET="mail-to-root"
|
||||
MATCHER="default-matcher"
|
||||
POLICY="default"
|
||||
|
||||
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 \
|
||||
echo "Setze SMTP Sender..."
|
||||
pvesh set /config/notifications/senders/$SENDER \
|
||||
--type smtp \
|
||||
--mailfrom "$MAILFROM" \
|
||||
--mailname "$MAILNAME" \
|
||||
--smarthost "$SMTPHOST" \
|
||||
--authuser "$SMTPUSER" \
|
||||
--password "$SMTPPASS"
|
||||
--author "$AUTHOR" \
|
||||
--from-address "$FROMADDR" \
|
||||
--server "$SERVER" \
|
||||
--port "$PORT" \
|
||||
--mode "$MODE" \
|
||||
--username "$USERNAME" \
|
||||
--password "$PASSWORD"
|
||||
|
||||
echo "✅ Sender eingerichtet."
|
||||
|
||||
echo "🚀 Konfiguriere Ziel '$TARGET_NAME'..."
|
||||
pvesh set /config/notifications/targets/$TARGET_NAME \
|
||||
echo "Setze Ziel..."
|
||||
pvesh set /config/notifications/targets/$TARGET \
|
||||
--type sendmail \
|
||||
--mailto "$RCPT"
|
||||
--mailto "$MAILTO" \
|
||||
--mailto-user root@pam
|
||||
|
||||
echo "✅ Ziel eingerichtet."
|
||||
echo "Setze Matcher..."
|
||||
pvesh set /config/notifications/matchers/$MATCHER \
|
||||
--comment "Route all notifications to $TARGET" \
|
||||
--mode all \
|
||||
--target "$TARGET"
|
||||
|
||||
echo "🚀 Setze Standard-Policy '$POLICY_NAME'..."
|
||||
pvesh set /config/notifications/policy/$POLICY_NAME \
|
||||
--targets "$TARGET_NAME" \
|
||||
--sender "$SENDER_NAME"
|
||||
echo "Setze Policy..."
|
||||
pvesh set /config/notifications/policies/$POLICY \
|
||||
--sender "$SENDER" \
|
||||
--targets "$TARGET"
|
||||
|
||||
echo "✅ Policy eingerichtet."
|
||||
|
||||
echo
|
||||
echo "🎉 Benachrichtigungs-Konfiguration abgeschlossen!"
|
||||
echo "Du kannst sie unter 'Rechenzentrum → Benachrichtigungen' in der WebUI ansehen und testen."
|
||||
echo "Fertig! Prüfe die Einstellungen in der WebUI."
|
||||
|
||||
Reference in New Issue
Block a user