rump
rump copied to clipboard
tls: add option to connect to redis with enabled tls and auth token
- [x] I have read the contributing guide.
- [x] Issue: https://github.com/stickermule/rump/issues/41
Implementation
- radix version is upgraded to
v3.7.1
and tested in real environment. - added auth field to redis Resource struct.
- added new function for retrieving redis url and auth token in connection string. It's done for avoiding code duplication.
- added new test case for checking how validation works with auth token.
- when connecting to redis with auth token we need to define callback to perform authentication and encryption as described here. Here is implementation
- Here I check if auth is enabled we use ConnFunc described above, or your method without authentication (same for target).
Thanks!
It's break auth without TLS support.
For TLS connection, redis url should use rediss://
instead of redis://
@yuyuvn it's not braking, I have tested it in both ways, and yes you should use rediss://
for TLS connections which is not available in current version of rump.
@lanycrost
Did you test connect to redis server without TLS and have auth?
for example: redis://user:[email protected]:6379
strings.Contains(conn, authSeparator)
-> this condition will return true, so rump will connect via tls, which is not expected.
and yes you should use rediss:// for TLS connections which is not available in current version of rump. How about implement that in your pull-request? Instead of check
@
to determine user want to use TLS or not, check if prefix isrediss
or not should be better.
@yuyuvn sorry you are right, fixed.