Skip to content

Instantly share code, notes, and snippets.

@JamesTheAwesomeDude
Created November 24, 2017 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesTheAwesomeDude/e1a2e86403ef160d5905afed3c01f180 to your computer and use it in GitHub Desktop.
Save JamesTheAwesomeDude/e1a2e86403ef160d5905afed3c01f180 to your computer and use it in GitHub Desktop.
tl;dr of registering for Let's Encrypt
#!/bin/bash
SAN=("${@}")
SAN=( "${SAN[@]/#/DNS:}" )
openssl req -new\
-outform pem\
-out "${1}.csr"\
-newkey ec\
-pkeyopt ec_paramgen_curve:secp384r1\
-nodes\
-keyout "${1}.key"\
-subj /CN="${1}"\
-reqexts SAN\
-config <(
(
printf "[SAN]\nsubjectAltName=";(IFS=","; printf '%s\n' "${SAN[*]}")
)| cat /etc/ssl/openssl.cnf -
)\
-keyform pem &&\
openssl req -in "${1}.csr" -text -noout &&\
python acme_tiny.py\
--account-key /etc/ssh/ssh_host_rsa_key\
--acme-dir "/var/www/${1}/.well-known/acme-challenge/"\
--csr "${1}.csr"\
> "${1}.crt" &&\
openssl x509 -in "${1}.crt" -text -noout &&\
cat "${1}.key" "${1}.crt" > "${1}.pem"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment