Created
October 12, 2018 17:43
-
-
Save edwinclement08/f793cbe7ff7101a02222c529197cc839 to your computer and use it in GitHub Desktop.
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 | |
openssl genrsa -des3 -out rootCA.key 2048 | |
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem | |
echo "Trust the Certificate; Ctrl-C when Done" | |
while true; do printf ""; sleep 1; done | |
sudo cp rootCA.pem /etc/ca-certificates/trust-source/anchors/rootCA_local.cert | |
sudo trust extract-compat | |
cat > server.csr.cnf << EOF | |
[req] | |
default_bits = 2048 | |
prompt = no | |
default_md = sha256 | |
distinguished_name = dn | |
[dn] | |
C=IN | |
ST=Maharashtra | |
L=Mumbai | |
O=Studies | |
OU=Testbench | |
[email protected] | |
CN = localhost | |
EOF | |
cat > v3.ext << EOF | |
authorityKeyIdentifier=keyid,issuer | |
basicConstraints=CA:FALSE | |
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment | |
subjectAltName = @alt_names | |
[alt_names] | |
DNS.1 = localhost | |
EOF | |
openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config <( cat server.csr.cnf ) | |
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256 -extfile v3.ext |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment