-
-
Save jerza90/a7009d3341e369b2b0c553fc0eae02c6 to your computer and use it in GitHub Desktop.
laragon refresh certificates
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/sh | |
CRTPATH=$(pwd -W) | |
for i in *.key ; do | |
DOMAIN=${i%.key} | |
cat << EOF > openssl_$DOMAIN.conf | |
[req] | |
distinguished_name = req_distinguished_name | |
req_extensions = v3_req | |
prompt = no | |
[req_distinguished_name] | |
C = US | |
ST = VA | |
L = SomeCity | |
O = MyCompany | |
OU = MyDivision | |
CN = $DOMAIN | |
[v3_req] | |
keyUsage = keyEncipherment, dataEncipherment | |
extendedKeyUsage = serverAuth | |
subjectAltName = @alt_names | |
[alt_names] | |
DNS.1 = www.$DOMAIN | |
DNS.2 = $DOMAIN | |
EOF | |
openssl req -new -nodes -keyout $DOMAIN.key -out $DOMAIN.csr -config openssl_$DOMAIN.conf -batch | |
openssl x509 -req -extfile openssl_$DOMAIN.conf -days 365 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt -extensions v3_req | |
openssl x509 -text -noout -in $DOMAIN.crt | |
certutil -delstore "Root" "$DOMAIN" | |
certutil -f -addstore "Root" "$CRTPATH/$DOMAIN.crt" | |
done | |
rm -f *.csr *.conf *.confe *.acc.crt *.acc.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment