Created
December 4, 2014 11:35
-
-
Save booo/106780740fa824a0d73f to your computer and use it in GitHub Desktop.
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 | |
COMMON_NAME=$1 | |
if [ "${COMMON_NAME}x" = "x" ]; then | |
echo "Usage: ./genkey.sh <dns>" | |
exit 1 | |
fi | |
SUB=" | |
C=DE | |
ST=Berlin | |
O=Freifunk Berlin | |
localityName=Berlin | |
commonName=${COMMON_NAME} | |
organizationalUnitName=Freifunk Berlin | |
[email protected] | |
" | |
openssl req -new \ | |
-newkey rsa:4096 -keyout "private/${COMMON_NAME}.key" \ | |
-sha256 \ | |
-nodes \ | |
-out "csrs/${COMMON_NAME}.csr" \ | |
-batch -subj "$(echo -n "$SUB" | tr "\n" "/")" | |
openssl asn1parse -in "csrs/${COMMON_NAME}.csr" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment