setup-email-pve.sh aktualisiert
This commit is contained in:
@@ -1,49 +1,47 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
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
|
echo
|
||||||
|
read -rp "Mailto Adresse (Empfänger): " MAILTO
|
||||||
|
|
||||||
# Abfragen
|
SENDER="mailout"
|
||||||
read -rp "▶️ SMTP-Absenderadresse (z.B. pve@example.com): " MAILFROM
|
TARGET="mail-to-root"
|
||||||
read -rp "▶️ SMTP-Hostname (z.B. smtp.example.com:587): " SMTPHOST
|
MATCHER="default-matcher"
|
||||||
read -rp "▶️ SMTP-Benutzername: " SMTPUSER
|
POLICY="default"
|
||||||
read -rsp "▶️ SMTP-Passwort: " SMTPPASS
|
|
||||||
echo
|
|
||||||
read -rp "▶️ Empfängeradresse für Benachrichtigungen: " RCPT
|
|
||||||
|
|
||||||
SENDER_NAME="default"
|
echo "Setze SMTP Sender..."
|
||||||
TARGET_NAME="mail-admin"
|
pvesh set /config/notifications/senders/$SENDER \
|
||||||
POLICY_NAME="default"
|
|
||||||
MAILNAME=$(hostname -f)
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "🚀 Konfiguriere SMTP-Sender '$SENDER_NAME'..."
|
|
||||||
pvesh set /config/notifications/senders/$SENDER_NAME \
|
|
||||||
--type smtp \
|
--type smtp \
|
||||||
--mailfrom "$MAILFROM" \
|
--author "$AUTHOR" \
|
||||||
--mailname "$MAILNAME" \
|
--from-address "$FROMADDR" \
|
||||||
--smarthost "$SMTPHOST" \
|
--server "$SERVER" \
|
||||||
--authuser "$SMTPUSER" \
|
--port "$PORT" \
|
||||||
--password "$SMTPPASS"
|
--mode "$MODE" \
|
||||||
|
--username "$USERNAME" \
|
||||||
|
--password "$PASSWORD"
|
||||||
|
|
||||||
echo "✅ Sender eingerichtet."
|
echo "Setze Ziel..."
|
||||||
|
pvesh set /config/notifications/targets/$TARGET \
|
||||||
echo "🚀 Konfiguriere Ziel '$TARGET_NAME'..."
|
|
||||||
pvesh set /config/notifications/targets/$TARGET_NAME \
|
|
||||||
--type sendmail \
|
--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'..."
|
echo "Setze Policy..."
|
||||||
pvesh set /config/notifications/policy/$POLICY_NAME \
|
pvesh set /config/notifications/policies/$POLICY \
|
||||||
--targets "$TARGET_NAME" \
|
--sender "$SENDER" \
|
||||||
--sender "$SENDER_NAME"
|
--targets "$TARGET"
|
||||||
|
|
||||||
echo "✅ Policy eingerichtet."
|
echo "Fertig! Prüfe die Einstellungen in der WebUI."
|
||||||
|
|
||||||
echo
|
|
||||||
echo "🎉 Benachrichtigungs-Konfiguration abgeschlossen!"
|
|
||||||
echo "Du kannst sie unter 'Rechenzentrum → Benachrichtigungen' in der WebUI ansehen und testen."
|
|
||||||
|
|||||||
Reference in New Issue
Block a user