RedisLabs / redis-cluster-proxy

A proxy for Redis clusters.
GNU Affero General Public License v3.0
993 stars 132 forks source link

Cluster auth fails via config file, works fine on CLI #28

Closed whoiswes closed 4 years ago

whoiswes commented 4 years ago

Disclaimer - I might be missing something obvious so apologies in advance if I am.

I am experiencing authentication errors when specifying a node password in a configuration file as opposed to the same password being passed on the cli.

Code for redis-cluster-proxy was compiled this morning (Feb 13) off of unstable. All tests passed.

Working params via shell

/data/redis/bin/redis-cluster-proxy --auth eatme 127.0.0.1:6381
[2020-02-13 17:27:51.631] Redis Cluster Proxy v999.999.999 (unstable)
[2020-02-13 17:27:51.631] Commit: (06c0f5ed/0)
[2020-02-13 17:27:51.631] Git Branch: unstable
[2020-02-13 17:27:51.631] Cluster Address: 127.0.0.1:6381
[2020-02-13 17:27:51.631] PID: 952
[2020-02-13 17:27:51.631] OS: Linux 3.10.0-1062.9.1.el7.x86_64 x86_64
[2020-02-13 17:27:51.631] Bits: 64
[2020-02-13 17:27:51.631] Log level: info
[2020-02-13 17:27:51.631] The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
[2020-02-13 17:27:51.631] Listening on *:7777
[2020-02-13 17:27:51.633] Starting 8 threads...
[2020-02-13 17:27:51.633] Fetching cluster configuration...
[2020-02-13 17:27:51.639] Cluster has 3 masters and 6 replica(s)
[2020-02-13 17:27:51.693] All thread(s) started!

Failure via config file

cat /data/redis/proxy.conf
auth eatme
cluster 127.0.0.1:6381

/data/redis/bin/redis-cluster-proxy -c /data/redis/proxy.conf
[2020-02-13 17:30:24.646] Redis Cluster Proxy v999.999.999 (unstable)
[2020-02-13 17:30:24.646] Commit: (06c0f5ed/0)
[2020-02-13 17:30:24.646] Git Branch: unstable
[2020-02-13 17:30:24.646] Cluster Address: 127.0.0.1:6381
[2020-02-13 17:30:24.646] PID: 2760
[2020-02-13 17:30:24.646] OS: Linux 3.10.0-1062.9.1.el7.x86_64 x86_64
[2020-02-13 17:30:24.646] Bits: 64
[2020-02-13 17:30:24.646] Log level: info
[2020-02-13 17:30:24.646] The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
[2020-02-13 17:30:24.646] Listening on *:7777
[2020-02-13 17:30:24.647] Starting 8 threads...
[2020-02-13 17:30:24.647] Fetching cluster configuration...
Failed to authenticate to node 127.0.0.1:6381: ERR invalid password
Failed to retrieve cluster configuration.
Cluster node 127.0.0.1:6381 replied with error:
NOAUTH Authentication required.
[2020-02-13 17:30:24.648] ERROR: Failed to fetch cluster configuration!
[2020-02-13 17:30:24.648] FATAL: failed to create thread 0.

System is RHEL7 with devtoolset-9 enabled (for GCC > 4.9).

Please let me know if I can provide further information or if I've missed something idiotic!

whoiswes commented 4 years ago

I just attempted a clean recompile (just because) and noticed this warning - possibly related?

In file included from /usr/include/string.h:633,
                 from cluster.c:20:
cluster.c: In function ‘clusterNodeAuth’:
cluster.c:944:19: warning: ‘__builtin_strncpy’ output truncated before terminating nul copying 26 bytes from a string of the same length [-Wstringop-truncation]
  944 |         if (*err) strncpy(*err, errmsg, errlen);
      |                   
artix75 commented 4 years ago

@whoiswes Thank you, I'll check it soon.

artix75 commented 4 years ago

@whoiswes Fixed in beac2a4

whoiswes commented 4 years ago

@artix75 - confirmed that this fixed my issue. Appreciate the quick response!