Rename TLS test cert files to valkey (#186)

This PR covers changing the redis.crt and redis.key to valkey certs for
TLS testing.

The files are generated by the gen-test-certs.sh script under tests/tls/.

Also covers comments provided.

Signed-off-by: hwware <wen.hui.ware@gmail.com>
Co-authored-by: hwware <wen.hui.ware@gmail.com>
This commit is contained in:
Shivshankar 2024-04-03 17:04:52 -04:00 committed by GitHub
parent 125a2987af
commit f3ccfbb01f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 21 deletions

20
TLS.md
View File

@ -33,25 +33,25 @@ To run Redis test suite with TLS, you'll need TLS support for TCL (i.e.
### Running manually ### Running manually
To manually run a Redis server with TLS mode (assuming `gen-test-certs.sh` was To manually run a Valkey server with TLS mode (assuming `gen-test-certs.sh` was
invoked so sample certificates/keys are available): invoked so sample certificates/keys are available):
For TLS built-in mode: For TLS built-in mode:
./src/redis-server --tls-port 6379 --port 0 \ ./src/valkey-server --tls-port 6379 --port 0 \
--tls-cert-file ./tests/tls/redis.crt \ --tls-cert-file ./tests/tls/valkey.crt \
--tls-key-file ./tests/tls/redis.key \ --tls-key-file ./tests/tls/valkey.key \
--tls-ca-cert-file ./tests/tls/ca.crt --tls-ca-cert-file ./tests/tls/ca.crt
For TLS module mode: For TLS module mode:
./src/redis-server --tls-port 6379 --port 0 \ ./src/valkey-server --tls-port 6379 --port 0 \
--tls-cert-file ./tests/tls/redis.crt \ --tls-cert-file ./tests/tls/valkey.crt \
--tls-key-file ./tests/tls/redis.key \ --tls-key-file ./tests/tls/valkey.key \
--tls-ca-cert-file ./tests/tls/ca.crt \ --tls-ca-cert-file ./tests/tls/ca.crt \
--loadmodule src/redis-tls.so --loadmodule src/valkey-tls.so
To connect to this Redis server with `redis-cli`: To connect to this Redis server with `valkey-cli`:
./src/redis-cli --tls \ ./src/valkey-cli --tls \
--cert ./tests/tls/redis.crt \ --cert ./tests/tls/redis.crt \
--key ./tests/tls/redis.key \ --key ./tests/tls/redis.key \
--cacert ./tests/tls/ca.crt --cacert ./tests/tls/ca.crt

View File

@ -23,8 +23,8 @@ SOCK_FILE=${tmpdir}/hiredis-test-redis.sock
if [ "$TEST_SSL" = "1" ]; then if [ "$TEST_SSL" = "1" ]; then
SSL_CA_CERT=${tmpdir}/ca.crt SSL_CA_CERT=${tmpdir}/ca.crt
SSL_CA_KEY=${tmpdir}/ca.key SSL_CA_KEY=${tmpdir}/ca.key
SSL_CERT=${tmpdir}/redis.crt SSL_CERT=${tmpdir}/valkey.crt
SSL_KEY=${tmpdir}/redis.key SSL_KEY=${tmpdir}/valkey.key
openssl genrsa -out ${tmpdir}/ca.key 4096 openssl genrsa -out ${tmpdir}/ca.key 4096
openssl req \ openssl req \

View File

@ -100,7 +100,7 @@ proc spawn_instance {type base_port count {conf {}} {base_conf_file ""}} {
puts $cfg [format "tls-key-file %s/../../tls/server.key" [pwd]] puts $cfg [format "tls-key-file %s/../../tls/server.key" [pwd]]
puts $cfg [format "tls-client-cert-file %s/../../tls/client.crt" [pwd]] puts $cfg [format "tls-client-cert-file %s/../../tls/client.crt" [pwd]]
puts $cfg [format "tls-client-key-file %s/../../tls/client.key" [pwd]] puts $cfg [format "tls-client-key-file %s/../../tls/client.key" [pwd]]
puts $cfg [format "tls-dh-params-file %s/../../tls/redis.dh" [pwd]] puts $cfg [format "tls-dh-params-file %s/../../tls/valkey.dh" [pwd]]
puts $cfg [format "tls-ca-cert-file %s/../../tls/ca.crt" [pwd]] puts $cfg [format "tls-ca-cert-file %s/../../tls/ca.crt" [pwd]]
} else { } else {
puts $cfg "port $port" puts $cfg "port $port"

View File

@ -486,7 +486,7 @@ proc start_server {options {code undefined}} {
dict set config "tls-key-file" [format "%s/tests/tls/server.key" [pwd]] dict set config "tls-key-file" [format "%s/tests/tls/server.key" [pwd]]
dict set config "tls-client-cert-file" [format "%s/tests/tls/client.crt" [pwd]] dict set config "tls-client-cert-file" [format "%s/tests/tls/client.crt" [pwd]]
dict set config "tls-client-key-file" [format "%s/tests/tls/client.key" [pwd]] dict set config "tls-client-key-file" [format "%s/tests/tls/client.key" [pwd]]
dict set config "tls-dh-params-file" [format "%s/tests/tls/redis.dh" [pwd]] dict set config "tls-dh-params-file" [format "%s/tests/tls/valkey.dh" [pwd]]
dict set config "tls-ca-cert-file" [format "%s/tests/tls/ca.crt" [pwd]] dict set config "tls-ca-cert-file" [format "%s/tests/tls/ca.crt" [pwd]]
dict set config "loglevel" "debug" dict set config "loglevel" "debug"
} }

View File

@ -100,10 +100,10 @@ start_server {tags {"tls"}} {
set master_port [srv 0 port] set master_port [srv 0 port]
# Use a non-restricted client/server cert for the replica # Use a non-restricted client/server cert for the replica
set redis_crt [format "%s/tests/tls/redis.crt" [pwd]] set valkey_crt [format "%s/tests/tls/valkey.crt" [pwd]]
set redis_key [format "%s/tests/tls/redis.key" [pwd]] set valkey_key [format "%s/tests/tls/valkey.key" [pwd]]
start_server [list overrides [list tls-cert-file $redis_crt tls-key-file $redis_key] \ start_server [list overrides [list tls-cert-file $valkey_crt tls-key-file $valkey_key] \
omit [list tls-client-cert-file tls-client-key-file]] { omit [list tls-client-cert-file tls-client-key-file]] {
set replica [srv 0 client] set replica [srv 0 client]
$replica replicaof $master_host $master_port $replica replicaof $master_host $master_port

View File

@ -3,10 +3,10 @@
# Generate some test certificates which are used by the regression test suite: # Generate some test certificates which are used by the regression test suite:
# #
# tests/tls/ca.{crt,key} Self signed CA certificate. # tests/tls/ca.{crt,key} Self signed CA certificate.
# tests/tls/redis.{crt,key} A certificate with no key usage/policy restrictions. # tests/tls/valkey.{crt,key} A certificate with no key usage/policy restrictions.
# tests/tls/client.{crt,key} A certificate restricted for SSL client usage. # tests/tls/client.{crt,key} A certificate restricted for SSL client usage.
# tests/tls/server.{crt,key} A certificate restricted for SSL server usage. # tests/tls/server.{crt,key} A certificate restricted for SSL server usage.
# tests/tls/redis.dh DH Params file. # tests/tls/valkey.dh DH Params file.
generate_cert() { generate_cert() {
local name=$1 local name=$1
@ -53,6 +53,6 @@ _END_
generate_cert server "Server-only" "-extfile tests/tls/openssl.cnf -extensions server_cert" generate_cert server "Server-only" "-extfile tests/tls/openssl.cnf -extensions server_cert"
generate_cert client "Client-only" "-extfile tests/tls/openssl.cnf -extensions client_cert" generate_cert client "Client-only" "-extfile tests/tls/openssl.cnf -extensions client_cert"
generate_cert redis "Generic-cert" generate_cert valkey "Generic-cert"
[ -f tests/tls/redis.dh ] || openssl dhparam -out tests/tls/redis.dh 2048 [ -f tests/tls/valkey.dh ] || openssl dhparam -out tests/tls/valkey.dh 2048