I setup Redis 5.x with stunnel to accept SSL connections from client. The setup is pretty straightforward, and I just follow the instruction from Redis site.
It is something like: stunnel accepts client requests via SSL connection and forward to redis via non-SSL connection.
On 2 of my dev computers both running Mac OS X, the setup works fine with Ruby gem redis and Elixir Redix library.
The commands are as following:
Ruby:
redis = Redis.new(host: "127.0.0.1", port: 6380, db: 3, ssl: true, password: 'SomeSecret :)')
redis.ping
Elixir:
{:ok, conn} = Redix.start_link( host: "127.0.0.1", port: 6380, ssl: true, password: "SomeSecret :)", socket_opts: [verify: :verify_none])
Redix.command(conn, ["PING"])
So I know that the redis + stunnel setup works well on 2 different Mac machines.
When I deploy the same setup to a Linux machine that run CentOS 7, the Ruby client still works fine.
However, on CentOS 7, the Elixir Redix stops working, and I get the error:
{:error, %Redix.ConnectionError{reason: :closed}}
To me, it doesn't make any sense, because the Cent OS has stunnel + redis setup is exactly the same as my 2 dev Mac machines. And the Ruby client works well on all 3 machines : 2 Mac and 1 CentOS.
However, Elixir Redix works only on the 2 Mac machines, but not on the Cent OS. Same setup, same code.
Question: Why doesn't Elixir Redix SSL code work on CentOS, while it works on Mac?
(Same setup, same code)
More information: On both Mac machines and on CentOS machine, I have:
Erlang/OTP 22 [erts-10.4.3] [source] [64-bit]
Elixir 1.9.0 (compiled with Erlang/OTP 20)
I just discover that on CentOS, in the log, there is an error:
TLS client: In state hello at tls_handshake.erl:182 generated CLIENT ALERT: Fatal - Protocol Version
Maybe that is the problem. But I don't see it on Mac machines.