github.com/openshift/source-to-image@v1.4.1-0.20240516041539-bf52fc02204e/test/integration/testdata/generate.sh (about)

     1  #!/bin/sh
     2  # Generate new 127.0.0.1.crt, 127.0.0.1.key, client.crt, client.key, ca.crt,
     3  # and ca.key.  The ca.key isn't kept in source control because we can just
     4  # make a new one and make a new version of everything that it signed.
     5  config=`mktemp`
     6  trap 'rm -f $config' EXIT
     7  openssl req -config $config -new -nodes -newkey rsa:2048 -keyout ca.key -x509 -out ca.crt -subj "/CN=Test CA" -days 730 -addext basicConstraints=CA:TRUE -addext subjectKeyIdentifier=hash
     8  openssl req -config $config -new -nodes -newkey rsa:2048 -keyout 127.0.0.1.key -x509 -out 127.0.0.1.crt -subj "/CN=127.0.0.1" -CA ca.crt -CAkey ca.key -days 730 -addext basicConstraints=CA:FALSE -addext subjectAltName=IP:127.0.0.1,IP:::1 -addext subjectKeyIdentifier=hash -addext authorityKeyIdentifier=keyid -addext extendedKeyUsage=serverAuth
     9  openssl req -config $config -new -nodes -newkey rsa:2048 -keyout client.key -x509 -out client.crt -subj "/CN=client" -CA ca.crt -CAkey ca.key -days 730 -addext basicConstraints=CA:FALSE -addext subjectKeyIdentifier=hash -addext authorityKeyIdentifier=keyid -addext extendedKeyUsage=clientAuth