Skip to content

Instantly share code, notes, and snippets.

@mhou1981
Created November 18, 2020 20:01
Show Gist options
  • Save mhou1981/6c8e1246110a60825f0fd8f845fa8137 to your computer and use it in GitHub Desktop.
Save mhou1981/6c8e1246110a60825f0fd8f845fa8137 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Put this shell script under /etc/letsencrypt/renewal-hooks/post to auto update plex SSL with Let's Encrypt.
HOSTNAME="$(hostname -f)"
openssl pkcs12 -export -out /var/lib/plexmediaserver/certificate.pfx -inkey /etc/letsencrypt/live/${HOSTNAME}/privkey.pem -in /etc/letsencrypt/live/${HOSTNAME}/cert.pem -certfile /etc/letsencrypt/live/${HOSTNAME}/chain.pem -passout pass:
chown plex:plex /var/lib/plexmediaserver/certificate.pfx
sleep 5
systemctl restart plexmediaserver.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment