setup-email-pve.sh aktualisiert
This commit is contained in:
@@ -2,35 +2,35 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
CFG="/etc/pve/notifications.cfg"
|
CFG="/etc/pve/notifications.cfg"
|
||||||
BACKUP="/etc/pve/notifications.cfg.bak.$(date +%Y%m%d%H%M%S)"
|
|
||||||
|
|
||||||
|
if [ ! -f "$CFG" ]; then
|
||||||
|
echo "Fehler: $CFG nicht gefunden!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup anlegen
|
||||||
|
BACKUP="${CFG}.bak.$(date +%Y%m%d%H%M%S)"
|
||||||
cp "$CFG" "$BACKUP"
|
cp "$CFG" "$BACKUP"
|
||||||
echo "Backup erstellt: $BACKUP"
|
echo "Backup erstellt: $BACKUP"
|
||||||
|
|
||||||
cat > "$CFG" << 'EOF'
|
# Eingaben abfragen
|
||||||
sendmail: mail-to-root
|
read -rp "Author (z.B. MH-PVE02 | MAIERHOME H33): " AUTHOR
|
||||||
comment Send mails to root@pam's email address
|
read -rp "From-Address (z.B. MH-PVE02@vmd55888.de): " FROMADDR
|
||||||
disable false
|
read -rp "Empfänger-Mailadresse (mailto): " MAILTO
|
||||||
mailto-user root@pam
|
read -rp "SMTP Server (z.B. mail.vmd55888.de): " SERVER
|
||||||
|
read -rp "SMTP Port (z.B. 587): " PORT
|
||||||
|
read -rp "Modus (starttls/ssl/none): " MODE
|
||||||
|
read -rp "SMTP Benutzername: " USERNAME
|
||||||
|
|
||||||
smtp: mailout
|
# sed ersetzt gezielt die Zeilen in der Sektion smtp: mailout
|
||||||
author MH-PVE02 | MAIERHOME H33
|
sed -i "/^smtp: mailout/,/^$/ {
|
||||||
from-address MH-PVE02@vmd55888.de
|
s/^ author .*/ author $AUTHOR/
|
||||||
mailto pbs-dashboard@mail.vmd55888.de
|
s/^ from-address .*/ from-address $FROMADDR/
|
||||||
mailto-user root@pam
|
s/^ mailto .*/ mailto $MAILTO/
|
||||||
mode starttls
|
s/^ server .*/ server $SERVER/
|
||||||
port 587
|
s/^ port .*/ port $PORT/
|
||||||
server mail.vmd55888.de
|
s/^ mode .*/ mode $MODE/
|
||||||
username mailout
|
s/^ username .*/ username $USERNAME/
|
||||||
|
}" "$CFG"
|
||||||
|
|
||||||
matcher: default-matcher
|
echo "Konfiguration aktualisiert. Bitte Passwort im WebUI setzen!"
|
||||||
comment Route all notifications to mail-to-root
|
|
||||||
mode all
|
|
||||||
target mail-to-root
|
|
||||||
|
|
||||||
policy: default
|
|
||||||
sender mailout
|
|
||||||
targets mail-to-root
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Config geschrieben. Passwort bitte manuell in WebUI setzen."
|
|
||||||
|
|||||||
Reference in New Issue
Block a user