Last active
March 23, 2020 06:44
-
-
Save maruware/c1acc8d81a5c5b152cc6ddaae196078c to your computer and use it in GitHub Desktop.
Generate TSL certificate
This file contains hidden or 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 | |
CN=${CN:-example.com} | |
NAME=${NAME:-example} | |
DST=${DST:-.} | |
echo "CN=$CN, NAME=$NAME, DST=$DST" | |
openssl req -nodes -newkey rsa:2048 -subj "/CN=$CN/O=$NAME" \ | |
-keyout $DST/$NAME.key -out $DST/$NAME.csr && \ | |
openssl x509 -req -signkey $DST/$NAME.key -in $DST/$NAME.csr -out $DST/$NAME.crt && \ | |
rm -f $DST/$NAME.csr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment