Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active March 5, 2021 21:48
Show Gist options
  • Save percybolmer/9a6b1adb3ea54783ee73d2441e42d870 to your computer and use it in GitHub Desktop.
Save percybolmer/9a6b1adb3ea54783ee73d2441e42d870 to your computer and use it in GitHub Desktop.
Certificate generation script
#!/bin/bash
# generate ca.key
openssl genrsa -out ca.key 4096
# generate certificate
openssl req -new -x509 -key ca.key -sha256 -subj "/C=SE/ST=HL/O=Example, INC." -days 365 -out ca.cert
# generate the server key
openssl genrsa -out server.key 4096
# Generate the csr
openssl req -new -key server.key -out server.csr -config certificate.conf
#
openssl x509 -req -in server.csr -CA ca.cert -CAkey ca.key -CAcreateserial -out server.crt -days 365 -sha256 -extfile certificate.conf -extensions req_ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment