Add Dockerfile

This commit is contained in:
Vecna 2024-06-18 18:56:16 -04:00
parent 8a69a11b58
commit 2a78b4e8b2
3 changed files with 212 additions and 0 deletions

78
Dockerfile Normal file
View File

@ -0,0 +1,78 @@
FROM ubuntu:24.04
# Default directory
WORKDIR /home/user
COPY setup_files/* /home/user/build/
RUN sed -i 's@HOMEDIR@/home/user@g' /home/user/build/config.toml
RUN apt update -y
RUN apt install -y git cargo golang make openssl libssl-dev
RUN mkdir -p /home/user/build /home/user/rdsys /home/user/lox-distributor /home/user/troll-patrol /home/user/simulation
# Clone all our projects
# rdsys
WORKDIR /home/user/build
RUN git clone https://gitlab.torproject.org/tpo/anti-censorship/rdsys.git
WORKDIR /home/user/build/rdsys
RUN git checkout 79332a3ee69dc6022a2a29fd8b79e9d2e4f5c9ab
RUN sed -i 's/NUM_BRIDGES = 1000/NUM_BRIDGES = 3600/' scripts/mkdescriptors/main.go
# configure rdsys to give Lox all the bridges
RUN cp /home/user/build/config.json conf/
# Lox distributor
WORKDIR /home/user/build
RUN git clone https://gitlab.torproject.org/vecna/lox.git
WORKDIR /home/user/build/lox
RUN git checkout 7b524e771ec444e07fff5b679c8c9e9b557829a0
RUN mkdir -p .cargo
RUN cp /home/user/build/config.toml .cargo/
# lox_cli
WORKDIR /home/user/build
RUN git clone https://git-crysp.uwaterloo.ca/vvecna/lox_cli.git
WORKDIR /home/user/build/lox_cli
RUN git checkout d7beaad5601ad309fd5936c19e60a7ea98a05fde
RUN mkdir -p .cargo
RUN cp /home/user/build/config.toml .cargo/
# Troll Patrol
WORKDIR /home/user/build
RUN git clone https://git-crysp.uwaterloo.ca/vvecna/troll-patrol.git
WORKDIR /home/user/build/troll-patrol
RUN git checkout dc7531689c2a5ec5b4c757f95a87f576c4d4020c
RUN mkdir -p .cargo
RUN cp /home/user/build/config.toml .cargo/
# Lox Simulation
WORKDIR /home/user/build/lox-simulation
COPY Cargo.toml /home/user/build/lox-simulation/
RUN mkdir src
COPY src/* /home/user/build/lox-simulation/src/
RUN mkdir -p .cargo
RUN cp /home/user/build/config.toml .cargo/
# Build all the software
# Build rdsys and bridge lines
WORKDIR /home/user/build/rdsys
RUN make build && make descriptors
RUN cp -r backend conf descriptors /home/user/rdsys/
# Build Lox distributor
WORKDIR /home/user/build/lox/crates/lox-distributor
RUN cargo update && cargo build --release
RUN cp config.json /home/user/build/lox/target/release/lox-distributor /home/user/lox-distributor/
# Build Troll Patrol
WORKDIR /home/user/build/troll-patrol
RUN cargo update && cargo build --release --features simulation
RUN cp target/release/troll-patrol /home/user/troll-patrol/
# Build simulation
WORKDIR /home/user/build/lox-simulation
RUN cargo update && cargo build --release
RUN cp target/release/lox-simulation /home/user/simulation/simulation
WORKDIR /home/user

133
setup_files/config.json Normal file
View File

@ -0,0 +1,133 @@
{
"backend": {
"extrainfo_file": "descriptors/cached-extrainfo",
"networkstatus_file": "descriptors/networkstatus-bridges",
"descriptors_file": "descriptors/bridge-descriptors",
"blocklist_file": "",
"allowlist_file": "",
"bridgestrap_endpoint": "http://127.0.0.1:5001/bridge-state",
"bridgestrap_token": "BridgestrapApiTokenPlaceholder",
"onbasca_endpoint": "http://127.0.0.1:5002/bridge-state",
"onbasca_token": "OnbascaApiTokenPlaceholder",
"bandwidth_ratio_threshold": 0.75,
"api_endpoint_resources": "/resources",
"api_endpoint_resource_stream": "/resource-stream",
"api_endpoint_targets": "/targets",
"web_endpoint_status": "/status",
"web_endpoint_metrics": "/rdsys-backend-metrics",
"storage_dir": "storage",
"assignments_file": "assignments.log",
"resources": {
"vanilla": {
"unpartitioned": false,
"stored": false,
"distributors": [
"https",
"moat"
]
},
"obfs2": {},
"obfs3": {},
"obfs4": {},
"scramblesuit": {},
"tblink": {
"unpartitioned": true,
"stored": true
}
},
"api_tokens": {
"https": "HttpsApiTokenPlaceholder"
},
"web_api": {
"api_address": "127.0.0.1:7100",
"cert_file": "",
"key_file": ""
},
"distribution_proportions": {
"https": 1
}
},
"distributors": {
"https": {
"resources": [
"obfs4",
"vanilla"
],
"web_api": {
"api_address": "127.0.0.1:7200",
"cert_file": "",
"key_file": ""
},
"time_distribution": {
"num_bridges_per_request": 2,
"rotation_period_hours": 24,
"num_periods": 2,
"storage_dir": "storage/https"
}
},
"stub": {
"resources": [
"obfs4"
],
"web_api": {
"api_address": "127.0.0.1:7400",
"cert_file": "",
"key_file": ""
}
},
"telegram": {
"resource": "obfs4",
"num_bridges_per_request": 2,
"rotation_period_hours": 24,
"token": "",
"min_user_id": 0,
"updater_tokens": {
"name": "DynamicBridgeTokenPlaceholder"
},
"storage_dir": "/tmp/storage_telegram",
"api_address": "127.0.0.1:7600",
"lox_server_address": "http://localhost:8001"
}
},
"updaters": {
"gettor": {
"github": {
"auth_token": "",
"owner": "TheTorProject",
"repo": "gettorbrowser"
},
"gitlab": {
"auth_token": "",
"owner": "TheTorProject"
},
"s3": [
{
"access_key": "",
"access_secret": "",
"signing_method": "archive_org_dangerous_workaround",
"endpoint_url": "https://s3.us.archive.org/",
"endpoint_region": "",
"name": "archive_org",
"bucket": "",
"name_procedural_generation_seed": "SECRET"
},
{
"access_key": "",
"access_secret": "",
"signing_method": "v4",
"endpoint_url": "https://s3.fr-par.scw.cloud",
"endpoint_region": "fr-par",
"name": "scaleway",
"bucket": "get-tor",
"name_procedural_generation_seed": ""
}
],
"gdrive": {
"app_credential_path": "",
"user_credential_path": "",
"parent_folder_id": ""
},
"metrics_address": "127.0.0.1:7800"
}
}
}

1
setup_files/config.toml Normal file
View File

@ -0,0 +1 @@
paths = ["HOMEDIR/build/lox/crates/lox-library", "HOMEDIR/build/lox/crates/lox-distributor", "HOMEDIR/build/lox_cli", "HOMEDIR/build/troll-patrol"]