From 42bcf9c7f303970b22a6e10ad45fd5df68b79b19 Mon Sep 17 00:00:00 2001 From: radio24 Date: Sat, 30 Mar 2024 23:10:38 +0100 Subject: [PATCH] Improved prepare_image.sh // exim4 removed --- bin/find_domains | 4 +- bin/first_use | 24 +----- bin/hostapd_fallback | 6 +- bin/hostapd_fallback_komplex_part_1 | 4 +- bin/restore | 2 +- bin/set_interfaces_2 | 5 +- etc/nginx/nginx.conf | 4 +- install/openvpn-install.sh | 10 +-- install/prepare_image.sh | 111 ++++++++++++++++++++-------- install/run_install.sh | 5 +- install/run_install_mini.sh | 5 +- install/run_install_on_debian.sh | 5 +- install/run_install_on_ubuntu.sh | 7 +- lib/torbox.lib | 99 +++++++++++++++---------- menu-config | 17 ++--- menu-update | 5 +- 16 files changed, 184 insertions(+), 129 deletions(-) diff --git a/bin/find_domains b/bin/find_domains index 20852545..ea028358 100755 --- a/bin/find_domains +++ b/bin/find_domains @@ -207,7 +207,7 @@ if [ "$RESCAN" == "1" ]; then echo "" while true do - read -r -p $'\e[1;37mChoose the desired list -> \e[0m' + read -r -p $'\e[1;93mChoose the desired list -> \e[0m' if [[ $REPLY =~ ^[120]$ ]] ; then echo break @@ -230,7 +230,7 @@ if [ "$RESCAN" == "1" ]; then echo "" while true do - read -r -p $'\e[1;37mChoose the desired menu entry -> \e[0m' + read -r -p $'\e[1;93mChoose the desired menu entry -> \e[0m' if [[ $REPLY =~ ^[120]$ ]] ; then echo break diff --git a/bin/first_use b/bin/first_use index 1f499bda..8c3b0499 100755 --- a/bin/first_use +++ b/bin/first_use @@ -336,29 +336,7 @@ while [ $FRESHINSTALLED -gt 0 ]; do clear sudo timedatectl set-timezone UTC if [ "$CHECK_OS" == "Ubuntu" ]; then stty sane; fi - echo -e "${YELLOW}[!] SYSTEM-TIME CHECK${NOCOLOR}" - echo -e "${RED}[!] Tor needs a correctly synchronized time.${NOCOLOR}" - echo -e "${RED} The system should display the current UTC time:${NOCOLOR}" - echo - echo " Date: $(date '+%Y-%m-%d')" - $TORBOX_PATH/bin/clock.py - echo - echo -e "${RED} You can find the correct time here: ${YELLOW}https://time.is/UTC${NOCOLOR}" - echo - while true - do - read -r -p $'\e[1;31m Do you want to adjust the system time [Y/n]? -> \e[0m' - # The following line is for the prompt to appear on a new line. - if [[ $REPLY =~ ^[YyNn]$ ]] ; then - echo - echo - break - fi - done - if [[ $REPLY =~ ^[Yy]$ ]] ; then - settime - fi - + settime # Ask for bridge support clear DEFAULT_BRIDGE_SUPPORT=0 diff --git a/bin/hostapd_fallback b/bin/hostapd_fallback index 6291456f..012a83e7 100755 --- a/bin/hostapd_fallback +++ b/bin/hostapd_fallback @@ -43,10 +43,10 @@ if [ -n "$STATICIP_WLAN1" ]; then sudo sed -i "s/^interface=wlan1/interface=wlan0/" ${HOSTAPD} fi sleep 5 -LOG_STATUS=$(sudo systemctl is-active hostapd) +AP_STATUS=$(sudo systemctl is-active hostapd) sleep 5 -echo $LOG_STATUS -if [ $LOG_STATUS = activating ] || [ $LOG_STATUS = inactive ]; then +echo $AP_STATUS +if [ $AP_STATUS = activating ] || [ $AP_STATUS = inactive ]; then sudo cp ${HOSTAPD_SAV} ${HOSTAPD} if [ -n "$STATICIP_WLAN1" ]; then sudo sed -i "s/^interface=wlan0/interface=wlan1/" ${HOSTAPD} diff --git a/bin/hostapd_fallback_komplex_part_1 b/bin/hostapd_fallback_komplex_part_1 index acfd6cac..8dac1f8f 100755 --- a/bin/hostapd_fallback_komplex_part_1 +++ b/bin/hostapd_fallback_komplex_part_1 @@ -137,8 +137,8 @@ if ! grep "^interface=$INTERFACE1" ${HOSTAPD} ; then sudo sed -i "s/^interface=.*/interface=$INTERFACE1/" ${HOSTAPD} sudo systemctl restart hostapd sleep 5 - LOG_STATUS=$(sudo systemctl is-active hostapd) - if [ $LOG_STATUS = activating ] || [ $LOG_STATUS = inactive ] ; then + AP_STATUS=$(sudo systemctl is-active hostapd) + if [ $AP_STATUS = activating ] || [ $AP_STATUS = inactive ] ; then sudo sed -i "s/^hw_mode=a/hw_mode=g/" ${HOSTAPD} sudo sed -i "s/^channel=.*/channel=6/" ${HOSTAPD} sudo sed -i "s/^ht_capab=[HT40-][HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]/#ht_capab=[HT40-][HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]/" ${HOSTAPD} diff --git a/bin/restore b/bin/restore index 4161c8cd..451e2567 100755 --- a/bin/restore +++ b/bin/restore @@ -324,7 +324,7 @@ if (whiptail --title "TorBox - INFO (scroll down!)" --scrolltext --no-button "NO # Restoring TORRC echo "" - read -r -p $'\e[1;37mDo you really want to overwrite the basic torbox configration (/etc/torrc)? [y/N]? -> \e[0m' -e -i N REPLY + read -r -p $'\e[1;93mDo you really want to overwrite the basic torbox configration (/etc/torrc)? [y/N]? -> \e[0m' -e -i N REPLY # The following line is for the prompt to appear on a new line. if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [[ $REPLY =~ ^[Yy]$ ]] ; then diff --git a/bin/set_interfaces_2 b/bin/set_interfaces_2 index dabc4730..3f9dd5f7 100755 --- a/bin/set_interfaces_2 +++ b/bin/set_interfaces_2 @@ -286,7 +286,8 @@ if grep -q "UNPROTECTED_DOMAIN=1" ${RUNFILE} ; then $TORBOX_PATH/bin/set_interfa if [ $CAPTIVE != 1 ] && [ $CAPTIVE != 2 ] && [ "$O_DEVICE" != "ppp0" ]; then echo -e "${RED}[+] Finishing...${NOCOLOR}" (sudo ifdown $O_DEVICE) 2>/dev/null - sleep 2 + # Test lowered sleep from 2 to 1 + sleep 1 (sudo ifup $O_DEVICE) 2>/dev/null - sleep 2 + sleep 1 fi diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index 8ed37299..55a709c5 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -37,8 +37,8 @@ http { # Logging Settings ## - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; + access_log /dev/null; + error_log /dev/null; ## # Gzip Settings diff --git a/install/openvpn-install.sh b/install/openvpn-install.sh index 5fb8a6ff..a7d08990 100755 --- a/install/openvpn-install.sh +++ b/install/openvpn-install.sh @@ -130,9 +130,9 @@ function initialCheck() { checkOS # TOGGLE01 shows if the OpenVPN server is disabled or not - LOG_STATUS="" - LOG_STATUS=$(sudo systemctl is-active openvpn) - if [ $LOG_STATUS = inactive ] || [ $LOG_STATUS = failed ] ; then + VPN_STATUS="" + VPN_STATUS=$(sudo systemctl is-active openvpn) + if [ $VPN_STATUS = inactive ] || [ $VPN_STATUS = failed ] ; then TOGGLE01="Enable" TOGGLE02="" else @@ -927,7 +927,7 @@ function stopOpenVPN() { fi else clear - read -rp $'\e[1;37mDo you want to enable OpenVPN? [y/n]: \e[0m' -e ENABLE + read -rp $'\e[1;93mDo you want to enable OpenVPN? [y/n]: \e[0m' -e ENABLE if [[ $ENABLE == 'y' ]]; then clear echo -e "${RED}[+] Enabling TorBox's WLAN now...${NOCOLOR}" @@ -944,7 +944,7 @@ function stopOpenVPN() { function removeOpenVPN() { clear - read -rp $'\e[1;37mDo you really want to remove OpenVPN? [y/n]: \e[0m' -e -i n REMOVE + read -rp $'\e[1;93mDo you really want to remove OpenVPN? [y/n]: \e[0m' -e -i n REMOVE if [[ $REMOVE == 'y' ]]; then # Get OpenVPN port from the configuration PORT=$(grep '^port ' $OPENVPN_CONF | cut -d " " -f 2) diff --git a/install/prepare_image.sh b/install/prepare_image.sh index b43ce49e..61ad0779 100755 --- a/install/prepare_image.sh +++ b/install/prepare_image.sh @@ -35,6 +35,9 @@ GREEN='\033[1;32m' YELLOW='\033[1;93m' NOCOLOR='\033[0m' +# Other variables +TORBOX_PATH="/home/torbox/torbox" + ############################## ######## FUNCTIONS ########### @@ -110,7 +113,6 @@ echo -e "${RED}Obfs4proxy version :${YELLOW} $(obfs4pr echo -e "${RED}Snowflake :${YELLOW} ${SNOWFLAKE_VERS}${NOCOLOR}" echo -e "${RED}Nyx version :${YELLOW} $(nyx -v | head -1 | sed "s/nyx version //")${NOCOLOR}" echo -e "${RED}Go version :${YELLOW} $(go version | head -1 | sed "s/go version //")${NOCOLOR}" -echo -e "${RED}Installed time zone :${YELLOW} $(cat /etc/timezone)${NOCOLOR}" echo -e "${RED}Firewall countermeasures :$FIREWALL${NOCOLOR}" echo -e "${RED}Disconnection when idle countermeasure :$PING${NOCOLOR}" echo -e "${RED}TorBox's automatic counteractions are :$LOGCHECK${NOCOLOR}" @@ -118,45 +120,77 @@ echo -e "${RED}Bridges :$MODE_BRIDGES${NOCO echo -e "${RED}Bridge Relay :$BRIDGE_RELAY${NOCOLOR}" echo -e "${RED}Onion Services :$MODE_OS${NOCOLOR}" echo -echo -echo -e "${YELLOW}Following Python modules are installed:${NOCOLOR}" +read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m' +clear +echo -e "${YELLOW}The following Python modules are installed:${NOCOLOR}" +# NEW v.0.5.3: For RaspberryPi OS based on Debian Bookworm needed +PYTHON_LIB_PATH=$(python3 -c "import sys; print(sys.path)" | cut -d ',' -f3 | sed "s/'//g" | sed "s/,//g" | sed "s/ //g") +if [ -f "$PYTHON_LIB_PATH/EXTERNALLY-MANAGED" ] ; then + sudo rm "$PYTHON_LIB_PATH/EXTERNALLY-MANAGED" +fi if [ ! -f requirements.txt ]; then wget --no-cache https://raw.githubusercontent.com/radio24/TorBox/master/requirements.txt; fi if [ -f requirements.failed ]; then rm requirements.failed; fi REPLY="Y" while [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; do - REPLY="" - readarray -t REQUIREMENTS < requirements.txt - for REQUIREMENT in "${REQUIREMENTS[@]}"; do - if grep "==" <<< $REQUIREMENT ; then REQUIREMENT=$(sed s"/==.*//" <<< $REQUIREMENT); fi - VERSION=$(pip3 freeze | grep $REQUIREMENT | sed "s/${REQUIREMENT}==//" 2>&1) - echo -e "${RED}${REQUIREMENT} version: ${YELLOW}$VERSION${NOCOLOR}" - if [ -z "$VERSION" ]; then - # shellcheck disable=SC2059 - (printf "$REQUIREMENT\n" | tee -a requirements.failed) >/dev/null 2>&1 - fi - done - if [ -f requirements.failed ]; then - echo "" - echo -e "${YELLOW}Not alle required Python modules could be installed!${NOCOLOR}" - read -r -p $'\e[1;37mWould you like to try it again [Y/n]? -> \e[0m' - if [[ $REPLY =~ ^[YyNn]$ ]] ; then - if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then - sudo pip3 install -r requirements.failed - sleep 5 - rm requirements.failed - unset REQUIREMENTS - clear - fi - fi - fi + unset REPLY + readarray -t REQUIREMENTS < requirements.txt + for REQUIREMENT in "${REQUIREMENTS[@]}"; do + if grep "==" <<< $REQUIREMENT ; then REQUIREMENT=$(sed s"/==.*//" <<< $REQUIREMENT); fi + VERSION=$(pip3 freeze | grep -i $REQUIREMENT | sed "s/${REQUIREMENT}==//i" 2>&1) + echo -e "${RED}${REQUIREMENT} version: ${YELLOW}$VERSION${NOCOLOR}" + if [ -z "$VERSION" ]; then + # shellcheck disable=SC2059 + (printf "$REQUIREMENT\n" | tee -a requirements.failed) >/dev/null 2>&1 + fi + done + if [ -f requirements.failed ]; then + echo "" + echo -e "${YELLOW}Not all required Python modules could be installed!${NOCOLOR}" + read -r -p $'\e[1;93mWould you like to try it again [Y/n]? -> \e[0m' + if [[ $REPLY =~ ^[YyNn]$ ]] ; then + if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then + sudo pip3 install -r requirements.failed + sleep 5 + rm requirements.failed + unset REQUIREMENTS + clear + fi + fi + fi done +unset REPLY +echo "" +read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m' +clear +echo -e "${YELLOW}The following additional network drivers are installed:${NOCOLOR}" +dkms status +echo +echo -e "${RED}Does it look right?${NOCOLOR}" +echo -e "${RED}Would you like to re-install the asditional network drivers?${NOCOLOR}" +read -r -p $'\e[1;93mWould you like to re-install the asditional network drivers [y/N]? -> \e[0m' +if [[ $REPLY =~ ^[YyNn]$ ]] ; then + if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then + sudo dkms remove --all + sudo bash install_network_drivers + fi +fi echo "" read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m' clear echo -e "${YELLOW}[!] PREPARATIONS FOR THE IMAGE${NOCOLOR}" echo echo -e "${RED}[+] Setting the correct time${NOCOLOR}" -sudo /usr/sbin/ntpdate pool.ntp.org +if [ -f "/etc/timezone" ]; then + sudo mv /etc/timezone /etc/timezone.bak + (printf "Etc/UTC" | sudo tee /etc/timezone) 2>&1 +fi +sudo timedatectl set-timezone UTC +echo -e "${RED}Installed time zone:${YELLOW} $(cat /etc/timezone)${NOCOLOR}" +echo +settime +clear +echo -e "${YELLOW}[!] PREPARATIONS FOR THE IMAGE${NOCOLOR}" +echo echo -e "${RED}[+] Deactivating TorBox's automatic counteractions feature...${NOCOLOR}" sudo pkill -f "log_check.py" echo -e "${RED}[+] Stopping and masking tor${NOCOLOR}" @@ -195,7 +229,7 @@ echo -e "${RED}[+] Copy default interfaces${NOCOLOR}" sudo cp etc/network/interfaces /etc/network/ echo -e "${RED}[+] Erasing big not usefull packages...${NOCOLOR}" # Find the bigest space waster packages: dpigs -H -(sudo apt-get -y remove libgl1-mesa-dri texlive* lmodern) 2>/dev/null +(sudo apt-get -y --purge remove libgl1-mesa-dri texlive* lmodern) 2>/dev/null echo -e "${RED}[+] Fixing and cleaning${NOCOLOR}" sudo apt --fix-broken install sudo apt-get -y clean; sudo apt-get -y autoclean; sudo apt-get -y autoremove @@ -204,6 +238,23 @@ sudo setcap 'cap_net_bind_service=+ep' /usr/bin/obfs4proxy sudo sed -i "s/^NoNewPrivileges=yes/NoNewPrivileges=no/g" /lib/systemd/system/tor@default.service sudo sed -i "s/^NoNewPrivileges=yes/NoNewPrivileges=no/g" /lib/systemd/system/tor@.service sudo systemctl daemon-reload +echo -e "${RED}[+] Setting log level to low...${NOCOLOR}" +LOG_STATUS_001=$(sudo systemctl is-active rsyslog) +LOG_STATUS_002=$(sudo systemctl is-active systemd-journald.service) +if [ "$LOG_STATUS_001" != "inactive" ] || [ "$LOG_STATUS_002" != "inactive" ]; then + echo -e "${RED}[+] Stopping logging now...${NOCOLOR}" + sudo systemctl stop rsyslog + sudo systemctl stop systemd-journald-dev-log.socket + sudo systemctl stop systemd-journald-audit.socket + sudo systemctl stop systemd-journald.socket + sudo systemctl stop systemd-journald.service + sudo systemctl mask systemd-journald.service + echo "" + echo -e "${RED}[+] Making it permanent...${NOCOLOR}" + #Siehe auch hier: https://stackoverflow.com/questions/17358499/linux-how-to-disable-all-log + sudo systemctl disable rsyslog + sudo systemctl mask rsyslog +fi echo -e "${RED}[+] Deleting all logs and resetting Tor statistics...${NOCOLOR}" echo erase_logs diff --git a/install/run_install.sh b/install/run_install.sh index abb06775..3c9c482b 100755 --- a/install/run_install.sh +++ b/install/run_install.sh @@ -446,7 +446,7 @@ select_and_install_tor() echo -e "${RED}$menuitem${NOCOLOR} - ${torversion_versionsorted_new[$i]}" done echo "" - read -r -p $'\e[1;37mWhich tor version (number) would you like to use? -> \e[0m' + read -r -p $'\e[1;93mWhich tor version (number) would you like to use? -> \e[0m' echo if [[ $REPLY =~ ^[1234567890]$ ]]; then if [ $REPLY -gt 0 ] && [ $((REPLY-1)) -le $number_torversion ]; then @@ -714,7 +714,7 @@ while [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; do if [ -f requirements.failed ]; then echo "" echo -e "${YELLOW}Not alle required Python modules could be installed!${NOCOLOR}" - read -r -p $'\e[1;37mWould you like to try it again [Y/n]? -> \e[0m' + read -r -p $'\e[1;93mWould you like to try it again [Y/n]? -> \e[0m' if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then sudo pip3 install -r requirements.failed @@ -1148,6 +1148,7 @@ read -n 1 -s -r -p $'\e[1;31mTo complete the installation, please press any key. clear echo -e "${RED}[+] Erasing big not usefull packages...${NOCOLOR}" # Find the bigest space waster packages: dpigs -H +sudo apt-get -y --purge remove exim4 exim4-base exim4-config exim4-daemon-light sudo apt-get -y remove libgl1-mesa-dri texlive* lmodern sudo apt-get -y clean sudo apt-get -y autoclean diff --git a/install/run_install_mini.sh b/install/run_install_mini.sh index 7a634425..b1a4e4f3 100644 --- a/install/run_install_mini.sh +++ b/install/run_install_mini.sh @@ -446,7 +446,7 @@ select_and_install_tor() echo -e "${RED}$menuitem${NOCOLOR} - ${torversion_versionsorted_new[$i]}" done echo "" - read -r -p $'\e[1;37mWhich tor version (number) would you like to use? -> \e[0m' + read -r -p $'\e[1;93mWhich tor version (number) would you like to use? -> \e[0m' echo if [[ $REPLY =~ ^[1234567890]$ ]]; then if [ $REPLY -gt 0 ] && [ $((REPLY-1)) -le $number_torversion ]; then @@ -714,7 +714,7 @@ while [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; do if [ -f requirements.failed ]; then echo "" echo -e "${YELLOW}Not alle required Python modules could be installed!${NOCOLOR}" - read -r -p $'\e[1;37mWould you like to try it again [Y/n]? -> \e[0m' + read -r -p $'\e[1;93mWould you like to try it again [Y/n]? -> \e[0m' if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then sudo pip3 install -r requirements.failed @@ -1155,6 +1155,7 @@ read -n 1 -s -r -p $'\e[1;31mTo complete the installation, please press any key. clear echo -e "${RED}[+] Erasing big not usefull packages...${NOCOLOR}" # Find the bigest space waster packages: dpigs -H +sudo apt-get -y --purge remove exim4 exim4-base exim4-config exim4-daemon-light sudo apt-get -y remove libgl1-mesa-dri texlive* lmodern sudo apt-get -y clean sudo apt-get -y autoclean diff --git a/install/run_install_on_debian.sh b/install/run_install_on_debian.sh index 305d0c68..db3bcdf0 100755 --- a/install/run_install_on_debian.sh +++ b/install/run_install_on_debian.sh @@ -442,7 +442,7 @@ select_and_install_tor() echo -e "${RED}$menuitem${NOCOLOR} - ${torversion_versionsorted_new[$i]}" done echo "" - read -r -p $'\e[1;37mWhich tor version (number) would you like to use? -> \e[0m' + read -r -p $'\e[1;93mWhich tor version (number) would you like to use? -> \e[0m' echo if [[ $REPLY =~ ^[1234567890]$ ]]; then if [ $REPLY -gt 0 ] && [ $((REPLY-1)) -le $number_torversion ]; then @@ -716,7 +716,7 @@ while [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; do if [ -f requirements.failed ]; then echo "" echo -e "${YELLOW}Not alle required Python modules could be installed!${NOCOLOR}" - read -r -p $'\e[1;37mWould you like to try it again [Y/n]? -> \e[0m' + read -r -p $'\e[1;93mWould you like to try it again [Y/n]? -> \e[0m' if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then pip3 install -r requirements.failed @@ -1236,6 +1236,7 @@ clear echo -e "${RED}[+] Erasing big not usefull packages...${NOCOLOR}" (rm -r WiringPi) 2>/dev/null # Find the bigest space waster packages: dpigs -H +apt-get -y --purge remove exim4 exim4-base exim4-config exim4-daemon-light apt-get -y remove libgl1-mesa-dri texlive* lmodern apt-get -y clean apt-get -y autoclean diff --git a/install/run_install_on_ubuntu.sh b/install/run_install_on_ubuntu.sh index 248b61e8..e6650a8d 100755 --- a/install/run_install_on_ubuntu.sh +++ b/install/run_install_on_ubuntu.sh @@ -452,7 +452,7 @@ select_and_install_tor() echo -e "${RED}$menuitem${NOCOLOR} - ${torversion_versionsorted_new[$i]}" done echo "" - read -r -p $'\e[1;37mWhich tor version (number) would you like to use? -> \e[0m' + read -r -p $'\e[1;93mWhich tor version (number) would you like to use? -> \e[0m' echo if [[ $REPLY =~ ^[1234567890]$ ]]; then if [ $REPLY -gt 0 ] && [ $(( $REPLY - 1 )) -le $number_torversion ]; then @@ -652,7 +652,7 @@ fi echo -e "${RED}[+] Did an information window tell you that you just updated the Linux kernel?${NOCOLOR}" echo -e "${RED}[+] In this case, we recommend rebooting the system and restarting the installation.${NOCOLOR}" echo "" -read -r -p $'\e[1;37mWould you like to reboot the system now [Y/n]? -> \e[0m' +read -r -p $'\e[1;93mWould you like to reboot the system now [Y/n]? -> \e[0m' echo if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [[ $REPLY =~ ^[Yy]$ ]] ; then sync; reboot ; fi @@ -762,7 +762,7 @@ while [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; do if [ -f "requirements.failed" ]; then echo "" echo -e "${YELLOW}Not alle required Python modules could be installed!${NOCOLOR}" - read -r -p $'\e[1;37mWould you like to try it again [Y/n]? -> \e[0m' + read -r -p $'\e[1;93mWould you like to try it again [Y/n]? -> \e[0m' if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then sudo pip3 install -r requirements.failed @@ -1297,6 +1297,7 @@ echo -e "${RED}[+] Erasing big not usefull packages...${NOCOLOR}" (sudo rm -r get-pip.py) 2>/dev/null (sudo rm -r python-urwid*) 2>/dev/null # Find the bigest space waster packages: dpigs -H +sudo apt-get -y --purge remove exim4 exim4-base exim4-config exim4-daemon-light sudo apt-get -y remove libgl1-mesa-dri texlive* lmodern sudo apt-get -y clean sudo apt-get -y autoclean diff --git a/lib/torbox.lib b/lib/torbox.lib index 7a4d971c..5ad24858 100755 --- a/lib/torbox.lib +++ b/lib/torbox.lib @@ -113,55 +113,76 @@ check_interface_with_internet() # Used predefined function: check_interface_with_internet() settime() { - check_interface_with_internet - clear - sudo timedatectl set-timezone UTC - MANUAL=0 - if [ $CONNECTED == 1 ]; then - if curl -m 6 -s "https://www.ntp.org" >/dev/null; then - echo -e "${RED}[+] Set the correct time...${NOCOLOR}" - sudo /usr/sbin/ntpdate pool.ntp.org + echo -e "${YELLOW}[!] SYSTEM-TIME CHECK${NOCOLOR}" + echo -e "${RED}[!] Tor needs a correctly synchronized time.${NOCOLOR}" + echo -e "${RED} The system should display the current UTC time:${NOCOLOR}" + echo + echo -e " Date: ${YELLOW}$(date '+%Y-%m-%d')${NOCOLOR}" + $TORBOX_PATH/bin/clock.py + echo + echo -e "${RED} You can find the correct time here: ${YELLOW}https://time.is/UTC${NOCOLOR}" + echo + while true + do + read -r -p $'\e[1;31m Do you want to adjust the system time [Y/n]? -> \e[0m' + # The following line is for the prompt to appear on a new line. + if [[ $REPLY =~ ^[YyNn]$ ]] ; then + echo echo - echo -e "${RED}[+] Date and time set successfully!" - sleep 5 - clear + break + fi + done + if [[ $REPLY =~ ^[Yy]$ ]] ; then + check_interface_with_internet + clear + sudo timedatectl set-timezone UTC + MANUAL=0 + if [ $CONNECTED == 1 ]; then + if curl -m 6 -s "https://www.ntp.org" >/dev/null; then + echo -e "${RED}[+] Set the correct time...${NOCOLOR}" + sudo /usr/sbin/ntpdate pool.ntp.org + echo + echo -e "${RED}[+] Date and time set successfully!" + sleep 5 + clear + else + MANUAL=1 + fi else MANUAL=1 fi - else - MANUAL=1 - fi - if [ $MANUAL == 1 ]; then - echo -e "${YELLOW}[!] CANNOT SYNCHRONIZE DATE/TIME AUTOMATICALLY${NOCOLOR}" - echo "" - read -r -p $'\e[1;31mPlease enter the date (YYYY-MM-DD): \e[0m' DATESTRING - echo "" - echo -e "${RED}Please enter the UTC time (HH:MM)${NOCOLOR}" - read -r -p $'You can find the correct time here: https://time.is/UTC: ' TIMESTRING - # Check and set date - if [[ $DATESTRING =~ ^[1-2]{1}[0-9]{3}-[0-9]{2}-[0-9]{2}$ ]]; then + if [ $MANUAL == 1 ]; then + echo -e "${YELLOW}[!] CANNOT SYNCHRONIZE DATE/TIME AUTOMATICALLY${NOCOLOR}" echo "" - sudo date -s "$DATESTRING" - echo -e "${RED}[+] Date set successfully!${NOCOLOR}" - if [[ $TIMESTRING =~ ^[0-9]{2}:[0-9]{2}$ ]]; then + read -r -p $'\e[1;31mPlease enter the date (YYYY-MM-DD): \e[0m' DATESTRING + echo "" + echo -e "${RED}Please enter the UTC time (HH:MM)${NOCOLOR}" + read -r -p $'You can find the correct time here: https://time.is/UTC: ' TIMESTRING + # Check and set date + if [[ $DATESTRING =~ ^[1-2]{1}[0-9]{3}-[0-9]{2}-[0-9]{2}$ ]]; then echo "" - sudo date -s "$TIMESTRING" - echo -e "${RED}[+] Time set successfully!${NOCOLOR}" - sleep 5 - clear + sudo date -s "$DATESTRING" + echo -e "${RED}[+] Date set successfully!${NOCOLOR}" + if [[ $TIMESTRING =~ ^[0-9]{2}:[0-9]{2}$ ]]; then + echo "" + sudo date -s "$TIMESTRING" + echo -e "${RED}[+] Time set successfully!${NOCOLOR}" + sleep 5 + clear + else + echo "" + echo -e "${YELLOW}[!] INVALIDE TIME FORMAT!${NOCOLOR}" + echo "" + read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m' + clear + fi else echo "" - echo -e "${YELLOW}[!] INVALIDE TIME FORMAT!${NOCOLOR}" + echo -e "${YELLOW}[!] INVALIDE DATE FORMAT!${NOCOLOR}" echo "" read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m' clear fi - else - echo "" - echo -e "${YELLOW}[!] INVALIDE DATE FORMAT!${NOCOLOR}" - echo "" - read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m' - clear fi fi } @@ -340,6 +361,8 @@ erase_logs() sleep 1 done sudo journalctl --vacuum-size=1M + echo -e "${RED}[+]${NOCOLOR} Erasing nohup files" + find /home/torbox/ -name nohup -exec sudo rm {} \; echo -e "${RED}[+]${NOCOLOR} Erasing .bash_history" (sudo rm ../.bash_history) 2>/dev/null history -c @@ -484,7 +507,7 @@ connecting_to_VPN() echo "" echo -e "$menu_content" echo "" - read -r -p $'\e[1;37mWhich OpenVPN configuration (number) would you like to use? -> \e[0m' + read -r -p $'\e[1;93mWhich OpenVPN configuration (number) would you like to use? -> \e[0m' echo if [[ $REPLY =~ ^[1234567890]$ ]] ; then CHOICE_OVPN=$((REPLY-1)) diff --git a/menu-config b/menu-config index 77313430..da632383 100755 --- a/menu-config +++ b/menu-config @@ -128,9 +128,9 @@ change_crda() read_config() { # TOGGLE03 / TOGGLE04 represents the extent of logging - LOG_STATUS=$(sudo systemctl is-active rsyslog) - [ $LOG_STATUS = inactive ] && LOG_STATUS=$(sudo systemctl is-active systemd-journald.service) - if [ $LOG_STATUS = inactive ]; then + LOG_STATUS_001=$(sudo systemctl is-active rsyslog) + LOG_STATUS_002=$(sudo systemctl is-active systemd-journald.service) + if [[ $LOG_STATUS_001 = inactive && $LOG_STATUS_002 = inactive ]]; then TOGGLE03="LOW✔︎]===" TOGGLE03b="LOW" TOGGLE04="HIGH]===" @@ -177,9 +177,8 @@ read_config() fi # TOGGLE09 shows if TorBox's WLAN is disabled or not - LOG_STATUS="" - LOG_STATUS=$(sudo systemctl is-active hostapd) - if [ $LOG_STATUS = inactive ] || [ $LOG_STATUS = failed ] ; then + AP_STATUS=$(sudo systemctl is-active hostapd) + if [ $AP_STATUS = inactive ] || [ $AP_STATUS = failed ] ; then TOGGLE09="Enable" else TOGGLE09="Disable" @@ -1125,9 +1124,9 @@ case "$CHOICE" in #This changes the extent of the logging 18) if (whiptail --title "Changing the extent of logging ($TOGGLE03b -> $TOGGLE04b)" --defaultno --yes-button "High" --no-button "LOW" --yesno "\nWould you like to change the extend of logging?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3); then - LOG_STATUS=$(sudo systemctl is-active rsyslog) - [ $LOG_STATUS = inactive ] && LOG_STATUS=$(sudo systemctl is-active systemd-journald.service) - if [ $LOG_STATUS = inactive ]; then + LOG_STATUS_001=$(sudo systemctl is-active rsyslog) + LOG_STATUS_002=$(sudo systemctl is-active systemd-journald.service) + if [ "$LOG_STATUS_001" == "inactive" ] && [ "$LOG_STATUS_002" == "inactive" ]; then sudo systemctl unmask rsyslog sudo systemctl enable rsyslog sudo systemctl start rsyslog diff --git a/menu-update b/menu-update index 19ed251a..fec16f98 100755 --- a/menu-update +++ b/menu-update @@ -372,7 +372,7 @@ select_and_install_tor() echo -e "${RED}$menuitem${NOCOLOR} - ${torversion_versionsorted_new[$i]}" done echo "" - read -r -p $'\e[1;37mWhich tor version (number) would you like to use (0 = EXIT)? -> \e[0m' + read -r -p $'\e[1;93mWhich tor version (number) would you like to use (0 = EXIT)? -> \e[0m' echo if [[ $REPLY =~ ^[1234567890]$ ]]; then if [ $REPLY -gt 0 ] && [ $((REPLY-1)) -le $number_torversion ]; then @@ -784,7 +784,6 @@ case "$CHOICE" in # NEW v.0.5.3: New way to install and check Python requirements sudo pip3 install --upgrade -r requirements.txt sleep 5 - clear echo -e "${YELLOW}Following Python modules are installed:${NOCOLOR}" if [ -f requirements.failed ]; then rm requirements.failed; fi @@ -804,7 +803,7 @@ case "$CHOICE" in if [ -f requirements.failed ]; then echo "" echo -e "${YELLOW}Not alle required Python modules could be installed!${NOCOLOR}" - read -r -p $'\e[1;37mWould you like to try it again [Y/n]? -> \e[0m' + read -r -p $'\e[1;93mWould you like to try it again [Y/n]? -> \e[0m' if [[ $REPLY =~ ^[YyNn]$ ]] ; then if [ "$REPLY" == "Y" ] || [ "$REPLY" == "y" ]; then sudo pip3 install -r requirements.failed