mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
create server_configuraton (#1225)
Co-authored-by: Daniel Hansson <github@hanssonit.se>
This commit is contained in:
parent
2298e601e6
commit
a71ef72060
@ -359,49 +359,8 @@ check_command bash "$SCRIPTS/change_db_pass.sh"
|
||||
sleep 3
|
||||
clear
|
||||
|
||||
# Extra configurations
|
||||
choice=$(whiptail --title "Extra configurations" --checklist "Choose what you want to configure\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Security" "(Add extra security based on this http://goo.gl/gEJHi7)" OFF \
|
||||
"Static IP" "(Set static IP in Ubuntu with netplan.io)" OFF \
|
||||
"Automatic updates" "(Automatically update your server every week on Sundays)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Security"*)
|
||||
clear
|
||||
run_static_script security
|
||||
;;&
|
||||
*"Static IP"*)
|
||||
clear
|
||||
run_static_script static_ip
|
||||
rm -f "$SCRIPTS"/lib.sh
|
||||
;;&
|
||||
*"Automatic updates"*)
|
||||
clear
|
||||
run_static_script automatic_updates
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Let's Encrypt
|
||||
msg_box "The following script will install a trusted
|
||||
TLS certificate through Let's Encrypt.
|
||||
|
||||
It's recommended to use TLS (https) together with Nextcloud.
|
||||
Please open port 80 and 443 to this servers IP before you continue.
|
||||
|
||||
More information can be found here:
|
||||
https://www.techandme.se/open-port-80-443/"
|
||||
|
||||
if [[ "yes" == $(ask_yes_or_no "Do you want to install TLS?") ]]
|
||||
then
|
||||
bash $SCRIPTS/activate-tls.sh
|
||||
else
|
||||
echo
|
||||
print_text_in_color "$ICyan" "OK, but if you want to run it later, just type: sudo bash $SCRIPTS/activate-tls.sh"
|
||||
any_key "Press any key to continue..."
|
||||
fi
|
||||
clear
|
||||
# Server configurations
|
||||
bash $SCRIPTS/server_configuration.sh
|
||||
|
||||
# Nextcloud configuration
|
||||
bash $SCRIPTS/configuration.sh
|
||||
@ -497,6 +456,7 @@ rm -f "$SCRIPTS/test_connection.sh"
|
||||
rm -f "$SCRIPTS/instruction.sh"
|
||||
rm -f "$NCDATA/nextcloud.log"
|
||||
rm -f "$SCRIPTS/static_ip.sh"
|
||||
rm -f "$SCRIPTS/lib.sh"
|
||||
|
||||
find /root "/home/$UNIXUSER" -type f \( -name '*.sh*' -o -name '*.html*' -o -name '*.tar*' -o -name 'results' -o -name '*.zip*' \) -delete
|
||||
find "$NCPATH" -type f \( -name 'results' -o -name '*.sh*' \) -delete
|
||||
|
||||
@ -701,6 +701,7 @@ check_command curl_to_dir "$GITHUB_REPO" lib.sh "$SCRIPTS"
|
||||
download_static_script instruction
|
||||
download_static_script history
|
||||
download_static_script static_ip
|
||||
download_static_script server_configuration
|
||||
|
||||
if home_sme_server
|
||||
then
|
||||
|
||||
@ -47,5 +47,6 @@ echo "alias nextcloud_occ='sudo -u www-data php $NCPATH/occ'"
|
||||
echo "alias run_update_nextcloud='bash $SCRIPTS/update.sh'"
|
||||
echo "alias additional_apps='bash $SCRIPTS/apps.sh'"
|
||||
echo "alias nextcloud_configuration='bash $SCRIPTS/configuration.sh'"
|
||||
echo "alias server_configuration='bash $SCRIPTS/server_configuration.sh'"
|
||||
} > /root/.bash_aliases
|
||||
|
||||
|
||||
86
static/server_configuration.sh
Normal file
86
static/server_configuration.sh
Normal file
@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/
|
||||
|
||||
# Use local lib file in case there is no internet connection
|
||||
if [ -f /var/scripts/lib.sh ]
|
||||
then
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/lib.sh
|
||||
# If we have internet, then use the latest variables from the lib remote file
|
||||
elif print_text_in_color "$ICyan" "Testing internet connection..." && ping github.com -c 2
|
||||
then
|
||||
# shellcheck disable=2034,2059
|
||||
true
|
||||
# shellcheck source=lib.sh
|
||||
. <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
else
|
||||
print_text_in_color "$IRed" "You don't seem to have a working internet connection, and /var/scripts/lib.sh is missing so you can't run this script."
|
||||
print_text_in_color "$ICyan" "Please report this to https://github.com/nextcloud/vm/issues/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
# 0 = OFF
|
||||
DEBUG=0
|
||||
debug_mode
|
||||
|
||||
# Must be root
|
||||
root_check
|
||||
|
||||
# Server configurations
|
||||
choice=$(whiptail --title "Server configurations" --checklist "Choose what you want to configure\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Activate TLS" "(Enable HTTPS with Let's Encrypt)" ON \
|
||||
"Security" "(Add extra security based on this http://goo.gl/gEJHi7)" OFF \
|
||||
"Static IP" "(Set static IP in Ubuntu with netplan.io)" OFF \
|
||||
"Automatic updates" "(Automatically update your server every week on Sundays)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Security"*)
|
||||
clear
|
||||
run_static_script security
|
||||
;;&
|
||||
*"Static IP"*)
|
||||
clear
|
||||
run_static_script static_ip
|
||||
;;&
|
||||
*"Automatic updates"*)
|
||||
clear
|
||||
run_static_script automatic_updates
|
||||
;;&
|
||||
*"Activate TLS"*)
|
||||
clear
|
||||
msg_box "The following script will install a trusted
|
||||
TLS certificate through Let's Encrypt.
|
||||
It's recommended to use TLS (https) together with Nextcloud.
|
||||
Please open port 80 and 443 to this servers IP before you continue.
|
||||
More information can be found here:
|
||||
https://www.techandme.se/open-port-80-443/"
|
||||
|
||||
if [[ "yes" == $(ask_yes_or_no "Do you want to install TLS?") ]]
|
||||
then
|
||||
if [ -f $SCRIPTS/activate-tls.sh ]
|
||||
then
|
||||
bash $SCRIPTS/activate-tls.sh
|
||||
else
|
||||
download_le_script activate-tls
|
||||
bash $SCRIPTS/activate-tls.sh
|
||||
fi
|
||||
else
|
||||
echo
|
||||
print_text_in_color "$ICyan" "OK, but if you want to run it later, just type: sudo bash $SCRIPTS/activate-tls.sh"
|
||||
any_key "Press any key to continue..."
|
||||
fi
|
||||
|
||||
# Just make sure they are gone
|
||||
rm -f "$SCRIPTS/test-new-config.sh"
|
||||
rm -f "$SCRIPTS/activate-tls.sh"
|
||||
clear
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
Loading…
Reference in New Issue
Block a user