Skip to content

Instantly share code, notes, and snippets.

@rraallvv
Last active May 15, 2018 20:09
Show Gist options
  • Save rraallvv/8aa9879c7df95bff285b4c2fa7041ccd to your computer and use it in GitHub Desktop.
Save rraallvv/8aa9879c7df95bff285b4c2fa7041ccd to your computer and use it in GitHub Desktop.

None of these answers give a full useable workflow, I want to git push, not send an email! Here's how to do it properly but there's a bit of setup required. Instructions are for OSX

#Publishing anonymously to github with tor+ssh

  1. Download tor browser bundle AND the tor command line proxy

     brew install tor
     brew cask install torbrowser
    

1.1 In tor browser, Create a new email address ( I used hmamail).

1.2 In tor browser, Create a new github account

  1. Create a new ssh key, only for tor with your new email address

    ssh-keygen -t rsa -b 4096 -C "[email protected]"
    

2.1. Give it a name like: ~/.ssh/private_tor_rsa

2.2. In github, go to SSH and PGP keys and add a new SSH key, make title memorable.

2.3. In github, set Key to the public key you've just createdclip < ~/.ssh/private_tor_rsa.pub

  1. In github, create an empty repository, let's call it ByteCoin, don't initialise it with a readme.

  2. Edit the ssh config file ~/.ssh/config (create if it doesn't exist)

    Host github-tor-alias User git HostName github.com IdentitiesOnly yes IdentityFile ~/.ssh/tor_only_rsa ProxyCommand nc -X 5 -x 127.0.0.1:9050 %h %p

You've created a hostname called github-tor-alias and tells ssh to use a proxy on localhost:9050 and use the tor_only_rsa key to authenticate.

  1. Setup the config for your new project to use the tor proxy and credentials.

    mkdir secret-project
    cd secret-project
    git init
    
    git config --add user.name satoshi_2
    git config --add user.email [email protected]
    

This next line is bloody important

5.1. note the ssh://git and github-tor-alias

    git remote add origin ssh://git@github-tor-alias/staoshi_2/ByteCoin.git
  1. Remember how you installed the tor command line proxy? start it as a service. It listens on localhost:9050

    brew services start tor
    
  2. Are you ready? Try pushing to github:

    git push origin master
    

Did it work? Go and double check everything, have I missed something? please edit this answer!

Congratulations

breath that free air and get creating!

So what have we just done? we've created a new identity who is associated only with the tor network, as far as github.com is concerned, you are staoshi_2 and could be anywhere in the world.

tor runs a proxy on 127.0.0.1:9050, because we setup a ProxyCommand in the ~/.ssh/config file, all of your traffic goes through the tor proxy, git uses your new ssh key because you added IdentityFile and IdentitiesOnly to your ~/.ssh/config file.

Powerful stuff.

Let's double check that you're really anonymous

  1. stop tor and try to git push again, it had better fail!

    ssh_exchange_identification: Connection closed by remote host
    fatal: Could not read from remote repository.
    

8.1. If that git push succeeded well guess what, you weren't using tor, github.com knows your IP, figure out how to get it working and then start again with a new email address.

9. Happy freedom!

anon.

Source: https://stackoverflow.com/a/37100346/1436359

@rraallvv
Copy link
Author

rraallvv commented May 15, 2018

Try this if for some reason those settings in ~/.ssh/config doesn't work:

Host github
    HostName github.com
    IdentityFile /path/to/your/file
    User git
    ProxyCommand socat STDIO SOCKS4A:127.0.0.1:%h:%p,socksport=9050

Source: https://stackoverflow.com/a/27343179/1436359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment