Debian Codegraph @

contrib/tls/gen-test-certs.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # Generate test certificates:
4 #
5 # ca.{crt,key} Self signed CA certificate.
6 # redis.{crt,key} A certificate with no key usage/policy restrictions.
7
8 dir=`dirname $0`
9
10 # Generate CA
11 openssl genrsa -out ${dir}/ca.key 4096
12 openssl req \
13 -x509 -new -nodes -sha256 \
14 -key ${dir}/ca.key \
15 -days 3650 \
16 -subj '/O=redis_exporter/CN=Certificate Authority' \
17 -out ${dir}/ca.crt
18
19 # Generate cert
20 openssl genrsa -out ${dir}/redis.key 2048
21 openssl req \
22 -new -sha256 \
23 -subj "/O=redis_exporter/CN=localhost" \
24 -key ${dir}/redis.key | \
25 openssl x509 \
26 -req -sha256 \
27 -CA ${dir}/ca.crt \
28 -CAkey ${dir}/ca.key \
29 -CAserial ${dir}/ca.txt \
30 -CAcreateserial \
31 -days 3650 \
32 -out ${dir}/redis.crt