mirror of
https://github.com/oldnick85/tor_yggdrasil_docker.git
synced 2025-11-29 03:13:44 +01:00
initial commit
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
ARG UBUNTU_VERSION=24.04
|
||||||
|
|
||||||
|
FROM ubuntu:${UBUNTU_VERSION} as builder_yggdrasil
|
||||||
|
ARG YGGDRASIL_VERSION=v0.5.6
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get -y upgrade
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive\
|
||||||
|
apt-get install -y git golang
|
||||||
|
WORKDIR /BUILD_YGGDRASIL/
|
||||||
|
RUN git clone --depth 1 --branch $YGGDRASIL_VERSION https://github.com/yggdrasil-network/yggdrasil-go.git
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
WORKDIR /BUILD_YGGDRASIL/yggdrasil-go
|
||||||
|
# add genkeys to build
|
||||||
|
RUN sed -i -e 's/yggdrasil yggdrasilctl/yggdrasil yggdrasilctl genkeys/g' build
|
||||||
|
RUN ./build
|
||||||
|
|
||||||
|
FROM ubuntu:${UBUNTU_VERSION}
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get -y upgrade
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive\
|
||||||
|
apt-get install -y --fix-missing\
|
||||||
|
tor obfs4proxy\
|
||||||
|
git python3 python3-pip iputils-ping
|
||||||
|
# ==== UTILS ====
|
||||||
|
WORKDIR /UTILS/
|
||||||
|
RUN git config --global advice.detachedHead false
|
||||||
|
# script to get strong yggdrasil address (https://yggdrasil-network.github.io/configuration.html#generating-stronger-addresses-and-prefixes)
|
||||||
|
RUN git clone --depth 1 --branch v0 https://github.com/oldnick85/yggdrasil_get_keys.git /UTILS/yggdrasil_get_keys
|
||||||
|
RUN python3 -m pip install --break-system-packages -r /UTILS/yggdrasil_get_keys/requirements.txt
|
||||||
|
# script to find yggdrasil public peers
|
||||||
|
RUN git clone --depth 1 --branch v4 https://github.com/oldnick85/yggdrasil_find_public_peers.git /UTILS/yggdrasil_find_public_peers
|
||||||
|
RUN python3 -m pip install --break-system-packages -r /UTILS/yggdrasil_find_public_peers/requirements.txt
|
||||||
|
# save peers to use in case of unavailable repository
|
||||||
|
RUN python3 /UTILS/yggdrasil_find_public_peers/yggdrasil_find_public_peers.py \
|
||||||
|
--yggdrasil-conf="" \
|
||||||
|
--yggdrasil-peers-json="/UTILS/yggdrasil_find_public_peers/public_peers.json"
|
||||||
|
# ==== YGGDRASIL ====
|
||||||
|
# Ports used by YGGDRASIL
|
||||||
|
# Listen
|
||||||
|
EXPOSE 10654
|
||||||
|
# Default yggdrasil port
|
||||||
|
EXPOSE 9001
|
||||||
|
WORKDIR /YGGDRASIL/
|
||||||
|
COPY --from=builder_yggdrasil /BUILD_YGGDRASIL/yggdrasil-go/yggdrasil .
|
||||||
|
COPY --from=builder_yggdrasil /BUILD_YGGDRASIL/yggdrasil-go/yggdrasilctl .
|
||||||
|
COPY --from=builder_yggdrasil /BUILD_YGGDRASIL/yggdrasil-go/genkeys .
|
||||||
|
COPY ./yggdrasil.conf .
|
||||||
|
# ==== TOR ====
|
||||||
|
EXPOSE 9050
|
||||||
|
EXPOSE 8118
|
||||||
|
WORKDIR /tmp/
|
||||||
|
COPY ./torrc /etc/tor
|
||||||
|
RUN ls /etc/tor
|
||||||
|
COPY ./tor /etc/default/tor
|
||||||
|
RUN chmod -R 0700 /etc/default/tor
|
||||||
|
RUN cat /etc/default/tor
|
||||||
|
RUN cat /etc/tor/torrc
|
||||||
|
WORKDIR /
|
||||||
|
COPY ./entrypoint.sh .
|
||||||
|
ENTRYPOINT ["bash", "/entrypoint.sh"]
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# TOR_YGGDRASIL_DOCKER
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This project is a set of tools for run TOR over [YGGDRASIL](https://yggdrasil-network.github.io/) docker images.
|
||||||
|
|
||||||
|
At startup, the script searches YGGDRASIL public peers and chooses several best of them.
|
||||||
|
Then it generates YGGDRASIL *PublicKey* and *PrivateKey* unless the keys not set in environment variables.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
You can build docker image by simply run script *build_image.sh*.
|
||||||
|
|
||||||
|
> bash build_image.sh
|
||||||
|
|
||||||
|
Feel free to modify it with your own building arguments.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
To run docker container just run
|
||||||
|
|
||||||
|
> docker-compose up
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
TAG_VERSION=$(git describe --tags || echo "unknown")
|
||||||
|
docker build \
|
||||||
|
--build-arg UBUNTU_VERSION=24.04 \
|
||||||
|
--build-arg YGGDRASIL_VERSION=v0.5.6 \
|
||||||
|
--tag tor_yggdrasil:${TAG_VERSION} \
|
||||||
|
--tag tor_yggdrasil:latest \
|
||||||
|
.
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
version: "3.3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
#
|
||||||
|
tor_yggdrasil:
|
||||||
|
image: tor_yggdrasil:latest
|
||||||
|
privileged: true
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
devices:
|
||||||
|
- /dev/net/tun:/dev/net/tun
|
||||||
|
ports:
|
||||||
|
- "8118:8118"
|
||||||
|
- "9050:9050"
|
||||||
|
- "10765:10765"
|
||||||
|
- "10654:10654"
|
||||||
|
- "9001:9001"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# get strong yggdrasil address (https://yggdrasil-network.github.io/configuration.html#generating-stronger-addresses-and-prefixes)
|
||||||
|
python3 /UTILS/yggdrasil_get_keys/yggdrasil_get_keys.py \
|
||||||
|
--genkeys="/YGGDRASIL/genkeys" \
|
||||||
|
--yggdrasil-conf="/YGGDRASIL/yggdrasil.conf" \
|
||||||
|
--timeout=10 \
|
||||||
|
--environment
|
||||||
|
# find yggdrasil public peers
|
||||||
|
python3 /UTILS/yggdrasil_find_public_peers/yggdrasil_find_public_peers.py \
|
||||||
|
--yggdrasil-conf="/YGGDRASIL/yggdrasil.conf" \
|
||||||
|
--yggdrasil-peers-json="/UTILS/yggdrasil_find_public_peers/public_peers.json" \
|
||||||
|
--parallel=40 \
|
||||||
|
--pings=10 \
|
||||||
|
--best=6 \
|
||||||
|
--max-from-country=2 \
|
||||||
|
--ping-interval=0.5
|
||||||
|
sysctl net.ipv6.conf.all.disable_ipv6=0 || true
|
||||||
|
# start YGGDRASIL
|
||||||
|
/YGGDRASIL/yggdrasil -useconffile /YGGDRASIL/yggdrasil.conf &
|
||||||
|
sleep 30s
|
||||||
|
# start TOR
|
||||||
|
tor &
|
||||||
|
wait -n
|
||||||
|
exit $?
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
RUN_DAEMON="no"
|
||||||
|
CLEANUP_OLD_COREFILES=y
|
||||||
|
|
||||||
|
if [ -e /etc/default/tor.vidalia ] && [ -x /usr/bin/vidalia ]; then
|
||||||
|
. /etc/default/tor.vidalia
|
||||||
|
fi
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
SocksPort 0.0.0.0:9050
|
||||||
|
|
||||||
|
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
|
||||||
|
|
||||||
|
Bridge [21b:321:3243:ecb6:a4cf:289c:c0f1:d6eb]:16728 835FFE642EFA3BB7936663D2365A15D319FB6226
|
||||||
|
Bridge [21f:5234:5548:31e5:a334:854b:5752:f4fc]:9770 6C4C89ABE4D06987AB1F51C06939410282A1BF58
|
||||||
|
Bridge [224:6723:7ae0:5655:e600:51c9:4300:a2fb]:9001 F873E91048B40656694BE94ACAB6F0D32CAF8E17
|
||||||
|
Bridge obfs4 [218:4feb:a509:9db2:2b34:6e7e:e071:5dee]:1992 F805F6B4E5E203EFE2A7FFB1E5042AFE8BD986B4 cert=0GcjnEnZ0rJ8/nfxo4ZSkjMZ0fqHSrvj/MdwEtbbuzx8qgqFTaqHTuWelGw2MxJ5wW2QaQ iat-mode=0
|
||||||
|
|
||||||
|
UseBridges 1
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
# List of connection strings for outbound peer connections in URI format,
|
||||||
|
# e.g. tls://a.b.c.d:e or socks://a.b.c.d:e/f.g.h.i:j. These connections
|
||||||
|
# will obey the operating system routing table, therefore you should
|
||||||
|
# use this section when you may connect via different interfaces.
|
||||||
|
Peers: []
|
||||||
|
|
||||||
|
# List of connection strings for outbound peer connections in URI format,
|
||||||
|
# arranged by source interface, e.g. { "eth0": [ "tls://a.b.c.d:e" ] }.
|
||||||
|
# Note that SOCKS peerings will NOT be affected by this option and should
|
||||||
|
# go in the "Peers" section instead.
|
||||||
|
InterfacePeers: {}
|
||||||
|
|
||||||
|
# Listen addresses for incoming connections. You will need to add
|
||||||
|
# listeners in order to accept incoming peerings from non-local nodes.
|
||||||
|
# Multicast peer discovery will work regardless of any listeners set
|
||||||
|
# here. Each listener should be specified in URI format as above, e.g.
|
||||||
|
# tls://0.0.0.0:0 or tls://[::]:0 to listen on all interfaces.
|
||||||
|
Listen: [
|
||||||
|
tls://[::]:10654
|
||||||
|
]
|
||||||
|
|
||||||
|
# Listen address for admin connections. Default is to listen for local
|
||||||
|
# connections either on TCP/9001 or a UNIX socket depending on your
|
||||||
|
# platform. Use this value for yggdrasilctl -endpoint=X. To disable
|
||||||
|
# the admin socket, use the value "none" instead.
|
||||||
|
AdminListen: unix:///var/run/yggdrasil.sock
|
||||||
|
|
||||||
|
# Configuration for which interfaces multicast peer discovery should be
|
||||||
|
# enabled on. Each entry in the list should be a json object which may
|
||||||
|
# contain Regex, Beacon, Listen, and Port. Regex is a regular expression
|
||||||
|
# which is matched against an interface name, and interfaces use the
|
||||||
|
# first configuration that they match gainst. Beacon configures whether
|
||||||
|
# or not the node should send link-local multicast beacons to advertise
|
||||||
|
# their presence, while listening for incoming connections on Port.
|
||||||
|
# Listen controls whether or not the node listens for multicast beacons
|
||||||
|
# and opens outgoing connections.
|
||||||
|
MulticastInterfaces:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
Regex: .*
|
||||||
|
Beacon: true
|
||||||
|
Listen: true
|
||||||
|
Port: 0
|
||||||
|
Priority: 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# List of peer public keys to allow incoming peering connections
|
||||||
|
# from. If left empty/undefined then all connections will be allowed
|
||||||
|
# by default. This does not affect outgoing peerings, nor does it
|
||||||
|
# affect link-local peers discovered via multicast.
|
||||||
|
AllowedPublicKeys: []
|
||||||
|
|
||||||
|
# Your public key. Your peers may ask you for this to put
|
||||||
|
# into their AllowedPublicKeys configuration.
|
||||||
|
PublicKey:
|
||||||
|
|
||||||
|
# Your private key. DO NOT share this with anyone!
|
||||||
|
PrivateKey:
|
||||||
|
|
||||||
|
# Local network interface name for TUN adapter, or "auto" to select
|
||||||
|
# an interface automatically, or "none" to run without TUN.
|
||||||
|
IfName: auto
|
||||||
|
|
||||||
|
# Maximum Transmission Unit (MTU) size for your local TUN interface.
|
||||||
|
# Default is the largest supported size for your platform. The lowest
|
||||||
|
# possible value is 1280.
|
||||||
|
IfMTU: 65535
|
||||||
|
|
||||||
|
# By default, nodeinfo contains some defaults including the platform,
|
||||||
|
# architecture and Yggdrasil version. These can help when surveying
|
||||||
|
# the network and diagnosing network routing problems. Enabling
|
||||||
|
# nodeinfo privacy prevents this, so that only items specified in
|
||||||
|
# "NodeInfo" are sent back if specified.
|
||||||
|
NodeInfoPrivacy: false
|
||||||
|
|
||||||
|
# Optional node info. This must be a { "key": "value", ... } map
|
||||||
|
# or set as null. This is entirely optional but, if set, is visible
|
||||||
|
# to the whole network on request.
|
||||||
|
NodeInfo: {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user