Created
February 6, 2023 21:03
-
-
Save VirtuBox/1b3c11062f70ead9e54ac39b1d8f995e to your computer and use it in GitHub Desktop.
Generate Self-signed certificate
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
#!/usr/bin/env bash | |
# ------------------------------------------------------------------------- | |
# Generate Self-signed certificate | |
# ------------------------------------------------------------------------- | |
# Usage : | |
# | |
# bash selfsigned.sh <domain> | |
# | |
# ------------------------------------------------------------------------- | |
if [ "$1" ]; then | |
openssl genrsa -out "$1".key 2048 | |
openssl req -new -batch -subj /commonName="$1"/ -key "$1".key -out "$1".csr | |
mv "$1".key "$1".key.org | |
openssl rsa -in "$1".key.org -out "$1".key | |
rm "$1".key.org | |
openssl x509 -req -days 3652 -in "$1".csr -signkey "$1".key -out "$1".crt | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment