Skip to content

Commit 21038d8

Browse files
committed
Update and enable Bridge functions.
1 parent bb6028d commit 21038d8

File tree

4 files changed

+86
-13
lines changed

4 files changed

+86
-13
lines changed

Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
FROM debian:stable-slim
22

33
LABEL maintainer="FoRTu" \
4-
maintainer.website="https://github.com/FoRTu"
4+
maintainer.ebail="me@fortu.io" \
5+
maintainer.website="https://github.com/FoRTu/docker-tor-relay"
56

6-
# Install Updates + tor + tor-arm:
7+
# Install Updates + tor + tor-arm + obfs4proxy + curl:
78
RUN apt update && \
89
apt upgrade -y && \
9-
apt -y install tor tor-arm && \
10+
apt -y install tor tor-arm obfs4proxy curl && \
1011
apt-get -y autoclean && \
1112
apt-get -y autoremove && \
1213
apt-get -y purge --auto-remove && \
@@ -19,7 +20,11 @@ rm -rf \
1920
/var/lib/apt/lists/* \
2021
/usr/share/doc/*
2122

22-
EXPOSE 9001 9030 9050
23+
EXPOSE 9001 9030 9050 8024
24+
25+
# Add launcher.sh
26+
ADD launcher.sh /launcher.sh
27+
RUN ["chmod", "+x", "/launcher.sh"]
2328

2429
# Command to run on container startup
25-
CMD ["tor", "-f", "/etc/tor/torrc"]
30+
CMD ["/launcher.sh"]

README.md

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
11
# Docker Tor-Relay
2-
An Docker image of a Tor-Relay based on the latest stable-slim Debian image.
32

4-
You can build it by [Dockerfile](https://github.com/FoRTu/docker-tor-relay/blob/master/Dockerfile) or just download from Docker Hub [https://hub.docker.com/r/fortu/tor-relay](https://hub.docker.com/r/fortu/tor-relay).
3+
Docker image based on the latest stable-slim Debian image to run a Tor relay.
54

6-
I created it for being used on [unRAID](https://unraid.net/) systems, but you know, Docker can be run on any GNU/Linux.
5+
You can build the image by the [Dockerfile](https://github.com/FoRTu/docker-tor-relay/blob/master/Dockerfile) or just download it from Docker Hub:
76

8-
Here you are a [torrc](https://github.com/FoRTu/docker-tor-relay/blob/master/torrc) configuration file for the Tor-Relay. You can be used as a template as it is fully functional.
7+
* [https://hub.docker.com/r/fortu/tor-relay](https://hub.docker.com/r/fortu/tor-relay)
8+
9+
In this repository you will find a template of the requested [`torrc`](https://github.com/FoRTu/docker-tor-relay/blob/master/torrc) configuration file to run `tor`. You can use it as a template or just use as it is. Because is totally functional, but I recommend to customize to make it unique and yours.
10+
11+
## How to create a container from this image
12+
13+
Easy, just run the command below by changing the `torrc` configuration file path:
14+
15+
```bash
16+
docker run --name='tor-relay' \
17+
-p '9001:9001/tcp' \
18+
-p '9030:9030/tcp' \
19+
-p '9050:9050/tcp' \
20+
-p '8024:8024/tcp' \
21+
-v '[PATH OF torrc FILE]':'/etc/tor/':'rw' \
22+
'fortu/tor-relay'
23+
```
24+
25+
The launcher inside the container will check if the required `torrc` file exist. This file is necessary to run `tor`. If it doesn't, a template will be download from this git repository. The template itself is totally functional, so in case of run the container for the first time or the `torrc` file doesn't exist because has been deleted, it will be downloaded automatically.
26+
27+
I highly recommend to customize the `torrc` file with you info to make it unique.
28+
29+
Be aware that if you are behind a NAT or Firewall you have to open this TCP ports:
30+
31+
* 9091/TCP
32+
* 9030/TCP
33+
* 8024/TCP
34+
35+
Let's make Internet more anonymous!

launcher.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
ERROR='\033[0;31m'
4+
WARNING='\033[0;33m'
5+
GREEN='\033[0;32m'
6+
MAGENTA='\033[0;35m'
7+
NC='\033[0m' # No Color
8+
9+
echo -e "\n${MAGENTA}===============================${NC}"
10+
echo -e "${MAGENTA} TOR: RELAY + BRIDGE ${NC}"
11+
echo -e "${MAGENTA}===============================${NC}\n"
12+
echo -e " · ${WARNING}Checking if required files exists...${NC}"
13+
if [ ! -f "/etc/tor/torrc" ]; then
14+
echo -e " · ${ERROR}Configuration 'torrc' file not found!${NC}"
15+
echo " · Downloading template 'torrc' file..."
16+
curl --silent --output "/etc/tor/torrc" \
17+
"https://raw.githubusercontent.com/FoRTu/docker-tor-relay/master/torrc"
18+
if [ -f "/etc/tor/torrc" ]; then
19+
echo -e " · Configuration 'torrc' file has been downloaded. ${WARNING} Please customize the file with your info.${NC} "
20+
echo -e " · ${WARNING}If something in the 'torrc' file isn't right, please open a new issue on https://github.com/FoRTu/docker-tor-relay please.${NC}"
21+
else
22+
echo -e " · ${ERROR}Something was wrong downloading the 'torrc' configuration file.${NC}"
23+
echo -e " · ${ERROR}Go to https://github.com/FoRTu/docker-tor-relay and download by yourself.${NC}"
24+
echo -e " · ${WARNING}If something in the 'torrc' file isn't right, please open a new issue on https://github.com/FoRTu/docker-tor-relay please.${NC}"
25+
exit 1
26+
fi
27+
else
28+
echo -e " · ${GREEN}Everything is right, '/etc/tor/torrc' file exist${NC}"
29+
fi
30+
31+
# Launch tor
32+
echo -e "\n\n · ${GREEN}Launching TOR (Relay + Bridge)...${NC}\n"
33+
tor -f "/etc/tor/torrc"
34+

torrc

+11-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@ SocksPort 0.0.0.0:9050
1717
Controlport 9051
1818
CookieAuthentication 1
1919

20-
# Run as a relay only (change policy to enable exit node)
21-
ExitPolicy reject *:* # no exits allowed
20+
# No exits allowed
21+
ExitPolicy reject *:*
2222
ExitPolicy reject6 *:*
23-
ExitRelay 0
2423
IPv6Exit 0
2524

25+
# Run as a relay and bridge
26+
ExitRelay 0
27+
BridgeRelay 1
28+
ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy
29+
ServerTransportListenAddr obfs4 0.0.0.0:8024
30+
2631
# Set some limits
2732

2833
# Limits the max number of bytes sent and received
@@ -32,7 +37,9 @@ IPv6Exit 0
3237
#AccountingStart day 00:00
3338

3439
# Limits the average incoming and outgoing bandwidth
35-
RelayBandwidthRate 768 KB # Throttle traffic to
40+
# Throttle traffic to
41+
42+
RelayBandwidthRate 768 KB
3643

3744
# Limit the maximum token bucket size (also known as the burst)
3845
RelayBandwidthBurst 1024 KB

0 commit comments

Comments
 (0)