Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

WedgeSama
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #58727
License MIT

Many time, same auth (like password) is set on both Redis master and Sentinel, but you may want to not use the same auth for both of them.

Currently, using DNS, you can only set one and only one auth for both.

This PR allow to set a different auth for sentinel while keeping backward compatibility for previous DSN config.

Problematical usage

REDIS_DSN=redis:masterPassword@?host[redis_sentinel:26379]&auth=sentinelPassword&redis_sentinel=mymaster

Add auth option will override the password masterPassword.

Fixed usage

REDIS_DSN=redis:masterPassword@?host[redis_sentinel:26379]&redis_sentinel_auth=sentinelPassword&redis_sentinel=mymaster

# With both `auth` and `redis_sentinel_auth`
REDIS_DSN=redis:masterPassword@?host[redis_sentinel:26379]&auth=anyThingHere&redis_sentinel_auth=sentinelPassword&redis_sentinel=mymaster

# Can still be just `auth` -> will work same as before (fix do nothing in this case)
REDIS_DSN=redis:masterPassword@?host[redis_sentinel:26379]&auth=masterPassword&redis_sentinel=mymaster

redis_sentinel_auth option will be prioritized over auth option. That way, after update, an existing DSN will still work as it was before.

…master & sentinel

Many time, same auth (like password) is set on both Redis master and Sentinel, but you may want to not use the same auth for both of them.
Currently, using DNS, you can only set one and only one auth for both.
This PR allow to set a different auth for sentinel while keeping backward compatibility for previous DSN config.
@WedgeSama WedgeSama force-pushed the fix/redis-adapter-with-sentinel-auth branch from 4b0c391 to dbdeb0b Compare September 18, 2025 09:31
@nicolas-grekas
Copy link
Member

As it is currently, the PR is a new feature of course.
I had a look at the current code, related to $auth and $params['auth'] and it looks like we have two ways to deal with auth, and that's a bit inconsistent.

Looking closer at sentinels, it looks like we should support having a different auth setting per-sentinel.
The DSN would then look like ?host[foo:123][auth]=abc123

This concern should also apply to clusters I guess.
We should also ensure the same DSN work with Predis.

About the $auth / $params['auth'] mismatch, we might fix it by adding $params['auth'] ??= $auth quite early in the method.

Up to digg these ideas?

@WedgeSama
Copy link
Contributor Author

Yes @nicolas-grekas , I can digg them 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.