-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9339b21
commit 701745e
Showing
7 changed files
with
91 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from .base_service import BaseService | ||
|
||
DOCKERFILE = "Dockerfile_tor_relay" | ||
|
||
|
||
class TorRelay(BaseService): | ||
def __init__(self, docker_network, templates): | ||
super().__init__(docker_network) | ||
self.templates = templates | ||
self.service = { | ||
"build": { | ||
"context": str(self.templates), | ||
"dockerfile": DOCKERFILE, | ||
}, | ||
"networks": [ self.docker_network ], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM debian:bookworm-slim | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y tor iproute2 gosu | ||
|
||
RUN mkdir -p /home/debian-tor/.tor/keys | ||
RUN chown -R debian-tor:debian-tor /home/debian-tor | ||
RUN mkdir -p /var/log/tor | ||
RUN chown -R debian-tor:debian-tor /var/log/tor | ||
|
||
COPY torrc.relay /etc/tor/torrc | ||
|
||
EXPOSE 9050 | ||
|
||
COPY tor-entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT /entrypoint.sh | ||
CMD ["tor", "-f", "/etc/tor/torrc"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Address $(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)" >> /etc/tor/torrc | ||
# mkdir -p /home/debian-tor/.tor/keys | ||
# chown -R debian-tor:debian-tor /home/debian-tor | ||
gosu debian-tor tor -f /etc/tor/torrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ Log err stdout | |
DataDirectory /home/debian-tor/.tor | ||
RunAsDaemon 0 | ||
ControlPort 9051 | ||
ORPort 9001 IPv4Only | ||
CookieAuthentication 1 | ||
CookieAuthFileGroupReadable 1 | ||
DataDirectoryGroupReadable 1 | ||
|
@@ -15,36 +16,26 @@ ClientUseIPv4 1 | |
# Relay | ||
DirAuthority orport=9001 no-v2 v3ident=15E09A6BE3619593076D8324A2E1DBEEAD4539CD 100.20.15.18:9030 03E942A4F12D85B2CF7CBA4E910F321AE98EC233 | ||
AssumeReachable 1 | ||
PathsNeededToBuildCircuits 0.25 | ||
TestingDirAuthVoteExit * | ||
TestingDirAuthVoteHSDir * | ||
V3AuthNIntervalsValid 2 | ||
|
||
# Directory Authority | ||
DirPort 9030 IPv4Only | ||
AuthoritativeDirectory 1 | ||
V3AuthoritativeDirectory 1 | ||
PathsNeededToBuildCircuits 0.25 | ||
TestingDirAuthVoteExit * | ||
TestingDirAuthVoteHSDir * | ||
V3AuthNIntervalsValid 2 | ||
ContactInfo [email protected] | ||
ORPort 9001 IPv4Only | ||
DirPort 9030 IPv4Only | ||
|
||
|
||
# Reduce resource usage | ||
MaxMemInQueues 64 Mbytes | ||
MaxMemInQueues 200 Mbytes | ||
BridgeRecordUsageByCountry 0 | ||
DirReqStatistics 0 | ||
ExtraInfoStatistics 0 | ||
HiddenServiceStatistics 0 | ||
OverloadStatistics 0 | ||
PaddingStatistics 0 | ||
BandwidthBurst 10 Mbytes | ||
BandwidthRate 10 Mbytes | ||
ConstrainedSockets 1 | ||
ConstrainedSockSize 8192 Bytes | ||
|
||
DoSCircuitCreationEnabled 0 | ||
DoSCircuitCreationDefenseType 1 | ||
|
||
TestingV3AuthInitialDistDelay 30 seconds | ||
TestingV3AuthInitialVotingInterval 60 seconds | ||
|
||
Address 100.20.15.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Common | ||
Log err stdout | ||
DataDirectory /home/debian-tor/.tor | ||
RunAsDaemon 0 | ||
ControlPort 9051 | ||
CookieAuthentication 1 | ||
CookieAuthFileGroupReadable 1 | ||
DataDirectoryGroupReadable 1 | ||
ORPort 9001 | ||
ExitPolicy accept *:* | ||
TestingTorNetwork 1 | ||
ClientUseIPv6 0 | ||
ClientUseIPv4 1 | ||
|
||
# Relay | ||
DirAuthority orport=9001 no-v2 v3ident=15E09A6BE3619593076D8324A2E1DBEEAD4539CD 100.20.15.18:9030 03E942A4F12D85B2CF7CBA4E910F321AE98EC233 | ||
AssumeReachable 1 | ||
PathsNeededToBuildCircuits 0.25 | ||
TestingDirAuthVoteExit * | ||
TestingDirAuthVoteHSDir * | ||
V3AuthNIntervalsValid 2 | ||
|
||
# Reduce resource usage | ||
MaxMemInQueues 64 Mbytes | ||
BridgeRecordUsageByCountry 0 | ||
DirReqStatistics 0 | ||
ExtraInfoStatistics 0 | ||
HiddenServiceStatistics 0 | ||
OverloadStatistics 0 | ||
PaddingStatistics 0 | ||
ConstrainedSockets 1 | ||
ConstrainedSockSize 8192 Bytes | ||
# NumEntryGuards 1 | ||
# NumDirectoryGuards 1 | ||
# UseMicrodescriptors 1 | ||
|
||
# `Address <w.x.y.z>` will be added by tor-entrypoint.sh |