Skip to content

Commit

Permalink
Improved prepare_image.sh // exim4 removed
Browse files Browse the repository at this point in the history
  • Loading branch information
radio24 committed Mar 30, 2024
1 parent 44f8218 commit 42bcf9c
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 129 deletions.
4 changes: 2 additions & 2 deletions bin/find_domains
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 1 addition & 23 deletions bin/first_use
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bin/hostapd_fallback
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions bin/hostapd_fallback_komplex_part_1
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion bin/restore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions bin/set_interfaces_2
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions etc/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions install/openvpn-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand All @@ -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)
Expand Down
111 changes: 81 additions & 30 deletions install/prepare_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ GREEN='\033[1;32m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

# Other variables
TORBOX_PATH="/home/torbox/torbox"

##############################
######## FUNCTIONS ###########

Expand Down Expand Up @@ -110,53 +113,84 @@ 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}"
echo -e "${RED}Bridges :$MODE_BRIDGES${NOCOLOR}"
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}"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions install/run_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions install/run_install_mini.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions install/run_install_on_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 42bcf9c

Please sign in to comment.