Skip to content

[BUG] Sentinel returning master ip instead of hostname which is failing in case of TLS #7928

@sivanagireddyb

Description

@sivanagireddyb

Return master Hostname instead of ip

When we request a master address to sentinel it's returning IP instead of HOSTNAME so the backend node js client is trying to connect with IP and server returning error saying IP doesn't match the certificate

My config is below with 3 Redis processes(1master 2 slaves) on different ports on the same server. And 3 sentinels as same
Note: I have proper SSL certs and host IP and DNS names mapped.

Redis.conf

port 0
tls-port 6379
tls-cluster yes
tls-protocols "TLSv1.2 TLSv1.3"
tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256
tls-cert-file /data/certs/cert.pem
tls-key-file /data/certs/key.pem
tls-ca-cert-file /data/certs/ca.pem
tls-replication yes
tls-auth-clients yes
replicaof testredis1.test.com

Sentinel.conf

port 0
tls-port 26379
tls-protocols "TLSv1.2"
tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256
tls-cert-file "/data/certs/cert.pem"
tls-key-file "/data/certs/key.pem"
tls-ca-cert-file "/data/certs/ca.pem"
tls-auth-clients yes
tls-replication yes

sentinel monitor RedisMaster 127.0.0.1 6379 2
sentinel down-after-milliseconds RedisMaster 5000

ERROR:
error: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: IP: 127.0.0.1 is not in the cert's list: +5ms
[ioredis] Unhandled error event: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: IP: 127.0.0.1 is not in the cert's list:
at Object.checkServerIdentity (tls.js:250:17)
at TLSSocket.onConnectSecure (_tls_wrap.js:1098:27)
at TLSSocket.emit (events.js:198:13)

To reproduce

Basic Redis sentinel setup with TLS and connect using node js client
Expected behavior

Sentinel should return the hostname of the master so node js client can connect using the domain names

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions