8000 [Cache] TLS support on RedisTrait · Issue #40224 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Cache] TLS support on RedisTrait #40224

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

Closed
c-lambert opened this issue Feb 17, 2021 · 5 comments
Closed

[Cache] TLS support on RedisTrait #40224

c-lambert opened this issue Feb 17, 2021 · 5 comments

Comments

@c-lambert
Copy link

Hello,

rediss:// DSL scheme is for TLS connexion to Redis Server.
You support rediss keyword but not TLS connexion.

https://github.com/predis/predis

$client = new Predis\Client('tls://127.0.0.1');

https://github.com/phpredis/phpredis

$redis->connect('tls://127.0.0.1', 6379); // enable transport level security.

When i use rediss:// scheme, the Redis connection still use tcp scheme.

@stof
Copy link
Member
stof commented Feb 17, 2021

which RedisTrait are you talking about ? We have support for Redis in multiple components

@stof
Copy link
Member
stof commented Feb 17, 2021

OK, this is in symfony/cache, because the initial merged PR was incomplete (which I reported back then, but I looked at it only at the time of being merged): #30605

@nicolas-grekas
Copy link
Member

Might be fixed by #39599?

@c-lambert
Copy link
Author
c-lambert commented Feb 17, 2021

Might be fixed by #39599?

Thank you Nicolas. It seems to be treated by this PR but still not merged.

I try to create a custom "app.redis_provider" but don't find any documention. I want to use my extended RedisAdapter, which init my own \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface and use it on cache.yaml configuration

@c-lambert
Copy link
Author
c-lambert commented Feb 17, 2021

I did this

<?php


namespace App\Cache;


use Predis\Client;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

class RedisCacheAdapter extends RedisAdapter
{
    public function __construct(
        ParameterBagInterface $parameterBag
    ) {
        $redisScheme = $parameterBag->get('redis_scheme');
        $redisHost = $parameterBag->get('redis_host');
        $redisPort = $parameterBag->get('redis_port');
        $redisKey = $parameterBag->get('redis_key');
        $client = new Client(
            [
                'scheme' => $redisScheme,
                'host' => $redisHost,
                'port' => $redisPort,
                'password' => $redisKey
            ]
        );
        parent::__construct($client);
    }
}

and override cache.app in service.yaml

services:
    cache.app:
        class: App\Cache\RedisCacheAdapter
        arguments:
            - '' # i don't know why

@c-lambert c-lambert changed the title TLS support on RedisTrait [Cache] TLS support on RedisTrait Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0