Revert support for redis-sentinel authentication.

Authentication for sentinels was implemented in v1.1.5 (commit 2e76410)
but ended up being bugged (see ISSUE #658). This is now postponed as it
requires a more thorough investigation.
This commit is contained in:
Daniele Alessandri
2020-09-11 21:10:40 +02:00
parent 9e5371f5ce
commit 16957f3b39
2 changed files with 14 additions and 21 deletions
@@ -239,12 +239,15 @@ class SentinelReplication implements ReplicationInterface
}
if (is_array($parameters)) {
// Password authentication is fine now that Redis Sentinel supports
// password-protected sentinel instances, but we must explicitly set
// "database" and "username" to NULL so that no augmented AUTH (ACL)
// and SELECT command are sent by accident to the sentinels.
// NOTE: sentinels do not accept AUTH and SELECT commands so we must
// explicitly set them to NULL to avoid problems when using default
// parameters set via client options. Actually AUTH is supported for
// sentinels starting with Redis 5 but we have to differentiate from
// sentinels passwords and nodes passwords, this will be implemented
// in a later release.
$parameters['database'] = null;
$parameters['username'] = null;
$parameters['password'] = null;
if (!isset($parameters['timeout'])) {
$parameters['timeout'] = $this->sentinelTimeout;
@@ -36,29 +36,19 @@ class SentinelReplicationTest extends PredisTestCase
/**
* @group disconnected
*/
public function testParametersForSentinelConnectionShouldUsePasswordForAuthentication()
public function testParametersForSentinelConnectionShouldNotUseDatabaseAndUsernameAndPassword()
{
$replication = $this->getReplicationConnection('svc', array(
'tcp://127.0.0.1:5381?alias=sentinel1&password=secret',
'tcp://127.0.0.1:5381?alias=sentinel1&database=1&username=myusername&password=secret',
));
$parameters = $replication->getSentinelConnection()->getParameters()->toArray();
$this->assertArraySubset(array('password' => 'secret'), $parameters);
}
/**
* @group disconnected
*/
public function testParametersForSentinelConnectionShouldNotUseDatabaseAndUsername()
{
$replication = $this->getReplicationConnection('svc', array(
'tcp://127.0.0.1:5381?alias=sentinel1&database=1&username=myusername',
));
$parameters = $replication->getSentinelConnection()->getParameters()->toArray();
$this->assertArraySubset(array('database' => null, 'username' => null), $parameters);
$this->assertArraySubset(array(
'database' => null,
'username' => null,
'password' => null
), $parameters);
}
/**