Skip to content

Instantly share code, notes, and snippets.

@booo
Created December 4, 2014 11:35
Show Gist options
  • Save booo/106780740fa824a0d73f to your computer and use it in GitHub Desktop.
Save booo/106780740fa824a0d73f to your computer and use it in GitHub Desktop.
#!/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