If you think you want to set up your own tor server and the public service doesn't meet your needs, this tutorial can help.
You can get VPS with cryptocurrency from one of these companies.You must rent a VPS with 1 core CPU and 512 Mbyte of RAM minimum and install a linux distro on it.
Login to your VPS with root access.Then update your repositories and packages.
apt update
apt upgrade
Then install these two packages.
apt install tor obfs4proxy
Now we must config tor.Open /etc/tor/torrc
and write these.For explanation, look at the table.
BridgeRelay 1
AssumeReachable 1
ORPort 7755
BridgeDistribution none
PublishServerDescriptor 0
ExitPolicy reject *:*
ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy
ServerTransportListenAddr obfs4 0.0.0.0:7233
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
ExtORPort auto
ContactInfo youremail@gmail.com
Nickname MyBridge
Variale | Value | Required |
---|---|---|
ORPort | You can set anything you want | ☑ |
PublishServerDescriptor | If you want to publish your bridge in tor network, set this 1 | ☑ |
ServerTransportListenAddr | You need to set the obfs4 port in this.leave ip to localhost.We use this port after | ☑ |
ContactInfo | Your email address | ☒ |
Nickname | A name for your bridge | ☒ |
systemctl restart tor@default.service
You can monitor your tor service with this command.You must see Bootstrapped 100% (done): Done
after a while.
journalctl -e -u tor@default.service
Now, you must get your bridge information.You can see the fingerprint in the command above.pay attention, we don't use the hashes.your fingerprint is something like this:
K3KLGK44LKKJKLN54LLKD649FE491FF9BA6EA5F9
Then open /var/lib/tor/pt_state/obfs4_bridgeline.txt
.In this file you can see your bridge that you must replace your vps information in the variables in your client.Don't change anything in this file on your server.
Write this information down.
We done with the server.
In your client system install these packages too.
apt install tor obfs4proxy
open /etc/tor/torrc
file and enter it.
UseBridges 1
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
Bridge obfs4 <server ip>:<server obfs4 port> <fingerprint> cert=<cert>
HTTPTunnelPort 4211
SocksPort 9123
For example:
UseBridges 1
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
Bridge obfs4 157.211.202.160:7233 07784768F54CF66F9D588E19E8EE3B0FA702711B cert=m3jPGnUyZMWHT9Riioob95s1czvGs3HiZ64GIT3QbH/AZDVlF/YEXu/OtyYZ1eObKnTjcg iat-mode=0
HTTPTunnelPort 4211
SocksPort 9123
Save the file and restart your tor service.
systemctl restart tor@default.service
If you connected successfully, you can see Bootstrapped 100% (done): Done
in journalctl -e -u tor@default.service
command.
You can skip the whole your client system traffic from tor. In other words, you can use tor as a VPN.For this you must set HTTPTunnelPort
and SocksPort
in your system settings like this in gnome.You can find these ports in client config.
You can use proxychains4
too.First install it.
apt install proxychains4
Then config it.
sed -i -E 's|^socks[0–9]?.*|socks5 127.0.0.1 <SocksPort>|' /etc/proxychains4.conf
Replace <SocksPort>
with your client SocksPort in etc/tor/torrc
file, in my example, SocksPort is 9123
.
Finally you can use it easily.
proxychains4 apt update
or
proxychains4 firefox
If you live in a country where you were unable to connect in the previous step due to censorship, there is a solution for you.You can use ssh local port forwarding over the tor.
We create a local port with ssh, for example 8080
, then we tunnel this port to server obfs4 port.After that, we config client tor to connect to ssh local port.
For this, first enter this command.
ssh -L 8080:127.0.0.1:7233 <vps user>@<vps ip>
Then you must enter your vps password.Pay attention, 8080
is your ssh local port and 7233
is your vps obfs4 port.
Now config your client bridge in /etc/tor/torrc
to connect to your ssh port.
UseBridges 1
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
Bridge obfs4 127.0.0.1:8080 <fingerprint> cert=<cert>
HTTPTunnelPort 4211
SocksPort 9123
Great, you connected successfully.Welcome to freedom.
For #Iran, For #woman_life_freedom