Try to fix TOR for older devices (#154)

This commit is contained in:
CaliBrain
2025-04-21 12:12:50 -04:00
committed by GitHub
parent 2b32c1cb95
commit 88a95fe15e
+13 -16
View File
@@ -32,14 +32,24 @@ EOF
echo "[*] Starting Tor..."
service tor start
# Wait a bit to ensure Tor has bootstrapped
echo "[*] Waiting for Tor to finish bootstrapping... (up to 5 minutes)"
timeout 300 bash -c '
while ! grep -q "Bootstrapped 100%" <(tail -n 20 -F /var/log/tor/notices.log 2>/dev/null); do
printf "\r\033[KCurrent log: %s" "$(tail -n 1 /var/log/tor/notices.log 2>/dev/null)"
sleep 1
done
# Print a newline when finished.
echo ""
'
echo "[✓] Tor is ready."
echo "[*] Setting up iptables rules..."
iptables -F
iptables -t nat -F
# Don't redirect Tor's own traffic
iptables -t nat -A OUTPUT -m owner --uid-owner debian-tor -j RETURN
# Allow loopback
iptables -t nat -A OUTPUT -o lo -j RETURN
@@ -55,19 +65,6 @@ iptables -t nat -A OUTPUT -p tcp --dport 53 ! -d 127.0.0.1 -j DNAT --to-destinat
echo "[✓] Transparent Tor routing enabled."
# Wait a bit to ensure Tor has bootstrapped
echo "[*] Waiting for Tor to finish bootstrapping... (up to 5 minutes)"
timeout 300 bash -c '
while ! grep -q "Bootstrapped 100%" <(tail -n 20 -F /var/log/tor/notices.log 2>/dev/null); do
printf "\r\033[KCurrent log: %s" "$(tail -n 1 /var/log/tor/notices.log 2>/dev/null)"
sleep 1
done
# Print a newline when finished.
echo ""
'
echo "[✓] Tor is ready."
sleep 5
# Check if outgoing IP is using Tor
echo "[*] Verifying Tor connectivity..."