Skip to content

Instantly share code, notes, and snippets.

@segrax
Last active September 8, 2016 07:28
Show Gist options
  • Save segrax/b86afbcf5ec7d1d658c1695d0d3f5967 to your computer and use it in GitHub Desktop.
Save segrax/b86afbcf5ec7d1d658c1695d0d3f5967 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
DIR="./etc/"
DOMAIN="localhost"
PASSPHRASE=""
SUBJ="
C=DE
ST=
O=
localityName=
commonName=$DOMAIN
organizationalUnitName=
emailAddress=
"
mkdir -p "$DIR"
openssl genrsa -out "$DIR/server.key" 2048
openssl req -new -subj "$(echo -n "$SUBJ" | tr "\n" "/")" -key "$DIR/server.key" -out "$DIR/server.csr" -passin pass:$PASSPHRASE
openssl x509 -req -days 365 -in "$DIR/server.csr" -signkey "$DIR/server.key" -out "$DIR/server.crt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment