Hi @mikiwolf,
Regarding your questions, it seems my command is too technical for you. I’m sorry, I will try to explain some points, but the others will need more knowledge to be understood.
First, my Plex Server is on a virtual machine (CentOS 7), behind another virtual machine (pFsense) which acts like a UTM firewall.
I own my own domain (example : mydomain.com), so, I use my Plex Server on a dedicated URL (example : plex.mydomain.com). So, I can use my Plex Server with a browser directly with my own URL (example : https://plex.mydomain.com).
I do want use SSL (https) in order to secure connection. So, I have to use a true SSL certificate. Let’s Encrypt provides free SSL certificates limited to 3 months (you can renew them all the time). As I don’t want to renew my certificates manually every 3 months, I use the ACME package provided by pFsense. The command I gave is executed at every renewal in order Plex Server to take into account the new certificate.
1 - Convert the certificate in the pfx format
openssl pkcs12 -export -out /conf/acme/plex.my-domain.com_fullchain.pfx -inkey /conf/acme/plex.my-domain.com.key -in /tmp/acme/plex.my-domain.com/plex.my-domain.com/fullchain.cer -certfile /conf/acme/plex.my-domain.com.ca -password pass:mypass
openssl pkcs12 -export
==> I use the openssl
program to export my new certificate from the .cer format to the .pfx format.
-out /conf/acme/plex.my-domain.com_fullchain.pfx
==> the file where I want to export the fullchain.
-inkey /conf/acme/plex.my-domain.com.key
==> the original private key. It never changes.
-in /tmp/acme/plex.my-domain.com/plex.my-domain.com/fullchain.cer
==> The certificates created by ACME (pFsense). It contains the server certificate, the intermediate CA certificate and the root CA certificate. They will be converted and exported in the /conf/acme/plex.my-domain.com_fullchain.pfx
file.
-certfile /conf/acme/plex.my-domain.com.ca
==> The intermediate CA certificate which has signed my server certificate.
-password pass:mypass
==> I want to “secure” the certificate content. I define here a passkey (“mypass”). It will be necessary in order to read my .pfx certificate. I have to provide it to Plex next.
2 - Copy the .pfx certificate to the Plex Server
scp -i ~/.ssh/id_rsa /conf/acme/plex.my-domain.com_fullchain.pfx plex@myserver:/var/lib/plexmediaserver/
scp
==> I want to copy some files from a server to another
-i ~/.ssh/id_rsa
==> I use a SSH key in order to not provide a password for the connection.
/conf/acme/plex.my-domain.com_fullchain.pfx
==> the file I want to copy (source).
plex@myserver
==> The server user (plex) and the server name (myserver) I want to use to copy my file to.
/var/lib/plexmediaserver/
==> the location where I want to put the file I’ve copied.
3 - Restart Plex service
ssh root@myserver "systemctl restart plexmediaserver.service"
ssh
==> The program I use to connect to a server to send some commands
root@myserver
==> The server user (root) and the server name (myserver) I want to connect to.
systemctl restart plexmediaserver.service
==> This is systemd
from Linux. I can manage the services on my server with this. Here, I restart the Plex service in order Plex take in account the new certificate.
Is it clearer ?