Merge pull request #1767 from akrigator/tor_http_proxy

Tor http proxy
This commit is contained in:
Alexandre
2025-02-13 18:00:19 +01:00
committed by GitHub
6 changed files with 49 additions and 27 deletions

View File

@@ -13,3 +13,12 @@
## 5.0.1-4 (14-08-2024) ## 5.0.1-4 (14-08-2024)
- Add execution permission for permission for /etc/s6-overlay/s6-overlay/s6-rc.d/init-tor/run file - Add execution permission for permission for /etc/s6-overlay/s6-overlay/s6-rc.d/init-tor/run file
## 5.0.2-1 (13-02-2025)
- HTTP tunneling
## 5.0.2-2 (13-02-2025)
- Fix snowflake build
- Lint issues

View File

@@ -1,4 +1,4 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base:16.2.0 ARG BUILD_FROM
# hadolint ignore=DL3006 # hadolint ignore=DL3006
FROM ${BUILD_FROM} FROM ${BUILD_FROM}
@@ -11,22 +11,22 @@ COPY rootfs /
# Setup base # Setup base
RUN \ RUN \
apk add --no-cache \ apk add --no-cache \
coreutils=9.5-r1 \ coreutils=9.5-r2 \
openssl=3.3.1-r3 \ openssl=3.3.3-r0 \
tor=0.4.8.12-r0 \ tor=0.4.8.14-r1 \
go=1.22.6-r0 \ go=1.23.6-r0 \
git=2.45.2-r0 \ git=2.47.2-r0 \
ca-certificates=20240705-r0 \ ca-certificates=20241121-r1 \
libcap=2.70-r0 libcap=2.71-r0
# Download pluggable-transports sources # Download pluggable-transports sources
WORKDIR /go WORKDIR /go
ARG OBFS_VERSION=obfs4proxy-0.0.14 ARG OBFS_VERSION=obfs4proxy-0.0.14
ARG SNOWFLAKE_VERSION=v2.9.2 ARG SNOWFLAKE_VERSION=v2.10.1
ARG WEBTUNNEL_VERSION=e64b1b3562f3ab50d06141ecd513a21ec74fe8c6 ARG WEBTUNNEL_VERSION=v0.0.2
RUN git clone -b ${OBFS_VERSION} --single-branch --depth 1 https://github.com/Yawning/obfs4.git \ RUN git clone -b ${OBFS_VERSION} --single-branch --depth 1 https://github.com/Yawning/obfs4.git \
&& git clone -b ${SNOWFLAKE_VERSION} --single-branch --depth 1 https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git \ && git clone -b ${SNOWFLAKE_VERSION} --single-branch --depth 1 https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git \
&& git clone --single-branch --depth 1 https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel.git && git clone -b ${WEBTUNNEL_VERSION} --single-branch --depth 1 https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/webtunnel.git
# Build obfs4proxy # Build obfs4proxy
WORKDIR /go/obfs4 WORKDIR /go/obfs4
@@ -35,11 +35,11 @@ RUN go build -o /usr/local/bin/obfs4proxy ./obfs4proxy
# Build snowflake # Build snowflake
WORKDIR /go/snowflake/client WORKDIR /go/snowflake/client
RUN go get \ RUN go get \
&& go build -o /usr/local/bin/snowflake && go build -ldflags '-extldflags "-static" -w -s' -o /usr/local/bin/snowflake
# Build webtunnel # Build webtunnel
WORKDIR /go/webtunnel/main/client WORKDIR /go/webtunnel/main/client
RUN git reset --hard ${WEBTUNNEL_VERSION} \ RUN go get \
&& go build -ldflags="-s -w" -o /usr/local/bin/webtunnel && go build -ldflags="-s -w" -o /usr/local/bin/webtunnel
# Clean up after build # Clean up after build

View File

@@ -42,6 +42,10 @@ The installation of this add-on is pretty straightforward and not different in c
You should follow to the initial guide for configuring base addon options. Here will described only extra options in comparisons with base: You should follow to the initial guide for configuring base addon options. Here will described only extra options in comparisons with base:
### Option: `http_tunnel`
Setting this option to true opens port 9080 to listen for connections from HTTP-speaking applications. Enabling this feature allows you to use other applications on your network to use the Tor network via http proxy.
### Option: `bridges` ### Option: `bridges`
> Ensure the option value is clear to avoid unintended use of transport plugins and bridges. > Ensure the option value is clear to avoid unintended use of transport plugins and bridges.

View File

@@ -1,8 +1,8 @@
{ {
"build_from": { "build_from": {
"aarch64": "ghcr.io/hassio-addons/base:16.2.0", "aarch64": "ghcr.io/hassio-addons/base:17.1.4",
"amd64": "ghcr.io/hassio-addons/base:16.2.0", "amd64": "ghcr.io/hassio-addons/base:17.1.4",
"armv7": "ghcr.io/hassio-addons/base:16.2.0" "armv7": "ghcr.io/hassio-addons/base:17.1.4"
}, },
"codenotary": { "codenotary": {
"base_image": "codenotary@frenck.dev", "base_image": "codenotary@frenck.dev",

View File

@@ -21,13 +21,16 @@
"8123:80" "8123:80"
], ],
"socks": false, "socks": false,
"http_tunnel": false,
"stealth": false "stealth": false
}, },
"ports": { "ports": {
"9050/tcp": 9050 "9050/tcp": 9050,
"9080/tcp": 9080
}, },
"ports_description": { "ports_description": {
"9050/tcp": "Tor SOCKS proxy port" "9050/tcp": "Tor SOCKS proxy port",
"9080/tcp": "Tor HTTP tunnel port"
}, },
"schema": { "schema": {
"bridges": [ "bridges": [
@@ -42,10 +45,11 @@
"match(^(.*:)?(?:[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?$)" "match(^(.*:)?(?:[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?$)"
], ],
"socks": "bool", "socks": "bool",
"http_tunnel": "bool",
"stealth": "bool" "stealth": "bool"
}, },
"slug": "tor", "slug": "tor",
"startup": "services", "startup": "services",
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "5.0.1-4" "version": "5.0.2-1"
} }

View File

@@ -89,6 +89,11 @@ else
echo 'SOCKSPort 127.0.0.1:9050' >> "${torrc}" echo 'SOCKSPort 127.0.0.1:9050' >> "${torrc}"
fi fi
# Configure Http tunnel port
if bashio::config.true 'http_tunnel'; then
echo 'HTTPTunnelPort 9080' >> "${torrc}"
fi
# Configure hidden services # Configure hidden services
if bashio::config.true 'hidden_services'; then if bashio::config.true 'hidden_services'; then
echo "HiddenServiceDir ${hidden_service_dir}" >> "${torrc}" echo "HiddenServiceDir ${hidden_service_dir}" >> "${torrc}"