Uh oh!
There was an error while loading. Please reload this page.
Support redis user password auth and tls encryption - #27888
Conversation
|
This comment has been minimized.
This comment has been minimized.
494b9dc to
99ed44cCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
PVince81
commented
Jul 20, 2021
I've tested this PR and it worked for me locally with the instructions. @skjnldsv I think we talked about the possibility of adding/updating unit tests for the RedisFactory, is this still to do ? |
skjnldsv
commented
Jul 20, 2021
I'm lacking the knowledge and time for that, wanna focus on it? |
PVince81
commented
Jul 20, 2021
I had a look and it would require some extra gymnastics (refactoring, injection) to be able to mock |
This comment has been minimized.
This comment has been minimized.
skjnldsv
commented
Jul 20, 2021
Done, I upgraded and refactored everything for cleaner code. |
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
PVince81
left a comment
There was a problem hiding this comment.
👍 code looks fine, I didn't retest though.
cool that you were able to also add the bits for RedisCluster
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
skjnldsv
commented
Jul 21, 2021
Okay, I went down the rabbit hole Tests setups NO TLS 'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.local' =>'\OC\Memcache\Redis' ,'redis.cluster' => array(
'seeds' => [
'redis-node-0:6379',
'redis-node-1:6379',
'redis-node-2:6379',
'redis-node-3:6379',
'redis-node-4:6379',
'redis-node-5:6379',
],
'failover_mode' => \RedisCluster::FAILOVER_ERROR,
'password' => 'password'# optional if you're using the protected config
),Docker-compose unprotected clusterredis-node-0:
image: docker.io/bitnami/redis-clusterenvironment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-1:
image: docker.io/bitnami/redis-clusterenvironment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-2:
image: docker.io/bitnami/redis-clusterenvironment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-3:
image: docker.io/bitnami/redis-clusterenvironment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-4:
image: docker.io/bitnami/redis-clusterenvironment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-5:
image: docker.io/bitnami/redis-clusterdepends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4volumes:
- ./certs:/certsenvironment:
# - REDIS_TLS_ENABLED=yes# - REDIS_PORT_NUMBER=0# - REDIS_TLS_PORT=6379# - REDIS_TLS_CERT_FILE=/certs/redis.crt# - REDIS_TLS_KEY_FILE=/certs/redis.key# - REDIS_TLS_CA_FILE=/certs/ca.crt
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_CLUSTER_REPLICAS=1
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
- REDIS_CLUSTER_CREATOR=yes
- REDIS_CLUSTER_SLEEP_BEFORE_DNS_LOOKUP=5networks:
- nextcloudDocker-compose password protected clusterredis-node-0:
image: docker.io/bitnami/redis-clusterenvironment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-1:
image: docker.io/bitnami/redis-clusterenvironment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-2:
image: docker.io/bitnami/redis-clusterenvironment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-3:
image: docker.io/bitnami/redis-clusterenvironment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-4:
image: docker.io/bitnami/redis-clusterenvironment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-5:
image: docker.io/bitnami/redis-clusterdepends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4volumes:
- ./certs:/certsenvironment:
# - REDIS_TLS_ENABLED=yes# - REDIS_PORT_NUMBER=0# - REDIS_TLS_PORT=6379# - REDIS_TLS_CERT_FILE=/certs/redis.crt# - REDIS_TLS_KEY_FILE=/certs/redis.key# - REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDISCLI_AUTH=password
- REDIS_CLUSTER_REPLICAS=1
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
- REDIS_CLUSTER_CREATOR=yes
- REDIS_CLUSTER_SLEEP_BEFORE_DNS_LOOKUP=5networks:
- nextcloud |
skjnldsv
commented
Jul 21, 2021
Finally but not last: TLS CLUSTER PASSWORD PROTECTED 'memcache.locking' => '\OC\Memcache\Redis',
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.local' =>'\OC\Memcache\Redis' ,'redis.cluster' => array(
'seeds' => [
'redis-node-0:6379',
'redis-node-1:6379',
'redis-node-2:6379',
'redis-node-3:6379',
'redis-node-4:6379',
'redis-node-5:6379',
],
'failover_mode' => \RedisCluster::FAILOVER_ERROR,
'password' => 'password',
'ssl_context' => [
'local_cert' => '/certs/redis.crt',
'local_pk' => '/certs/redis.key',
'cafile' => '/certs/ca.crt',
'verify_peer_name' => false
]
),Docker compose configredis-node-0:
image: docker.io/bitnami/redis-clustervolumes:
- ./certs:/certsenvironment:
- REDIS_PORT_NUMBER=0
- REDIS_TLS_ENABLED=yes
- REDIS_TLS_AUTH_CLIENTS=yes
- REDIS_TLS_PORT=6379
- REDIS_TLS_CERT_FILE=/certs/redis.crt
- REDIS_TLS_KEY_FILE=/certs/redis.key
- REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-1:
image: docker.io/bitnami/redis-clustervolumes:
- ./certs:/certsenvironment:
- REDIS_PORT_NUMBER=0
- REDIS_TLS_ENABLED=yes
- REDIS_TLS_AUTH_CLIENTS=yes
- REDIS_TLS_PORT=6379
- REDIS_TLS_CERT_FILE=/certs/redis.crt
- REDIS_TLS_KEY_FILE=/certs/redis.key
- REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-2:
image: docker.io/bitnami/redis-clustervolumes:
- ./certs:/certsenvironment:
- REDIS_PORT_NUMBER=0
- REDIS_TLS_ENABLED=yes
- REDIS_TLS_AUTH_CLIENTS=yes
- REDIS_TLS_PORT=6379
- REDIS_TLS_CERT_FILE=/certs/redis.crt
- REDIS_TLS_KEY_FILE=/certs/redis.key
- REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-3:
image: docker.io/bitnami/redis-clustervolumes:
- ./certs:/certsenvironment:
- REDIS_PORT_NUMBER=0
- REDIS_TLS_ENABLED=yes
- REDIS_TLS_AUTH_CLIENTS=yes
- REDIS_TLS_PORT=6379
- REDIS_TLS_CERT_FILE=/certs/redis.crt
- REDIS_TLS_KEY_FILE=/certs/redis.key
- REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-4:
image: docker.io/bitnami/redis-clustervolumes:
- ./certs:/certsenvironment:
- REDIS_PORT_NUMBER=0
- REDIS_TLS_ENABLED=yes
- REDIS_TLS_AUTH_CLIENTS=yes
- REDIS_TLS_PORT=6379
- REDIS_TLS_CERT_FILE=/certs/redis.crt
- REDIS_TLS_KEY_FILE=/certs/redis.key
- REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5networks:
- nextcloudredis-node-5:
image: docker.io/bitnami/redis-clusterdepends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4volumes:
- ./certs:/certsenvironment:
- REDIS_PORT_NUMBER=0
- REDIS_TLS_ENABLED=yes
- REDIS_TLS_AUTH_CLIENTS=yes
- REDIS_TLS_PORT=6379
- REDIS_TLS_CERT_FILE=/certs/redis.crt
- REDIS_TLS_KEY_FILE=/certs/redis.key
- REDIS_TLS_CA_FILE=/certs/ca.crt
- REDIS_PASSWORD=password
- REDISCLI_AUTH=password
- REDIS_CLUSTER_REPLICAS=1
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
- REDIS_CLUSTER_CREATOR=yes
- REDIS_CLUSTER_SLEEP_BEFORE_DNS_LOOKUP=5networks:
- nextcloud |
skjnldsv
commented
Jul 21, 2021
Just for info, all my local cluster tests were successful. 🚀 🎉 |
juliusknorr
commented
Jul 21, 2021
Hm failures seem related: |
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
skjnldsv
commented
Jul 22, 2021
/backport to stable22 |
PVince81
commented
Jul 23, 2021
this introduced a little regression for those like me who relied on default values, PR here to fix it: #28129 |
(From https://redis.io/topics/encryption)
./utils/gen-test-certs.shuser nextcloud on +@all ~* >passwordQuestions
phpredis > 5.x.xfor Nextcloud 23 ?