From a7374f2cd47939f517641fca50641b1035274feb Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 11 Feb 2019 15:45:41 +0100 Subject: [PATCH] Change settings for default quota. Add Password settings. --- install_nextcloud.sh | 166 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 165 insertions(+), 1 deletion(-) diff --git a/install_nextcloud.sh b/install_nextcloud.sh index 1109203..b4b33da 100755 --- a/install_nextcloud.sh +++ b/install_nextcloud.sh @@ -2410,8 +2410,8 @@ _array_index="timeout" _value=0 _type="integer" echo "" >> $log_file -echo "# -" >> $log_file echo "# - Adjust configuration parameter '$_parameter' '$_array_index'" >> $log_file +echo "# -" >> $log_file echononl "Adjust configuration parameter '$_parameter' '$_array_index'.." cat <> $log_file @@ -2441,6 +2441,39 @@ fi blank_line +echo "" >> $log_file +echo "# - Set a default quota of 5 GB" >> $log_file +echo "# -" >> $log_file +echononl "Set a default quota of 5 GB" + + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set files \\ + default_quota --value="1 GB" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set files \ + default_quota --value="1 GB" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$log_file'." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." +fi + + +blank_line + + echo "" >> $log_file echo "# - Set background jobs to 'Cron'" >> $log_file echo "# -" >> $log_file @@ -2487,6 +2520,137 @@ fi +# ----- +# - Password Policies +# ----- + +echo "" +echo "" +echo -e "\033[37m\033[1mPassword Policies:\033[m" +echo "" + +echo "" >> $log_file +echo "" >> $log_file +echo "# -----" >> $log_file +echo "# - Password Policies:" >> $log_file +echo "# -----" >> $log_file + +echo "" >> $log_file +echo "# - Enforce passwords with at least one numeric character" >> $log_file +echo "# -" >> $log_file +echononl "Enforce passwords with at least one numeric character.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \\ + enforceNumericCharacters --value="1" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \ + enforceNumericCharacters --value="1" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$log_file'." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." +fi + + +echo "" >> $log_file +echo "# - Enforce passwords with at least one special character" >> $log_file +echo "# -" >> $log_file +echononl "Enforce passwords with at least one special character.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \\ + enforceSpecialCharacters --value="1" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \ + enforceSpecialCharacters --value="1" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$log_file'." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." +fi + + +echo "" >> $log_file +echo "# - Enforce passwords with at least one upper and lower case character" >> $log_file +echo "# -" >> $log_file +echononl "Enforce passwords with at least one upper and lower case character.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \\ + enforceUpperLowerCase --value="1" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \ + enforceUpperLowerCase --value="1" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$log_file'." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." +fi + + +echo "" >> $log_file +echo "# - Enforce passwords with a minimum length of 12 character" >> $log_file +echo "# -" >> $log_file +echononl "Enforce passwords with a minimum length of 12 character.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \\ + minLength --value="12" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set password_policy \ + minLength --value="12" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$log_file'." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." +fi + + # ----- # - Install/Enable some more nextcloud apps