Hi, I use nginx-proxy-manager to manage my certificates. My mailcow runs on different vm. I can successfully import the certificate by using instructions for the post hook script

, but I’m looking for advice on best way how to automate this now.

I’m thinking sharing the cert directory over nfs to mailcow vm, and then use something like inotifywait to run the post hook script and restart the 3 containers if the files change.

If you’re using the post hook script how do you manage the renews automatically?

  • majorgear likes this.
  • I forgot about this, but here is the solution I’m using:

    #!/bin/bash
    scp pi@192.168.1.101:/home/pi/docker/nginx-proxy-manager/letsencrypt/live/npm-29/fullchain.pem /opt/mailcow-dockerized/data/assets/ssl/cert.pem
    scp pi@192.168.1.101:/home/pi/docker/nginx-proxy-manager/letsencrypt/live/npm-29/privkey.pem /opt/mailcow-dockerized/data/assets/ssl/key.pem
    postfix_c=$(docker ps -qaf name=postfix-mailcow)
    dovecot_c=$(docker ps -qaf name=dovecot-mailcow)
    nginx_c=$(docker ps -qaf name=nginx-mailcow)
    docker restart ${postfix_c} ${dovecot_c} ${nginx_c}

    running via cron on the 1st day of every 2nd month
    0 1 * */2 * bash /opt/mailcow_cert_renew.sh >/dev/null 2>&1

4 months later

I forgot about this, but here is the solution I’m using:

#!/bin/bash
scp pi@192.168.1.101:/home/pi/docker/nginx-proxy-manager/letsencrypt/live/npm-29/fullchain.pem /opt/mailcow-dockerized/data/assets/ssl/cert.pem
scp pi@192.168.1.101:/home/pi/docker/nginx-proxy-manager/letsencrypt/live/npm-29/privkey.pem /opt/mailcow-dockerized/data/assets/ssl/key.pem
postfix_c=$(docker ps -qaf name=postfix-mailcow)
dovecot_c=$(docker ps -qaf name=dovecot-mailcow)
nginx_c=$(docker ps -qaf name=nginx-mailcow)
docker restart ${postfix_c} ${dovecot_c} ${nginx_c}

running via cron on the 1st day of every 2nd month
0 1 * */2 * bash /opt/mailcow_cert_renew.sh >/dev/null 2>&1

Have something to say?

Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

No one is typing