diff --git a/README.md b/README.md index 2b7cb15..f99fa4d 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,5 @@ - PHP-FPM 7.2 - Latest Wordpress (updates automatically) - WP-CLI +- Redis Cache - and [more](https://docs.hanssonit.se/s/W6fMouPiqQz3_Mog/virtual-machines-vm/d/W7jL1OPiqQz3_MtV/wordpress-vm-machine-configuration). diff --git a/lib.sh b/lib.sh index ad5b8a5..00b3180 100644 --- a/lib.sh +++ b/lib.sh @@ -81,6 +81,7 @@ REDIS_CONF=/etc/redis/redis.conf REDIS_SOCK=/var/run/redis/redis-server.sock RSHUF=$(shuf -i 30-35 -n 1) REDIS_PASS=$(tr -dc "a-zA-Z0-9@#*=" < /dev/urandom | fold -w "$RSHUF" | head -n 1) +REDISPTXT=/tmp/redispasstxt # Extra security SPAMHAUS=/etc/spamhaus.wl diff --git a/static/redis-server-ubuntu.sh b/static/redis-server-ubuntu.sh index e5a4b69..d84c5eb 100644 --- a/static/redis-server-ubuntu.sh +++ b/static/redis-server-ubuntu.sh @@ -81,10 +81,10 @@ fi sed -i "s|# unixsocket .*|unixsocket $REDIS_SOCK|g" $REDIS_CONF sed -i "s|# unixsocketperm .*|unixsocketperm 777|g" $REDIS_CONF sed -i "s|^port.*|port 0|" $REDIS_CONF -sed -i "s|# requirepass .*|requirepass $(cat /tmp/redis_pass.txt)|g" $REDIS_CONF +sed -i "s|# requirepass .*|requirepass $(cat $REDISPTXT)|g" $REDIS_CONF sed -i 's|# rename-command CONFIG ""|rename-command CONFIG ""|' $REDIS_CONF redis-cli SHUTDOWN -rm -f /tmp/redis_pass.txt +rm -f $REDISPTXT # Secure Redis chown redis:root /etc/redis/redis.conf diff --git a/wordpress_install.sh b/wordpress_install.sh index 0afbfea..e57a75c 100644 --- a/wordpress_install.sh +++ b/wordpress_install.sh @@ -229,7 +229,7 @@ then print_text_in_color "$IGreen" "APCu PHP module installation OK!" fi { -echo "# APCu settings for Nextcloud" +echo "# APCu settings for Wordpress" echo "extension=apcu.so" echo "apc.enabled=1" echo "apc.shm_segments=1" @@ -313,7 +313,7 @@ define( 'WP_MEMORY_LIMIT', '128M' ); PHP # Make sure the passwords are the same, this file will be deleted when Redis is run. -echo "$REDIS_PASS" > /tmp/redis_pass.txt +check_command echo "$REDIS_PASS" > $REDISPTXT # Install Wordpress check_command wp_cli_cmd core install --url=http://"$ADDRESS"/ --title=Wordpress --admin_user=$WPADMINUSER --admin_password="$WPADMINPASS" --admin_email=no-reply@hanssonit.se --skip-email