MISP / misp-dashboard

A live dashboard for a real-time overview of threat intelligence from MISP instances
GNU Affero General Public License v3.0
194 stars 65 forks source link

MISCONF Redis - snapshots persistence #96

Closed SteveClement closed 5 years ago

SteveClement commented 5 years ago
$ sudo -u www-data ./zmq_subscriber.py
MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
SteveClement commented 5 years ago

This is possibly a permission problem.

Try:

$ ps auxw |grep 6250 |grep -v grep
www-data  2786  0.0  0.0  60888 10764 ?        Ssl  May27   2:25 redis-server 127.0.0.1:6250
$ ls -la $(echo "CONFIG GET dir" |redis-cli -p 6250 |tail -1)
total 32
drwxr-sr-x  3 steve    steve  4096 Apr 29 11:48 .
drwxrwsr-x 14 www-data steve  4096 May 29 10:09 ..
-rw-r--r--  1 steve    steve 17154 Apr 29 11:47 country_code_lat_long.json
lrwxrwxrwx  1 root     steve    22 Apr 29 11:48 GeoLite2-City -> GeoLite2-City_20190423
drwxr-xr-x  2     2000  2000  4096 Apr 23 06:26 GeoLite2-City_20190423

The redis process tries to write the file into that directory yet fails.

If you do not care about persistence:

$ echo "config set stop-writes-on-bgsave-error no" | redis-cli -p 6250

After a careful, yet highly precise, chown, we get this:

$ sudo chown www-data:www-data $(echo "CONFIG GET dir" |redis-cli -p 6250 |tail -1)
$ ls -la $(echo "CONFIG GET dir" |redis-cli -p 6250 |tail -1)/dump.rdb
-rw-r--r-- 1 www-data www-data 258 May 29 10:17 /var/www/misp-dashboard/data/dump.rdb