Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect Sentinel via TLS doesn't update servername for Redis had picked #1832

Open
anhhai2810 opened this issue Oct 26, 2023 · 0 comments
Open

Comments

@anhhai2810
Copy link

anhhai2810 commented Oct 26, 2023

const config_sentinel = {
    sentinels: sentinels,
    sentinelPassword: '123456',
    sentinelTLS: {
        ca: 'cert',
        rejectUnauthorized: false,
        servername: 'sentinel-pro.svc.local'
    },
    password: '123456',
    name: 'mymaster',
    role: 'master',
    enableTLSForSentinelMode: true,
    tls:  {
        ca: 'cert',
        rejectUnauthorized: false,
        servername: 'redis-master-pro.svc.local'
    },
}

We have 1 Master and 2 slaves
When Sentinel pick a node Redis to create a connection with TLS. At that time we can not use "config_sentinel.tls.servername" because server info may different to our config.
So, i try modify at "node_modules\ioredis\built\connectors\SentinelConnector\index.js":

if (this.options.enableTLSForSentinelMode && this.options.tls) {
                    debug("Update TLS servername >>>", resolved.host);
                    **this.options.tls.servername = resolved.host;**
                    Object.assign(resolved, this.options.tls);
                    this.stream = (0, tls_1.connect)(resolved);
                    this.stream.once("secureConnect", this.initFailoverDetector.bind(this));

I hope this issue can be fixed from next Pull Request!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant