Skip to content
lu4p edited this page Jun 13, 2019 · 63 revisions

On Linux.

You need to have golang installed

sudo apt install golang-go

Clone this repo via go get

go get -u github.com/lu4p/ToRat

Then run the Setup Script

cd ~go/src/github.com/lu4p/ToRat
./setup.sh

This will get and setup the following packages for you.

https://github.com/lu4p/ToRat_client

https://github.com/lu4p/ToRat_server

https://github.com/lu4p/genCert

Furthermore it will install tor and setup a hidden service and generate a TLS Certificate

Building

Server

On Linux.

To build the Server run

cd ~/go/src/github.com/lu4p/ToRat_server
go build

Client with embedded Tor

Client for Windows

On Windows.

Prerequesites

You can build the client on Windows by executing the following, it may also be useful to remove all log calls.

Build tor statically

To embed tor in the binary it is required to build tor statically this will take a while but is only required once.

set PATH=C:\msys64\usr\bin;%PATH%
set MSYSTEM=MINGW64
bash -lc "pacman -Sy --noconfirm --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git mingw-w64-i686-cmake mingw-w64-x86_64-cmake"
cd %HOMEPATH%\go\src\github.com\cretz\
git clone github.com/cretz/tor-static --recursive
bash -lc "export PATH=/mingw64/bin:$PATH && cd c/Users/Your_USERNAME_HERE/go/src/github.com/cretz/tor-static && /c/go/bin/go run build.go build-all"

IMPORTANT: change the username to your current username in the last command

Test the static tor Build

set PATH=C:\msys64\mingw64\bin;%PATH%
set MSYSTEM=MINGW64
go get -u github.com/cretz/bine/tor
cd %HOMEPATH%\go\src\github.com\cretz\tor-static
go test -v build_test.go -tor.verbose

Build client

set PATH=C:\msys64\usr\bin;%PATH%
set MSYSTEM=MINGW64
cd  %HOMEPATH%\go\src\github.com\lu4p\ToRat_client
go build --ldflags "-s -w -H windowsgui"

For testing the -H windowsgui flag should be omitted.


Client for Linux

On Linux.

sudo apt install build-essential libtool autopoint -y
cd ~/go/src/github.com/cretz/
git clone github.com/cretz/tor-static --recursive
cd ~/go/src/github.com/cretz/tor-static
go run build.go build-all
cd ~/go/src/github.com/lu4p/ToRat_client
go build -ldflags "-s -w"

Client for Mac OS

On Mac OS.

Prerequisites

  • Normal build tools (e.g. Xcode command line tools)
  • Libtool (e.g. brew install libtool)
  • Autoconf and Automake (e.g. brew install automake)
  • autopoint (can be found in gettext, e.g. brew install gettext)
    • Note, by default this is assumed to be at /usr/local/opt/gettext/bin. Use -autopoint-path to change it.

Build

go get -u github.com/cretz/tor-static
cd ~/go/src/github.com/cretz/tor-static
go run build.go build-all
cd ~/go/src/github.com/lu4p/ToRat_client
go build -ldflags "-s -w"

Client without Tor

On Linux.

Client for Linux

cd ~/go/src/github.com/lu4p/ToRat_client
env GOOS=linux go build -ldflags "-s -w" -tags "notor"

Client for Windows

cd ~/go/src/github.com/lu4p/ToRat_client
env GOOS=windows go build -ldflags "-s -w" -tags "notor"

Client for MacOS

cd ~/go/src/github.com/lu4p/ToRat_client
env GOOS=darwin go build -ldflags "-s -w" -tags "notor"

OLD before setup script

Setup Tor

On Linux.

Configure the Hidden Service

sudo tee -a /etc/tor/torrc <<EOF
HiddenServiceDir /var/lib/tor/torat/
HiddenServiceVersion 3
HiddenServicePort 1337 127.0.0.1:1338
EOF

To enable the Hidden Service tor needs to be restarted.

sudo systemctl restart tor

Now your Hidden Service is up and running. You will find the generated hostname in /var/lib/tor/torat/

sudo cat /var/lib/tor/torat/hostname

Generate and Setup cryptographic keys

ToRAT uses a TLS certificate to encrypt transport and a RSA Keypair to encrypt files saved on the clients disk.

Generate TLS certificate

On Linux.

cd ~/go/src/github.com/lu4p/genCert/
go run genCert.go --ca --host youronionadresshere.onion
cp *.pem ~/go/src/github.com/lu4p/ToRat_server
cat cert.pem

This will result in key.pem and cert.pem. You need to change the cert in the serverCert var in ~/go/src/github.com/lu4p/ToRat_client/client/conf.go to the content of cert.pem.

Clone this wiki locally
You can’t perform that action at this time.