Last active
November 29, 2017 11:39
-
-
Save oprietop/842d38987416461f97531d10e2f28775 to your computer and use it in GitHub Desktop.
Bourne Shell script to create self-signed certs
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/sh | |
# We can set our CN using it as an argument | |
[ -n "$1" ] && CN=$1 || CN=localhost | |
# RSA params | |
RSA=2048 | |
DAYS=365 | |
# subj Params | |
C=HU | |
ST=Latveria | |
L=Doomstadt | |
O=CastleDoom | |
OU=IT | |
[email protected] | |
# Do It | |
openssl req -new -newkey rsa:$RSA -days $DAYS -nodes -x509 \ | |
-subj "/C=$C/ST=$ST/L=$CN/O=$O/OU=$OU/CN=$CN/emailAddress=$emailAdress" \ | |
-keyout $CN.key -out $CN.cert > /dev/null 2>&1 | |
# Print the certs | |
echo "# $CN.key" | |
cat $CN.key | |
echo "# $CN.cert" | |
cat $CN.cert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment