Autogenerate pkcs12 cert

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
dhernan3
Posts: 5
Joined: Thu Jul 27, 2017 7:10 am

Autogenerate pkcs12 cert

Post by dhernan3 »

Hi, I would like you to autogenerate pkcs12 certs when letsencrypt certs are generated or renewed.
What I do is to run the following script in cron.monthly, but it's a manual procedure at first (I'm migrating my rpi3 to latest version of dietpi from v159)
With the pkcs12 cert generated I can secure PlexMediaServer.

The script I use is:

#!/bin/bash

DOMAIN=$(head -n 1 /DietPi/dietpi/.dietpi-letsencrypt)
certdir=/etc/letsencrypt/live/$DOMAIN/

openssl pkcs12 -export -in $certdir/fullchain.pem -inkey $certdir/privkey.pem -out $certdir/cert_and_key.p12 -name dietpi -CAfile $certdir/chain.pem -caname root -password pass:aaa


If possible, it would be interesting also to change that password for the certificate (aaa) to use the system password.
Post Reply