linagora / james-project

Mirror of Apache James Project
Apache License 2.0
72 stars 62 forks source link

Support redis-sentinel with auth password #5284

Closed vttranlina closed 1 month ago

vttranlina commented 1 month ago

Why?

Currently, when using Redis Sentinel, we only support password authentication for master-replica nodes. This is done by specifying the master password in the Redis URL, such as: eg: redisURL=redis-sentinel://masterSecret1@redis-sentinel-1:26379,redis-sentinel-2:26379,redis-sentinel-3:26379?sentinelMasterId=mymaster

In this example, masterSecret1 is the password for the master node, not the Sentinel nodes.

In case we want to more security, Redis itself supports password authentication for Sentinel nodes as described here: https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/#sentinel-and-redis-authentication

But the Lettuce Redis library does not support configuring the Sentinel password via the Redis URL. This issue is tracked here: https://github.com/redis/lettuce/issues/1232

To enable password authentication for Sentinel nodes, we need to adapt the James codebase to support this functionality.

How?

RedisURI redisURI = RedisURI.create("redis-sentinel://password@localhost:26379/0#mymaster");
redisURI.getSentinels().forEach(it -> it.setPassword("my-sentinel-password"));
chibenwa commented 1 month ago

Can we please suggest configuration changes for such a proposal?

vttranlina commented 1 month ago

Can we please suggest configuration changes for such a proposal?

vttranlina commented 1 month ago

pr: https://github.com/apache/james-project/pull/2420