Created
July 29, 2021 17:35
-
-
Save nickadam/771f4a0d7264e223d89df0c95d3d9aeb to your computer and use it in GitHub Desktop.
Create self-signed keypair with no prompts, 2048, 15 years
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
#!/bin/bash | |
name=$1 | |
if [ -z $name ] | |
then | |
name="self-signed" | |
fi | |
openssl req -x509 -days 5479 -nodes -newkey rsa:2048 -keyout $name.key -out $name.pem -config <( cat << EOF | |
[ req ] | |
default_bits = 2048 | |
prompt = no | |
distinguished_name = req_distinguished_name | |
string_mask = utf8only | |
default_md = sha256 | |
[ req_distinguished_name ] | |
C=US | |
ST=ST | |
L=L | |
O=O | |
OU=OU | |
CN=CN | |
EOF | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment