Limour

Limour

临床医学在读。

【記錄】Warp 與 Tor 共存

註冊 Zero Trust#

  1. 訪問 CF Zero Trust, 按網上教程註冊
  2. 開啟 GitHub Authentication: Setting - Authentication - Login methods - Add new
  3. 添加 Device enrollment: Setting - WARP Client - Device enrollment permissions - Manage - Add a rule
  4. Selector 選 Emails; Value 填 GitHub 的郵箱
  5. 訪問 Warp-go, 按教程 WARP Teams 獲取並用於 Linux 的方法 獲取 warp-account.conf
  6. 訪問 https://your-team-name.cloudflareaccess.com/warp 審查元素也可獲取 authtoken
  7. 記錄 warp-account.conf 文件中的 ["account"]["private_key"] 和 ["config"]["peers"]["public_key"]
  8. 運行 bash api.sh -i -f ./warp-account.conf 獲取 reserved

部署 Tor#

mkdir -p ~/app/tor && cd ~/app/tor && nano Dockerfile && nano docker-compose.yml
echo 'SocksPort 0.0.0.0:9050' > torrc
docker build -t limour/tor .
docker image ls | grep limour/tor
sudo docker network create sswitch
sudo docker-compose up -d && sudo docker-compose logs
docker run --rm --net=sswitch alpine/curl --socks5-hostname "tor:9050" "https://check.torproject.org/api/ip"
# set alpine as the base image of the Dockerfile
FROM alpine:latest
 
# update the package repository and install Tor
RUN apk update && apk --no-cache add tor
 
# Copy over the torrc created above and set the owner to `tor`
COPY torrc /etc/tor/torrc
RUN chown -R tor /etc/tor
 
# Set `tor` as the default user during the container runtime
USER tor
 
# Set `tor` as the entrypoint for the image
ENTRYPOINT ["tor"]
 
# Set the default container command
# This can be overridden later when running a container
CMD ["-f", "/etc/tor/torrc"]
version: '3.3'
services:
    tor:
        restart: always
        image: limour/tor
    
networks:
  default:
    external: true
    name: sswitch

部署 Warp#

mkdir -p ~/app/socks5 && cd ~/app/socks5 && nano docker-compose.yml
mkdir ./config
nano ./config/config.json
wget https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db -O config/geoip.db 
wget https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db -O config/geosite.db 
sudo docker-compose up -d && sudo docker-compose logs
{
  "log": {
    "level": "info"
  },
  "inbounds": [
    {
      "type": "socks",
      "tag": "socks-in",
      "listen": "::",
      "listen_port": 5353,
      "tcp_fast_open": false,
      "udp_fragment": true,
      "sniff": true,
      "sniff_override_destination": false,
      "sniff_timeout": "300ms",
      "udp_timeout": 300,
      "proxy_protocol": false,
      "proxy_protocol_accept_no_header": false
    }
  ],
  "outbounds": [
    {
      "type": "direct"
    },
    {
      "type": "wireguard",
      "tag": "wireguard",
      "server": "engage.cloudflareclient.com",
      "server_port": 2408,
      "local_address": ["10.0.0.2/32"],
      "private_key": "記錄的private_key",
      "peer_public_key": "記錄的public_key",
	  "reserved": [0, 0, 0] // 記錄的reserved值
    },
    {
      "type": "socks",
      "tag": "tor",
      "server": "tor",
      "server_port": 9050
    }
  ],
  "route": {
    "rules": [
      {
        "domain_suffix": [".onion"],
        "outbound": "tor"
      },
      {
        "domain_suffix": ["openai.com"],
        "outbound": "wireguard"
      },
      {
        "domain_suffix": [".cn"],
        "outbound": "wireguard"
      },
      {
        "domain_suffix": ["check.torproject.org"],
        "outbound": "tor"
      },
      {
        "domain_suffix": ["myip.ipip.net"],
        "outbound": "wireguard"
      },
      {
        "geoip": ["cn"],
        "outbound": "wireguard"
      },
      {
        "geosite": ["cn"],
        "outbound": "wireguard"
      },
      {
        "domain_keyword": ["bing","microsoft"],
        "outbound": "wireguard"
      }
    ]
  }
}
version: '3.3'
services:
    socks5:
        restart: always
        volumes:
            - './config/:/etc/sing-box/'
        image: gzxhwq/sing-box:git
    
networks:
  default:
    external: true
    name: sswitch

測試 Warp 和 Tor#

docker run --rm --net=sswitch alpine/curl --socks5-hostname socks5:5353 https://myip.ipip.net
docker run --rm --net=sswitch alpine/curl --socks5-hostname socks5:5353 https://api.ipify.org/?format=json
docker run --rm --net=sswitch alpine/curl --socks5-hostname "socks5:5353" "https://check.torproject.org/api/ip"
docker run --rm --net=sswitch alpine/curl --socks5-hostname "socks5:5353" "https://www.nytimesn7cgmftshazwhfgzm37qxb44r64ytbb2dj3x62d2lljsciiyd.onion"
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。