Coder Social home page Coder Social logo

ibm-cloud / redli Goto Github PK

View Code? Open in Web Editor NEW
265.0 17.0 21.0 28.8 MB

Redli - A humane alternative to the Redis-cli and TLS

License: Apache License 2.0

Go 99.47% Shell 0.19% Dockerfile 0.34%
redis redis-client command-line-tool tls-support ssl-support

redli's Introduction

Redli - a humane alternative to redis-cli

Release

About

Redli is a Go-based alternative to the official Redis-cli application. It's major feature is that it mimics the redis-cli command line argurments while also understanding rediss: protocols and supporting a --tls flag allowing it to connect to TLS/SSL secured Redis without the need for tunnels. It also has a number of flags and environment variables for passing server certificates over as files or base64 strings. Note, passing a certificate turns TLS on by default.

Installation

You can download the binary for your OS from the releases page. Un-tar the file, then chmod +x the binary and move it to your path.

You can also compile Redli with go using these steps (Go 1.8+ required):

  1. go get -u github.com/IBM-Cloud/redli
  2. go install github.com/IBM-Cloud/redli

Usage

 redli [<flags>] [<commands>...]

      --help               Show context-sensitive help (also try --help-long and --help-man).
      --debug              Enable debug mode.
      --long               Enable long prompt with host/port
  -u, --uri=URI            URI to connect to
  -h, --host="127.0.0.1"   Host to connect to
  -p, --port=6379          Port to connect to
  -a, --auth=AUTH          Password to use when connecting
  -n, --ndb=0              Redis database to access
      --tls                Enable TLS/SSL
      --skipverify         Insecure option to skip server certificate validation
      --certfile=CERTFILE  Self-signed certificate file for validation
      --certb64=CERTB64    Self-signed certificate string as base64 for validation
      --raw                Produce raw output
      --eval=EVAL          Evaluate a Lua script file, follow with keys a , and args
      
Args:
  [<commands>]  Redis commands and values

e.g. INFO KEYSPACE

Be aware of interactions with wild cards and special characters in the shell; quote and escape as appropriate.

License

Redli is (c) IBM Corporation 2018-2024. All rights reserved.

Redli is released under the Apache 2 License.

Attribution: The commands.json file is by Salvatore Sanfillipo.

In the process of building the application, the commands.json file of the Redis-docs repository is retrieved and incorporated into the code. This file is distributed under a CC-BY-SA 4.0 license (see Copyright).

redli's People

Contributors

0o001 avatar amanchh avatar calebboyd avatar codepope avatar jimlindeman avatar junatgit avatar kieranomahony98 avatar mgibson323 avatar ndflanagan avatar sanjeev-choubey avatar timwaizenegger avatar ullumullu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redli's Issues

-n flag is not taking effect (?)

I am trying to use redli in the command line, and I realized and it does not recognize my -n flag.

>redli -u <myurl> -n 1 set hello world
OK
>redli -u <myurl>
Connected to 5.0.5
>select 1
OK
>get hello
nil
>select 0
OK
>get hello
"world"

I would expect nil to be "world" as I was setting the key for "-n 1". As I am swithcing back to db 0 the key is set up there. Is there something I am doing wrong?

Thank you!

Passing password with forward slash causing URL analysis failed to connect

Hi there,

Thank you for this project so that I could connecting to TLS enabled REDIS without stunnel (https://www.stunnel.org/)

However, I found that with the arguments '--tls' and '-a' where there are characters '/' in the password value cause problem to connect my target REDIS server.

After I read the source code, I found the problem is from redis.go of this project which passes connectionurl to conn.go from gomodule/redigo. And finally, I found in line 270 of conn.go in gomodule/redigo using 'host, port, err := net.SplitHostPort(u.Host)' parses wrongly the host and port if the password in the connectionurl in it with '/'.

For my personal usage, I already changed in my local of redis.go of this project to use redis.Dial(...) as following:

conn, err = redis.Dial('tcp', address, redis.DialPassword(*redisauth), redis.DialUseTLS(*redistls))

I don't know is it a proper solution on this project level, if it's not, please correct me. And could the owner of this project to update this so that anyone facing this problem could get an official solution?

Thanks and best regards.

Kubernetes deployment issue

I have using the Dockerfile to build a image and using that image i am able to run it locally. so, i tried to deploy into Kubernetes cluster. wrote a yaml file and deployed it on k8s cluster .But after deploying it continuously getting restarts again and again. Can anyone help me on this please

Crypto Go :we are a research group to help developers build secure applications.

Hi, we are a research group to help developers build secure applications. We designed a cryptographic misuse detector (i.e., CryptoGo) on Go language. We found your great public repository from Github, and several security issues detected by CryptoGo are shown in the following.
Note that the cryptographic algorithms are categorized with two aspects: security strength and security vulnerability based on NIST Special Publication 800-57 and other public publications. Moreover, CryptoGo defined certain rules derived from the APIs of Go cryptographic library and other popular cryptographic misuse detectors. The specific security issues we found are as follows:
Location: redli.go:113;
Broken rule: SSL/TLS use insecure verification;
We wish the above security issues could truly help you to build a secure application. If you have any concern or suggestion, please feel free to contact us, we are looking forward to your reply. Thanks.

Set notify-keyspace-events Ex

Hi there!

We are implemenitng redis database offered by Digitalocean. Currently having troubleshooting on configuring the database. We are aware that redis does not support SSL/TLS support therefore digital ocean offers us to coonect redis-database with redli not with redis-cli whereas redli supports connection with TLS.

Our team used some configuration for redis as follows below:
config set notify-keyspace-events Ex

With redli we are not able have this feautures, indeed we should set this config.
We are able to connect to database for project we should set this config, unfortunately redli does not support set this config.

What we tried:
We could not connect to server where database is set.
Thought may be stunnel, but not solution for this issue.

Any possibilities to connect redis database with redis-cli or any solution for setting this conf on the server side or any way to set this config on redli?

Update to go 1.17

Hi, as there is a lot of vulnerabilities in earlier packages and 1.12 is a bit out of date..

I have created a PR for this and tested an action, however I definitely think some more testing should be done, is there any recommended tests?

Thank you

Pull Request: #42

Support TLS SNI hostnames

Add a command line flag to support supplying a TLS SNI hostname (crypto/tls.Config.ServerName) that is different from the connecting hostname.

Is the monitor command broken?

Ping works but monitor doesn't:

ping
PONG
monitor
(error) ERR unknown command monitor, with args beginning with:

Is it because monitor takes no arguments?

Don't pass the username when connecting to Redis < v6 even if a username is provided

redli 0.5 added support for Redis 6 and username-based authentication. However, if redli is used to connect to an earlier version of Redis, and a username is provided, then the connection fails with:

wrong number of arguments for 'auth' command

I know this seems silly: after all, if you don't want a username to be used, then don't pass one, but this does break certain scripts or other tools, like the IBM Cloud Databases CLI, which will pass the username regardless of the Redis version. Specifically, redli 0.5.0 and 0.5.1 do not work with when connecting to an older Redis:

ibmcloud cdb cxn --start MyOlderRedisDeployment INFO KEYSPACE

The Python Redis library had a similar issue. To correct it, they catch the "wrong number of arguments" response from Redis and try again with only the password. A similar fix to redli would be very much appreciated!

MONITOR Command issue

Hi Team,

In the article, Mentioned like MONITOR command will not be supported by redli but we could see MONITOR as a valid command as per below the provided json. Can anyone please help me the way where I can monitor the redis DB using redli
client? or any other client tools who can help us to support the MONITOR command

https://github.com/IBM-Cloud/redli/blob/master/commands.json

Thanks in advance.

Password with "#" causing error

When I have a password with a "#" character in it, the connection fails with the error:

Dial dial tcp: lookup tcp/'w6: getaddrinfow: The specified class was not found.

Other special characters seem OK. This is on Windows 10.

MIGRATE command syntax error?

Can anyone give me a hand understanding what's causing the syntax error: Current version of redli, on a Ubuntu 18.04 box running Redis, trying to migrate the keys from this source redis to DO managed Redis.

root@rogue-01:~# redli -a pasword
Connected to 5.0.5
> MIGRATE test-managed-redis-do-user-1250700-0.db.ondigitalocean.com 25061 "" 0 5000 AUTH managed-password KEYS
(error) ERR syntax error
>

Take arguments from stdin

Was almost happy to find this tool. Unfortunately, I need to be able to do this:
redli -h hostname -a abc1234567890abc --tls set bar < filename.json

I.e. load the data from a file. It is a major pain to not have that functionality. SO...
I guess it's back to the drawing board...

Redli support to connect cluster

I have redis cluster with 3 nodes.
while connecting to redis cluster using redli -u i get error when setting value or reading value due to cluster connect got moved to another node in the cluster.

How to inform redli that i am connecting in cluster mode rather than single node.
I am getting below error:

ct-xxxxxxxxxxxx.redis.cache.windows.net:6380> set name opiee
(error) MOVED 5798 20.51.232.39:15005

Opies-MBP-59.opsrihome:/Users/ovajinapalli $ redli --help
usage: redli [] [...]

Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--debug Enable debug mode.
--long Enable long prompt with host/port
-u, --uri=URI URI to connect to
-h, --host="127.0.0.1" Host to connect to
-p, --port=6379 Port to connect to
-r, --redisuser="" Username to use when connecting. Supported since Redis 6.
-a, --auth=AUTH Password to use when connecting
-n, --ndb=0 Redis database to access
--tls Enable TLS/SSL
--skipverify Don't validate certificates
--certfile=CERTFILE Self-signed certificate file for validation
--certb64=CERTB64 Self-signed certificate string as base64 for validation
--raw Produce raw output
--eval=EVAL Evaluate a Lua script file, follow with keys a , and args
--version Show application version.

Args:
[] Redis commands and values

I dont see any cluster option like redis-cli -c

passing "dash" argument

Hi,

thanks for this project (specially for someone being on Windows).
Small question : how do you properly escape dash parameters?
like in

redli.exe xrange - +
redli.exe: error: unknown short flag '-', try --help

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.