Skip to content

Instantly share code, notes, and snippets.

@mh-firouzjah
Last active October 19, 2024 14:37
Show Gist options
  • Save mh-firouzjah/8b3ef681a337ff7b3432f15e05079bc1 to your computer and use it in GitHub Desktop.
Save mh-firouzjah/8b3ef681a337ff7b3432f15e05079bc1 to your computer and use it in GitHub Desktop.
Run Tor Using Bundle Package From Torproject

Run Tor Using Bundle Package From Torproject

In this short manual I'll explain how to use latest tor executable along with the clients for snowflake, webtunnel and conjure.

  1. Downloading the Latest Bundle Package:
    Visit Tor Project Download Page or directly use the command:

    wget https://archive.torproject.org/tor-package-archive/torbrowser/13.5.7/tor-expert-bundle-linux-x86_64-13.5.7.tar.gz
  2. Extract the File:
    For simplicity, we will assume extracting within ~/.local/opt/tor.

    mkdir -p ~/.local/opt/tor
    tar -xzf tor-expert-bundle-linux-x86_64-13.5.7.tar.gz -C ~/.local/opt/tor
  3. Generate Config File:
    This file is required to customize Tor behavior (e.g., adding bridges, forcing exit nodes, etc.).

    ~/.local/opt/tor/tor/tor --dump-config full > ~/.local/opt/tor/torrc
  4. Create the Directory for User Services:
    This is needed if it doesn’t already exist.

    mkdir -p ~/.config/systemd/user
  5. Create a New Service File:

    touch ~/.config/systemd/user/tor.service
  6. Add the Following Content to the Service File:
    Open the file in your preferred editor: nvim ~/.config/systemd/user/tor.service

    [Unit]
    Description=Tor Service
    After=network.target
    
    [Service]
    ExecStart=~/.local/opt/tor/tor/tor -f ~/.local/opt/tor/torrc
    Restart=always
    
    [Install]
    WantedBy=default.target
  7. Enable and Start the User Service To Start On Boot:

    systemctl --user enable --now tor.service
  8. Verify the service is running correctly:

    systemctl --user status tor.service
  9. Check logs related to the service:

    journalctl --user -u tor.service
  10. Optional - Custom Changes:
    To add custom changes to the Tor config, use the ~/.local/opt/tor/torrc file.

  11. Optional - Suppress Warnings:
    To disable warnings about deprecated configurations or missing values in the Tor logs, add a # at the beginning of those lines within the ~/.local/opt/tor/torrc file.

Notes

  • The client for obfs4proxy could be installed by the package manager of your choice; find its executable path using which obfs4proxy.
  • Since we're using a custom torrc to address the transparency clients, it's possible to use a relative path to that file. For example:
    ClientTransportPlugin webtunnel exec ~/.local/opt/tor/tor/pluggable_transports/webtunnel-client
    # Or relative path
    ClientTransportPlugin webtunnel exec ./tor/pluggable_transports/webtunnel-client

Create Webtunnel Client

The following manual explains how to build webtunnel-client from the source, this process rquires golang to be installed on your system.

  1. Downloading the Latest Bundle Package:
    Visit Tor Project Download Page or clone the repository:
    git clone https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel
  2. Compile the WebTunnel Client:
    cd webtunnel/main/client
    go build
  3. Add the WebTunnel Client:
    Place webtunnel-client in the pluggable_transports directory alongside the other bundled clients:
    cp ./client ~/.local/opt/tor/tor/pluggable_transports/webtunnel-client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment