title: Unable to connect to redis master with tls from go app using go-redis pkg
body: <p>For the past two weeks I am trying to set up (locally) redis and my go microservice to communicate using TLS. I use docker compose to up all of the needed containers - redis master, redis slave, redis sentinel and go application that uses go-redis package. All of the redis services are equipped with the needed certificates - root ca, service cs,  service private key. I also turned off mutual TLS (<code>mTLS</code>) as redis uses it by default (<code>--tls-auth-clients no</code>). I run docker-compose and all of the redis services discover each other and establish TLS connection without any problems. When I connect to the go application container and run redis-cli inside it (<code>redis-cli -h master -p 6379 --tls</code>) I successfully connect to the master using TLS and I am able to execute commands without any problems.
  The problem I face comes when I start the go application and try to connect to redis master (in this specific case the command is set key). All of the three redis services use the same TLS version: <code>--tls-protocols TLSv1.2</code> so I added it to the go app config. Here is the redis client I create:</p>
  <pre><code>redisClient = redis.NewFailoverClient(&amp;redis.FailoverOptions{
          SentinelAddrs: adrs,
          MasterName:    redisMaster,
          Password:      password,
          DB:            db,
          OnConnect: func(ctx context.Context, conn *redis.Conn) error {
              // logging ... 
              // redis: Successfully connected to Redis
              return nil
          },
          TLSConfig: &amp;tls.Config{
              //InsecureSkipVerify: true,
              MinVersion:         tls.VersionTLS12,
          },
  </code></pre>
  <p>When the application is started I receive the following logs (not sure why I receive several success messages):</p>
  <pre><code>{&quot;connection&quot;:&quot;Redis\u003csentinel:26379 db:0\u003e&quot;,&quot;level&quot;:&quot;info&quot;,&quot;msg&quot;:&quot;redis: Successfully connected to Redis&quot;}
  {&quot;connection&quot;:&quot;Redis\u003csentinel:26379 db:0\u003e&quot;,&quot;level&quot;:&quot;info&quot;,&quot;msg&quot;:&quot;redis: Successfully connected to Redis&quot;}
  redis: 2022/04/03 18:09:53 sentinel.go:643: sentinel: new master=&quot;mymaster&quot; addr=&quot;redis-master:6379&quot;
  {&quot;connection&quot;:&quot;Redis\u003cFailoverClient db:0\u003e&quot;,&quot;level&quot;:&quot;info&quot;,&quot;msg&quot;:&quot;redis: Successfully connected to Redis&quot;}
  {&quot;connection&quot;:&quot;Redis\u003cFailoverClient db:0\u003e&quot;,&quot;level&quot;:&quot;info&quot;,&quot;msg&quot;:&quot;redis: Successfully connected to Redis&quot;}
  {&quot;connection&quot;:&quot;Redis\u003cFailoverClient db:0\u003e&quot;,&quot;level&quot;:&quot;info&quot;,&quot;msg&quot;:&quot;redis: Successfully connected to Redis&quot;}
  {&quot;connection&quot;:&quot;Redis\u003cFailoverClient db:0\u003e&quot;,&quot;level&quot;:&quot;info&quot;,&quot;msg&quot;:&quot;redis: Successfully connected to Redis&quot;}
  {&quot;error&quot;:&quot;read tcp 1.2.3.4:50516-\u003e5.6.7.8:6379: read: connection reset by peer&quot;,&quot;level&quot;:&quot;error&quot;,&quot;master_name&quot;:&quot;mymaster&quot;,&quot;msg&quot;:&quot;redis: failed to connect to Redis&quot;}
  </code></pre>
  <p>Docker-compose logs for redis-master:</p>
  <pre><code>master_1        | 1:M 03 Apr 2022 18:09:53.419 # Error accepting a client connection: error:1408F10B:SSL routines:ssl3_get_record:wrong version number (conn: fd=11)
  master_1        | 1:M 03 Apr 2022 18:09:53.444 # Error accepting a client connection: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
  master_1        | 1:M 03 Apr 2022 18:09:53.456 # Error accepting a client connection: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
  master_1        | 1:M 03 Apr 2022 18:09:53.507 # Error accepting a client connection: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
  </code></pre>
  <p>I have no idea why redis-cli connects without any problems to the master and the application fails when they are in the same container. Also I dont know why the above error says <code>SSL routines:ssl3_get_record:wrong version number</code>.
  I will appreciate any help!
  Thanks in advance!</p>