github.com/go-graphite/carbonapi@v0.17.0/cmd/carbonapi/config_tests/regen.sh (about) 1 #!/usr/bin/env bash 2 3 echo "THIS IS INSECURE AND IS ONLY USED FOR Integration test purposes" 4 echo "Never use it in production, please read how to do it properly!!!" 5 6 set -e 7 #ALGORITHM="Ed25519" 8 ALGORITHM="rsa" 9 10 # Create CA 11 openssl genpkey -algorithm ${ALGORITHM} -out mTLS-server.key 12 openssl req -new -x509 -sha256 -key mTLS-server.key -out mTLS-server.crt -days 3650 -subj '/CN=localhost' -addext "subjectAltName = DNS:localhost" 13 14 echo "mTLS Test Server certificate has been created:" 15 openssl x509 -noout -text -in mTLS-server.crt 16 17 # Client cert 18 openssl genpkey -algorithm ${ALGORITHM} -out mTLS-client.key 19 openssl req -new -key mTLS-client.key -out mTLS-client.csr -subj '/CN=test-uuid' 20 21 # Sign our client certificate with our CA 22 echo "00" > file.srl 23 openssl x509 -days 3650 -req -in mTLS-client.csr -CA mTLS-server.crt -CAkey mTLS-server.key -CAserial file.srl -out mTLS-client.crt 24 25 echo "mTLS Test Client certificate has been created:" 26 openssl x509 -noout -text -in mTLS-client.crt 27