Skip to content

Instantly share code, notes, and snippets.

@y0n1
Created January 16, 2020 14:30
Show Gist options
  • Save y0n1/9b026222615d070c5fc9e7864eed2ab8 to your computer and use it in GitHub Desktop.
Save y0n1/9b026222615d070c5fc9e7864eed2ab8 to your computer and use it in GitHub Desktop.
#! /bin/bash
SELF_SIGNED_CERTS_DIR="$PWD/.ssl"
[[ ! -d $SELF_SIGNED_CERTS_DIR ]] && mkdir $SELF_SIGNED_CERTS_DIR
rm -rf $SELF_SIGNED_CERTS_DIR/*
openssl req -newkey rsa:2048 -new -nodes \
-keyout $SELF_SIGNED_CERTS_DIR/private-key.pem \
-out $SELF_SIGNED_CERTS_DIR/csr.pem
openssl x509 -req -days 365 \
-in $SELF_SIGNED_CERTS_DIR/csr.pem \
-signkey $SELF_SIGNED_CERTS_DIR/private-key.pem \
-out $SELF_SIGNED_CERTS_DIR/public-certificate.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment