Redis Server

July 14, 2020 ยท View on GitHub

Before installing Redis, we recommend that you read through the security model of Redis, which is meant to be run within a strictly trusted environment. The below installation, and PANIC in general takes this security model into account and includes the suggested security boosts.

Installation

You can either install Redis directly on your system or use Docker. The former contains extra optional steps to reconfigure and secure Redis which are also useful if you choose the latter approach.

Installing Directly to System

  1. To install Redis server on your system:

    • On Linux, run:
      sudo apt-get install redis-server           # install Redis
      sudo systemctl enable redis-server.service  # set Redis to start on boot
      
    • On Windows, follow the installation steps here
  2. To configure Redis:

    1. First access the redis.conf file:

      • On Linux: sudo nano /etc/redis/redis.conf
      • On Windows: this is in the conf/ folder of the installation directory.
    2. In the GENERAL section, add (or uncomment) the line bind 127.0.0.1 to bind Redis only to localhost. This assumes that Redis is installed on the same system that will run the alerter.

    3. In the SECURITY section, add (or uncomment) the line requirepass <PASS>, where <PASS> is a complex password of your choosing. The alerter will ask for this password during setup.

    4. In the SECURITY section, you can also choose to disable some commands to prevent some actions from taking place. For each command, add a line: rename-command <COMMAND> "".

      • The following commands are not used by PANIC and can thus be disabled: FLUSHALL, PEXPIRE, CONFIG, SHUTDOWN, BGREWRITEAOF, BGSAVE, SAVE, SPOP, SREM, RENAME and DEBUG.
      • You can disable them by copy pasting this code in the SECURITY section:
           rename-command DEBUG ""
           rename-command RENAME ""
           rename-command SREM ""
           rename-command SPOP ""
           rename-command SAVE ""
           rename-command BGSAVE ""
           rename-command BGREWRITEAOF ""
           rename-command SHUTDOWN ""
           rename-command PEXPIRE ""
           rename-command FLUSHALL ""
      
    5. On Linux, restart Redis to apply changes: sudo service redis-server restart

  3. To run Redis:

    • On Linux, the Redis server should already be running.
    • On Windows, run redis-server.exe from the installation directory as administrator with the config file as an argument: .\redis-server.exe conf\redis.conf

At the end, you should have:

  1. Redis server installed, secured, and running.
  2. Ability to use Redis via the redis-cli command.
    • On Windows, redis-cli.exe is found in the installation directory.
    • To use Redis via the redis-cli, remember to authenticate using your password: AUTH <PASSWORD>.
    • Note that you do not have to have the cli running for the alerter to work.

Installing using Docker

To install and run Redis server on your system:

docker run -p 6379:6379 -d redis

To make sure that Redis is running:

docker ps

References and Further Reading:


Back to alerter installation page