Compare commits

..

No commits in common. "61e57ea542135cd950f95095e6d05f1db8d853ff" and "78137389b4c37cb2a6fa475791bfb0489ef48942" have entirely different histories.

2 changed files with 1 additions and 55 deletions

View File

@ -1,37 +1,3 @@
# Cloudflare-Certificate-for-Plex
This script is for grabing a Let's Encrypt Certificate from Cloudflare and convert it to pkcs12 for Plex.
## Install required packages
`apt-get install python3-certbot python3-certbot-dns-cloudflare`
## Setup Secret File
`mkdir -p ~/.secrets/certbot/`
`touch ~/.secrets/certbot/cloudflare.ini`
`chmod 600 ~/.secrets/certbot/cloudflare.ini`
## Add the follow to the cloudflare.ini file
`dns_cloudflare_email = CLOUDFLARE_USER_ACCOUNT`
`dns_cloudflare_api_key = SECRET_TOKEN`
## Pull Initial Certificate from Cloudflare
`certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/.secrets/certbot/cloudflare.ini -m EmailAddress -d DomainName`
## Edit plex-cert.sh with your setup details
## Manual Run
`/root/plex-cert.sh`
## Add crontab Entry for auto renewal
`0 0,12 * * * root sleep 609 && certbot renew -q && /root/plex-cert.sh`
## Enable certificate on Plex
Under the settings in the Plex web GUI select **Network** then change the following:
- **Secure connections:** Required
- **Custom certificate location:** /PlexCertPath/plex_certificate.p12
- **Custom certificate encryption key:** PlexCertPass
- **Custom certificate domain:** DomainName
## Checking the experation date on certificate
`openssl pkcs12 -in /PlexCertPath/plex_certificate.p12 -nokeys -passin pass:"PlexCertPass" -clcerts | openssl x509 -enddate`
This script is for grabing a Let's Encrypt Certificate from Cloudflare and convert it to pkcs12 for Plex

View File

@ -1,20 +0,0 @@
#!/bin/bash
DomainName="plex.yourdomain.com"
PlexCertPath="/opt/plex/cert"
PlexCertPass="Password_Here"
PlexDockerName="Plex_Docker_Container_Name"
# Create PKCS #12 Cert
openssl pkcs12 -export \
-out $PlexCertPath/plex_certificate.p12 \
-in /etc/letsencrypt/live/$DomainName/cert.pem \
-inkey /etc/letsencrypt/live/$DomainName/privkey.pem \
-certfile /etc/letsencrypt/live/$DomainName/chain.pem \
-passout pass:$PlexCertPass \
-certpbe AES-256-CBC -keypbe AES-256-CBC -macalg SHA256
chmod 755 $PlexCertPath/plex_certificate.p12
# Restart Plex docker container
docker restart $PlexDockerName