-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Support redis user password auth and tls encryption #27888
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
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
494b9dc to
99ed44c
Compare
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.
|
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 ? |
I'm lacking the knowledge and time for that, wanna focus on it? |
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.
|
Done, I upgraded and refactored everything for cleaner code. |
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
PVince81
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 code looks fine, I didn't retest though.
cool that you were able to also add the bits for RedisCluster
|
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 cluster redis-node-0:
image: docker.io/bitnami/redis-cluster
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-1:
image: docker.io/bitnami/redis-cluster
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-2:
image: docker.io/bitnami/redis-cluster
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-3:
image: docker.io/bitnami/redis-cluster
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-4:
image: docker.io/bitnami/redis-cluster
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-5:
image: docker.io/bitnami/redis-cluster
depends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
volumes:
- ./certs:/certs
environment:
# - 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=5
networks:
- nextcloudDocker-compose password protected cluster redis-node-0:
image: docker.io/bitnami/redis-cluster
environment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-1:
image: docker.io/bitnami/redis-cluster
environment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-2:
image: docker.io/bitnami/redis-cluster
environment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-3:
image: docker.io/bitnami/redis-cluster
environment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-4:
image: docker.io/bitnami/redis-cluster
environment:
- REDIS_PASSWORD=password
- REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
networks:
- nextcloud
redis-node-5:
image: docker.io/bitnami/redis-cluster
depends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
volumes:
- ./certs:/certs
environment:
# - 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=5
networks:
- nextcloud |
|
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 config redis-node-0:
image: docker.io/bitnami/redis-cluster
volumes:
- ./certs:/certs
environment:
- 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-5
networks:
- nextcloud
redis-node-1:
image: docker.io/bitnami/redis-cluster
volumes:
- ./certs:/certs
environment:
- 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-5
networks:
- nextcloud
redis-node-2:
image: docker.io/bitnami/redis-cluster
volumes:
- ./certs:/certs
environment:
- 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-5
networks:
- nextcloud
redis-node-3:
image: docker.io/bitnami/redis-cluster
volumes:
- ./certs:/certs
environment:
- 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-5
networks:
- nextcloud
redis-node-4:
image: docker.io/bitnami/redis-cluster
volumes:
- ./certs:/certs
environment:
- 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-5
networks:
- nextcloud
redis-node-5:
image: docker.io/bitnami/redis-cluster
depends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
volumes:
- ./certs:/certs
environment:
- 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=5
networks:
- nextcloud |
|
Just for info, all my local cluster tests were successful. 🚀 🎉 |
|
Hm failures seem related: |
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
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.
|
/backport to stable22 |
|
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 ?