Security – change the MASTERAUTH value on a running Redis instance in a Redis Cluster

redisreplicationSecurity

According to http://redis.io/topics/security, I can set a requirepass value, for example, requirepass foobared, in the Redis configuration files.

However, I don't want this in my configuration files.

Basically, I want to keep this password out of the .conf files, and set it using redis-cli.

################################## SECURITY ###################################

# Require clients to issue AUTH <PASSWORD> before processing any other
# commands.  This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# 2015.12.14 nbasanes: Although I prefer enabling this, I'm not 
# sure it buys us much, since a clear password in a config 
# file is bad for security:
# requirepass foobared

# 2015.12.14  nbasanes: This could be interesting, although 
#   I don't put much weight in security-by-obscurity:
# Command renaming.
#
# It is possible to change the name of dangerous commands in a shared
# environment. For instance the CONFIG command may be renamed into something
# hard to guess so that it will still be available for internal-use tools
# but not available for general clients.
#
# Example:
#
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# It is also possible to completely kill a command by renaming it into
# an empty string:
#
# rename-command CONFIG ""
#
# Please note that changing the name of commands that are logged into the
# AOF file or transmitted to slaves may cause problems.

Best Answer

Yes, can change auth at runtime. (Refer to Nathan Basanese's answer).

In addition, make sure to fire the config rewrite command for authentication to persist. It can otherwise be lost if the Redis instance restarts

CONFIG REWRITE

You can obtain a list of all the parameters that can be changed at run time by running CONFIG GET * against your Redis instance

  127.0.0.1:6379> CONFIG GET *
  1) "dbfilename"
  2) "dump.rdb"
  3) "requirepass"
  4) ""
  5) "masterauth"
  6) ""
  7) "unixsocket"
  8) ""