Kali linux, Tor privoxy를 통한 모든 트래픽, 시간/시간대

Kali linux, Tor privoxy를 통한 모든 트래픽, 시간/시간대

Privoxy는 Tor에 대한 http/https 트래픽과 양말을 익명화하는 데 사용됩니다. 따라서 내 질문은 다음과 같습니다. 모든 트래픽(ftp, 양말, http에 관계없이)을 privoxy로 보낸 다음 이를 Tor로 보낼 수 있습니까? 익명 설정이 될까요? 나는 8118에서 수신 대기하고 9050(tor 포트 및 모두 127.0.0.1)으로 가는 Linux privoxy를 가지고 있습니다. 또한 익명인 경우 이 설정을 통해 모든 시스템 트래픽을 어떻게 전달할 수 있습니까? + 프록시체인(http 8118 포트를 프록시로 사용하고 앞서 말한 대로 privoxy를 구성하도록 구성됨)을 통해 연결할 때 광고를 숨기지 않는 이유는 무엇입니까? 반면 privoxy를 통해서만 연결하면 광고가 잘 숨겨집니다. 또한 시스템 시간대와 실시간이 신원을 유출할 수 있다고 들었습니다. 예를 들어 tails os에서는 토르 브라우저를 시작할 때마다 변경됩니다. 이와 같은 쉘 스크립트를 작성한 사람이 있습니까?

답변1

예, 모든 트래픽을 Tor를 통해 전달하는 것이 매우 가능합니다. 이는 투명 프록시를 사용하여 수행할 수 있습니다. 자세한 내용은 Tor 설명서의 다음 페이지를 참조하세요.https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy

투명 프록시를 구현하려면 iptables를 수정하기만 하면 됩니다.

오래 전에 나는 이 프로세스를 자동화하기 위해 쉘 스크립트를 작성했습니다. 여전히 잘 작동할 것입니다. tor 사용자의 uid와 tor의 포트를 수정하면 작동되어 실행됩니다. 이 스크립트의 목적은 Tor 프록시를 전환하는 것입니다. 스크립트는 다음과 같습니다.

#!/bin/bash
#This script switches on/off the tranparent tor proxy

###############################
#### Function Definitions #####
###############################

#This function resets iptables to their default state
reset_iptables () {
  IPTABLES="$(which iptables)"

  # RESET DEFAULT POLICIES
  $IPTABLES -P INPUT ACCEPT
  $IPTABLES -P FORWARD ACCEPT
  $IPTABLES -P OUTPUT ACCEPT
  $IPTABLES -t nat -P PREROUTING ACCEPT
  $IPTABLES -t nat -P POSTROUTING ACCEPT
  $IPTABLES -t nat -P OUTPUT ACCEPT
  $IPTABLES -t mangle -P PREROUTING ACCEPT
  $IPTABLES -t mangle -P OUTPUT ACCEPT

  # FLUSH ALL RULES, ERASE NON-DEFAULT CHAINS
  $IPTABLES -F
  $IPTABLES -X
  $IPTABLES -t nat -F
  $IPTABLES -t nat -X
  $IPTABLES -t mangle -F
  $IPTABLES -t mangle -X
}

#This function modifies iptables so that they are compatible with the transparent tor proxy
tor_iptables () {
  ### set variables
  #destinations you don't want routed through Tor
  _non_tor="192.168.1.0/24 192.168.0.0/24"

  #the UID that Tor runs as (varies from system to system)
  _tor_uid="120"

  #Tor's TransPort
  _trans_port="9040"

  ### flush iptables
  iptables -F
  iptables -t nat -F

  ### set iptables *nat
  iptables -t nat -A OUTPUT -m owner --uid-owner $_tor_uid -j RETURN
  iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 53

  #allow clearnet access for hosts in $_non_tor
  for _clearnet in $_non_tor 127.0.0.0/9 127.128.0.0/10; do
     iptables -t nat -A OUTPUT -d $_clearnet -j RETURN
  done

  #redirect all other output to Tor's TransPort
  iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports $_trans_port

  ### set iptables *filter
  iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

  #allow clearnet access for hosts in $_non_tor
  for _clearnet in $_non_tor 127.0.0.0/8; do
     iptables -A OUTPUT -d $_clearnet -j ACCEPT
  done

  #allow only Tor output
  iptables -A OUTPUT -m owner --uid-owner $_tor_uid -j ACCEPT
  iptables -A OUTPUT -j REJECT
}


############################
#### Main Script Starts ####
############################

if [ "$(cat /etc/resolv.conf | grep 127.0.1.1)" ]
then
  echo "Tor transparent proxy is NOT running. It will be now switched ON."
  sed -i 's/127\.0\.1\.1/127\.0\.0\.1/g' /etc/resolv.conf # Replacing 127.0.1.1 with 127.0.0.1
  tor_iptables 
else
  echo "Tor transparent proxy is ALREADY running. Let us switch it OFF."
  sed -i 's/127\.0\.0\.1/127\.0\.1\.1/g' /etc/resolv.conf # Replacing 127.0.0.1 with 127.0.1.1
  reset_iptables
fi

관련 정보