added tool to restart mailservers after cert changed

This commit is contained in:
Alexander Gabriel 2025-01-15 21:31:27 +01:00
parent 95f37fe9f2
commit 725be731aa
5 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1 @@
Collection of Scripts an Tools to handle small "problems" of ISPConfig

View File

@ -0,0 +1,9 @@
[Unit]
Description="Monitor the mailserver certificate files to trigger a e-mail services restart after the certificates has been renewed"
[Path]
PathModified=/root/.acme.sh/mail.example.com/
Unit=le-mailserver-restart.service
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
[Unit]
Description="Run script to restart Postfix and Dovecot after the certificate has been renewed"
[Service]
ExecStart=/usr/local/bin/le_mailserver_restart.sh

12
le_mailserver_restart.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: LE MAILSERVER CERT AUTO UPDATER
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: LE MAILSERVER CERT AUTO UPDATER
# Description: Restart mail server automatically when a new Let's Encrypt certificate is issued.
### END INIT INFO
systemctl restart postfix
systemctl restart dovecot

View File

@ -0,0 +1,21 @@
# LetsEncrypt
from: https://www.howtoforge.com/securing-your-ispconfig-3-managed-mailserver-with-a-valid-lets-encrypt-certificate/
``` sh
nano /usr/local/bin/le_mailserver_restart.sh
```
``` sh
chmod +x /usr/local/bin/le_mailserver_restart.sh
```
``` sh
nano /etc/systemd/system/le-mailserver-restart.service
```
```sh
nano /etc/systemd/system/le-mailserver-restart.path
```