File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # based on https://github.com/redis/redis/blob/unstable/utils/gen-test-certs.sh
4+ # Generate some test certificates which are used by the regression test suite:
5+ #
6+ # ca.{crt,key} Self signed CA certificate.
7+ # redis.{crt,key} A certificate with no key usage/policy restrictions.
8+
9+ generate_cert () {
10+ local name=$1
11+ local cn=" $2 "
12+ local opts=" $3 "
13+
14+ local keyfile=${name} .key
15+ local certfile=${name} .crt
16+
17+ [ -f $keyfile ] || openssl genrsa -out $keyfile 2048
18+ openssl req \
19+ -new -sha256 \
20+ -subj " /O=Redis Test/CN=$cn " \
21+ -key $keyfile | \
22+ openssl x509 \
23+ -req -sha256 \
24+ -CA ca.crt \
25+ -CAkey ca.key \
26+ -CAserial ca.txt \
27+ -CAcreateserial \
28+ -days 365 \
29+ $opts \
30+ -out $certfile
31+ }
32+
33+ [ -f ca.key ] || openssl genrsa -out ca.key 4096
34+ openssl req \
35+ -x509 -new -nodes -sha256 \
36+ -key ca.key \
37+ -days 3650 \
38+ -subj ' /O=Redis Test/CN=Certificate Authority' \
39+ -out ca.crt
40+
41+ generate_cert redis " Generic-cert"
42+
43+ openssl pkcs12 -export -in redis.crt -inkey redis.key -out redis.p12 -passout pass:
You can’t perform that action at this time.
0 commit comments