Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Abdelkrim/af2060e43aca086ff99bc364b80e01a9 to your computer and use it in GitHub Desktop.
Save Abdelkrim/af2060e43aca086ff99bc364b80e01a9 to your computer and use it in GitHub Desktop.
use certbot to generate a self signed certificate and convert a .pem into .pfx
#!/bin/bash
# https://dev.to/ope/securing-your-azure-web-app-with-let-s-encrypt-4g99
echo please indicate the domaine name i.e. alt-f1.be
read domain_name
# domain_name=betterop.alt-f1.be
sudo certbot certonly -d $domain_name --manual --preferred-challenges dns
SOURCE=/etc/letsencrypt/live/$domain_name
sudo cp $SOURCE/{cert.pem,privkey.pem,chain.pem} .
username=abo
# make the files your own
# assuming your username is ope...
sudo chown $username *.pem
# finally, create the private certificate,
# saving it to "certificate.pfx"
openssl pkcs12 -export -out $domain_name.certificate.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment