mirror of
https://github.com/cmehay/docker-tor-hidden-service.git
synced 2025-04-21 14:29:11 +00:00
Merge 732dcdeebd
into 1dbcebdee3
This commit is contained in:
commit
ff941453cb
7 changed files with 656 additions and 774 deletions
26
Dockerfile
26
Dockerfile
|
@ -7,7 +7,8 @@ ARG torsocks_version
|
||||||
ENV HOME /var/lib/tor
|
ENV HOME /var/lib/tor
|
||||||
ENV POETRY_VIRTUALENVS_CREATE=false
|
ENV POETRY_VIRTUALENVS_CREATE=false
|
||||||
|
|
||||||
RUN apk add --no-cache git bind-tools cargo libevent-dev openssl-dev gnupg gcc make automake ca-certificates autoconf musl-dev coreutils libffi-dev zlib-dev && \
|
RUN set -ex; \
|
||||||
|
apk add --no-cache git bind-tools cargo libevent-dev openssl-dev gnupg gcc make automake ca-certificates autoconf musl-dev coreutils libffi-dev zlib-dev && \
|
||||||
mkdir -p /usr/local/src/ /var/lib/tor/ && \
|
mkdir -p /usr/local/src/ /var/lib/tor/ && \
|
||||||
git clone https://git.torproject.org/tor.git /usr/local/src/tor && \
|
git clone https://git.torproject.org/tor.git /usr/local/src/tor && \
|
||||||
cd /usr/local/src/tor && \
|
cd /usr/local/src/tor && \
|
||||||
|
@ -18,40 +19,45 @@ RUN apk add --no-cache git bind-tools cargo libevent-dev openssl-dev gnupg g
|
||||||
--disable-asciidoc \
|
--disable-asciidoc \
|
||||||
--sysconfdir=/etc \
|
--sysconfdir=/etc \
|
||||||
--disable-unittests && \
|
--disable-unittests && \
|
||||||
make && make install && \
|
make -j$(nproc) && make install && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
rm -rf tor && \
|
rm -rf tor && \
|
||||||
pip3 install --upgrade pip poetry && \
|
pip3 install --upgrade pip poetry && \
|
||||||
apk del git libevent-dev openssl-dev gnupg cargo make automake autoconf musl-dev coreutils libffi-dev && \
|
apk del git libevent-dev openssl-dev gnupg cargo make automake autoconf musl-dev coreutils libffi-dev && \
|
||||||
apk add --no-cache libevent openssl
|
apk add --no-cache libevent openssl
|
||||||
|
|
||||||
RUN apk add --no-cache git gcc make automake autoconf musl-dev libtool && \
|
RUN set -ex; \
|
||||||
|
apk add --no-cache git gcc make automake autoconf musl-dev libtool && \
|
||||||
git clone https://git.torproject.org/torsocks.git /usr/local/src/torsocks && \
|
git clone https://git.torproject.org/torsocks.git /usr/local/src/torsocks && \
|
||||||
cd /usr/local/src/torsocks && \
|
cd /usr/local/src/torsocks && \
|
||||||
TORSOCKS_VERSION=${torsocks_version=$(git tag | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)} && \
|
TORSOCKS_VERSION=${torsocks_version=$(git tag | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)} && \
|
||||||
git checkout $TORSOCKS_VERSION && \
|
git checkout $TORSOCKS_VERSION && \
|
||||||
./autogen.sh && \
|
./autogen.sh && \
|
||||||
./configure && \
|
./configure && \
|
||||||
make && make install && \
|
make -j$(nproc) CFLAGS="-Wno-error=implicit-function-declaration" && make install && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
rm -rf torsocks && \
|
rm -rf torsocks && \
|
||||||
apk del git gcc make automake autoconf musl-dev libtool
|
apk del git gcc make automake autoconf musl-dev libtool
|
||||||
|
|
||||||
RUN mkdir -p /etc/tor/
|
RUN set -ex; \
|
||||||
|
mkdir -p /etc/tor/
|
||||||
|
|
||||||
COPY pyproject.toml /usr/local/src/onions/
|
COPY pyproject.toml /usr/local/src/onions/
|
||||||
|
|
||||||
RUN cd /usr/local/src/onions && apk add --no-cache openssl-dev libffi-dev gcc libc-dev && \
|
RUN set -ex; \
|
||||||
poetry install --no-dev --no-root && \
|
cd /usr/local/src/onions && apk add --no-cache openssl-dev libffi-dev gcc libc-dev && \
|
||||||
|
poetry install --only main --no-root && \
|
||||||
apk del libffi-dev gcc libc-dev openssl-dev
|
apk del libffi-dev gcc libc-dev openssl-dev
|
||||||
|
|
||||||
COPY onions /usr/local/src/onions/onions
|
COPY onions /usr/local/src/onions/onions
|
||||||
COPY poetry.lock /usr/local/src/onions/
|
COPY poetry.lock /usr/local/src/onions/
|
||||||
RUN cd /usr/local/src/onions && apk add --no-cache gcc libc-dev && \
|
RUN set -ex; \
|
||||||
poetry install --no-dev && \
|
cd /usr/local/src/onions && apk add --no-cache gcc libc-dev && \
|
||||||
|
poetry install --only main && \
|
||||||
apk del gcc libc-dev
|
apk del gcc libc-dev
|
||||||
|
|
||||||
RUN mkdir -p ${HOME}/.tor && \
|
RUN set -ex; \
|
||||||
|
mkdir -p ${HOME}/.tor && \
|
||||||
addgroup -S -g 107 tor && \
|
addgroup -S -g 107 tor && \
|
||||||
adduser -S -G tor -u 104 -H -h ${HOME} tor
|
adduser -S -G tor -u 104 -H -h ${HOME} tor
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,11 @@ post_run_commands:
|
||||||
- onions --run-vanguards
|
- onions --run-vanguards
|
||||||
|
|
||||||
set_environment:
|
set_environment:
|
||||||
|
- tor:
|
||||||
|
- TOR_CONTROL_PASSWORD: onions --load-file-env
|
||||||
- vanguards:
|
- vanguards:
|
||||||
- TOR_CONTROL_PORT: onions --resolve-control-port
|
- TOR_CONTROL_PORT: onions --resolve-control-port
|
||||||
|
- TOR_CONTROL_PASSWORD: onions --load-file-env
|
||||||
reload:
|
reload:
|
||||||
files:
|
files:
|
||||||
- /etc/tor/torrc
|
- /etc/tor/torrc
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
git ls-remote --tags https://git.torproject.org/tor.git | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1
|
git ls-remote --tags https://gitlab.torproject.org/tpo/core/tor.git/ | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
git ls-remote --tags https://git.torproject.org/torsocks.git | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1
|
git ls-remote --tags https://gitlab.torproject.org/tpo/core/torsocks.git/ | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1
|
||||||
|
|
|
@ -258,6 +258,18 @@ class Setup(object):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def load_file_env(self):
|
||||||
|
# for key, val in os.environ.items():
|
||||||
|
# if key.endswith('_FILE'):
|
||||||
|
# with open(val, 'r') as f:
|
||||||
|
# os.environ[key[:-5]] = f.read()
|
||||||
|
if os.environ.get('TOR_CONTROL_PASSWORD_FILE'):
|
||||||
|
with open(os.environ['TOR_CONTROL_PASSWORD_FILE']) as f:
|
||||||
|
# add to env to be used by torrc template
|
||||||
|
pwd = f.read().strip()
|
||||||
|
os.environ['TOR_CONTROL_PASSWORD'] = pwd
|
||||||
|
print(pwd, end='')
|
||||||
|
|
||||||
def _get_setup_from_env(self):
|
def _get_setup_from_env(self):
|
||||||
self._set_service_names()
|
self._set_service_names()
|
||||||
self._setup_keys_and_ports_from_env()
|
self._setup_keys_and_ports_from_env()
|
||||||
|
@ -479,6 +491,8 @@ def main():
|
||||||
parser.add_argument('--setup-hosts', dest='setup', action='store_true',
|
parser.add_argument('--setup-hosts', dest='setup', action='store_true',
|
||||||
help='Setup hosts')
|
help='Setup hosts')
|
||||||
|
|
||||||
|
parser.add_argument('--load-file-env', dest='load_file_env', action='store_true')
|
||||||
|
|
||||||
parser.add_argument('--run-vanguards', dest='vanguards',
|
parser.add_argument('--run-vanguards', dest='vanguards',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Run Vanguards in tor container')
|
help='Run Vanguards in tor container')
|
||||||
|
@ -490,6 +504,9 @@ def main():
|
||||||
logging.getLogger().setLevel(logging.WARNING)
|
logging.getLogger().setLevel(logging.WARNING)
|
||||||
try:
|
try:
|
||||||
onions = Onions()
|
onions = Onions()
|
||||||
|
if args.load_file_env:
|
||||||
|
onions.load_file_env()
|
||||||
|
return
|
||||||
if args.vanguards:
|
if args.vanguards:
|
||||||
onions.run_vanguards()
|
onions.run_vanguards()
|
||||||
return
|
return
|
||||||
|
|
1358
poetry.lock
generated
1358
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -5,19 +5,17 @@ description = "Display onion sites hosted"
|
||||||
authors = ["Christophe Mehay <cmehay@nospam.student.42.fr>"]
|
authors = ["Christophe Mehay <cmehay@nospam.student.42.fr>"]
|
||||||
license = "WTFPL"
|
license = "WTFPL"
|
||||||
repository = "https://github.com/cmehay/docker-tor-hidden-service"
|
repository = "https://github.com/cmehay/docker-tor-hidden-service"
|
||||||
classifiers=[
|
classifiers = [
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Development Status :: 1 - Planning",
|
"Development Status :: 1 - Planning",
|
||||||
"License :: OSI Approved :: BSD License",
|
"License :: OSI Approved :: BSD License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Topic :: System :: Installation/Setup",
|
"Topic :: System :: Installation/Setup",
|
||||||
]
|
|
||||||
packages = [
|
|
||||||
{ include = "onions" },
|
|
||||||
]
|
]
|
||||||
|
packages = [{ include = "onions" }]
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
onions = "onions:main"
|
onions = "onions:main"
|
||||||
|
|
Loading…
Add table
Reference in a new issue