-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Description
Expected behavior
When creating a connection using any constructor that does not take a hostname verifier, a default one should be used which actually verifies the hostname, to help avoid man in the middle attacks.
Actual behavior
Currently, no hostname verification is done, leading to the impression that actually everything is fine, when in reality there is a security weakness.
Steps to reproduce:
set up a redis node with TLS (normal as opposed to mutual TLS is sufficient), as shown below, and deploy it to the domain and then connect to it:
JedisPooled jedis = new JedisPooled(new GenericObjectPoolConfig<>(), "something.else.at.same.ip", exposedPort, 10_000, 10_000, user, pass,
0, clientName, true);
System.out.println(jedis.keys("*");
The above code throws no errors. Using a hostname verifier like the one from okhttp3 however ensures that the domain name in the certificate actually matches the domain name that is requested.
Redis / Jedis Configuration
docker run -it --rm \
--name redis \
--network mynetwork \
-v "/etc/letsencrypt/live/somedomain.ch/privkey.pem:/certs/server.key:ro" \
-v "/etc/letsencrypt/live/somedomain.ch/fullchain.pem:/certs/server.crt:ro" \
-v "/z/data:/data:rw" \
--memory 300m --memory-swap 400m --cpus="2.0" \
-e REDIS_ARGS="--loglevel notice --maxclients 200 --maxmemory 200m --maxmemory-policy noeviction --appendonly yes --appendfsync always --tls-port 6380 --tls-auth-clients no --tls-cert-file /certs/server.crt --tls-key-file /certs/server.key --requirepass asdfasdfasdfasdf" \
redis/redis-stack:7.0.6-RC3
Jedis version:
4.3.1
Redis version:
7.0.6-RC3
Java version:
graalvm 17
Metadata
Metadata
Assignees
Labels
No labels