Created
November 24, 2017 23:19
-
-
Save James-E-A/e1a2e86403ef160d5905afed3c01f180 to your computer and use it in GitHub Desktop.
tl;dr of registering for Let's Encrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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