Skip to content

Instantly share code, notes, and snippets.

@nickadam
Created July 29, 2021 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickadam/771f4a0d7264e223d89df0c95d3d9aeb to your computer and use it in GitHub Desktop.
Save nickadam/771f4a0d7264e223d89df0c95d3d9aeb to your computer and use it in GitHub Desktop.
Create self-signed keypair with no prompts, 2048, 15 years
#!/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