diff --git a/static/redis-server-ubuntu16.sh b/static/redis-server-ubuntu16.sh index 7d13a5a3..d317d9d5 100644 --- a/static/redis-server-ubuntu16.sh +++ b/static/redis-server-ubuntu16.sh @@ -8,6 +8,7 @@ SCRIPTS=/var/scripts NCPATH=/var/www/nextcloud REDIS_CONF=/etc/redis/redis.conf REDIS_SOCK=/var/run/redis/redis.sock +REDIS_PASS=$(cat /dev/urandom | tr -dc "a-zA-Z0-9@#*=" | fold -w $SHUF | head -n 1) # Must be root [[ `id -u` -eq 0 ]] || { echo "Must be root to run script, in Ubuntu type: sudo -i"; exit 1; } @@ -103,10 +104,13 @@ cat <> $NCPATH/config/config.php 'port' => 0, 'timeout' => 0, 'dbindex' => 0, + 'password' => '$REDIS_PASS', ), ); ADD_TO_CONFIG + + # Redis performance tweaks if grep -Fxq "vm.overcommit_memory = 1" /etc/sysctl.conf then @@ -117,6 +121,7 @@ fi sed -i "s|# unixsocket /var/run/redis/redis.sock|unixsocket $REDIS_SOCK|g" $REDIS_CONF sed -i "s|# unixsocketperm 700|unixsocketperm 777|g" $REDIS_CONF sed -i "s|port 6379|port 0|g" $REDIS_CONF +sed -i "s|# requirepass|requirepass $REDIS_PASS|g" $REDIS_CONF redis-cli SHUTDOWN # Cleanup