mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
Added Redis password (#133)
This commit is contained in:
parent
88186937f2
commit
a729159e4d
@ -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 <<ADD_TO_CONFIG>> $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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user