mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-04 09:31:13 +01:00
Try to fix TOR for older devices (#154)
This commit is contained in:
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user