diff --git a/README.md b/README.md index e69de29..4f37433 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +Collection of Scripts an Tools to handle small "problems" of ISPConfig \ No newline at end of file diff --git a/le-mailserver-restart.path b/le-mailserver-restart.path new file mode 100644 index 0000000..7dd8689 --- /dev/null +++ b/le-mailserver-restart.path @@ -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 diff --git a/le-mailserver-restart.service b/le-mailserver-restart.service new file mode 100644 index 0000000..b6f9e53 --- /dev/null +++ b/le-mailserver-restart.service @@ -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 diff --git a/le_mailserver_restart.sh b/le_mailserver_restart.sh new file mode 100644 index 0000000..663ffce --- /dev/null +++ b/le_mailserver_restart.sh @@ -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 \ No newline at end of file diff --git a/restart_services_on_cert_update.md b/restart_services_on_cert_update.md new file mode 100644 index 0000000..44b1195 --- /dev/null +++ b/restart_services_on_cert_update.md @@ -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 +```