diff --git a/README.md b/README.md index 4f37433..c299efd 100644 --- a/README.md +++ b/README.md @@ -1 +1,28 @@ -Collection of Scripts an Tools to handle small "problems" of ISPConfig \ No newline at end of file +Collection of Scripts an Tools to handle small "problems" of ISPConfig + +# Update Cert-Files and restart Services after Let's Encrypt-Certificates where updated + +Stolen here: https://www.howtoforge.com/securing-your-ispconfig-3-managed-mailserver-with-a-valid-lets-encrypt-certificate/ + +Files are in this repository but renamed to be more neutral and not "mailserver"-stuff + +Checks for configs of: +* Postfix +* Dovecot +* pure-ftpd +* influx +* coturn + +Updates Cert-Files and restarts. + +Update Domain-Name in files and copy them to: +``` +/usr/local/bin/le_services_restart.sh +/etc/systemd/system/le-services-restart.service +/etc/systemd/system/le-services-restart.path +``` + +Don't forget to: +``` +chmod +x /usr/local/bin/le_services_restart.sh +``` diff --git a/le_services_restart.sh b/le_services_restart.sh index 0e5f047..4878514 100644 --- a/le_services_restart.sh +++ b/le_services_restart.sh @@ -8,23 +8,40 @@ # Short-Description: LE SERVICES CERT AUTO UPDATER # Description: Restart services automatically when a new Let's Encrypt certificate is issued. ### END INIT INFO -systemctl restart postfix -systemctl restart dovecot +# postfix +FILE=/etc/postfix/main.cf +if [ -f "$FILE" ]; then + systemctl restart influxd +fi + +# dovecot +FILE=/etc/dovecot/dovecot.conf +if [ -f "$FILE" ]; then + systemctl restart dovecot +fi # pro-tftp -cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem -cat /root/.acme.sh/server.example.com/server.example.com.key >> /etc/ssl/private/pure-ftpd.pem -systemctl restart pure-ftpd-mysql.service +FILE=/etc/pure-ftpd/pure-ftpd.conf +if [ -f "$FILE" ]; then + cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem + cat /root/.acme.sh/server.example.com/server.example.com.key >> /etc/ssl/private/pure-ftpd.pem + systemctl restart pure-ftpd-mysql.service +fi # influxdb FILE=/etc/influxdb/influxdb.pem if [ -f "$FILE" ]; then - cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/influxdb/influxdb.pem && systemctl restart influxd - cat /etc/letsencrypt/live/server.example.com/server.example.com.key > /etc/influxdb/influxdb.key && systemctl restart influxd + cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/influxdb/influxdb.pem + cat /etc/letsencrypt/live/server.example.com/server.example.com.key > /etc/influxdb/influxdb.key + systemctl restart influxd fi - - - - +# coturn +FILE=/usr/local/etc/turn_server_cert.pem +if [ -f "$FILE" ]; then + cat /root/.acme.sh/server.example.com/fullchain.pem > /usr/local/etc/turn_server_cert.pem + cat /etc/letsencrypt/live/server.example.com/server.example.com.key > /usr/local/etc/turn_server_pkey.pem + chown turnserver /usr/local/etc/turn_server* + systemctl restart coturn +fi diff --git a/restart_services_on_cert_update.md b/restart_services_on_cert_update.md deleted file mode 100644 index 9ec7b02..0000000 --- a/restart_services_on_cert_update.md +++ /dev/null @@ -1,21 +0,0 @@ -# LetsEncrypt - -from: https://www.howtoforge.com/securing-your-ispconfig-3-managed-mailserver-with-a-valid-lets-encrypt-certificate/ - - -``` sh -nano /usr/local/bin/le_services_restart.sh -``` - -``` sh -chmod +x /usr/local/bin/le_services_restart.sh -``` - - -``` sh -nano /etc/systemd/system/le-services-restart.service -``` - -```sh -nano /etc/systemd/system/le-services-restart.path -```