mirror of
https://github.com/cmehay/docker-tor-hidden-service.git
synced 2025-04-20 13:59:12 +00:00
Update deps.
Enable parallel builds in dockerfile. Add `TOR_CONTROL_PASSWORD_FILE` support.
This commit is contained in:
parent
1dbcebdee3
commit
547404ec3b
5 changed files with 642 additions and 766 deletions
|
@ -18,7 +18,7 @@ RUN apk add --no-cache git bind-tools cargo libevent-dev openssl-dev gnupg g
|
|||
--disable-asciidoc \
|
||||
--sysconfdir=/etc \
|
||||
--disable-unittests && \
|
||||
make && make install && \
|
||||
make -j$(nprocs) && make install && \
|
||||
cd .. && \
|
||||
rm -rf tor && \
|
||||
pip3 install --upgrade pip poetry && \
|
||||
|
@ -32,7 +32,7 @@ RUN apk add --no-cache git gcc make automake autoconf musl-dev libtool && \
|
|||
git checkout $TORSOCKS_VERSION && \
|
||||
./autogen.sh && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
make -j$(nprocs) && make install && \
|
||||
cd .. && \
|
||||
rm -rf torsocks && \
|
||||
apk del git gcc make automake autoconf musl-dev libtool
|
||||
|
@ -42,13 +42,13 @@ RUN mkdir -p /etc/tor/
|
|||
COPY pyproject.toml /usr/local/src/onions/
|
||||
|
||||
RUN cd /usr/local/src/onions && apk add --no-cache openssl-dev libffi-dev gcc libc-dev && \
|
||||
poetry install --no-dev --no-root && \
|
||||
poetry install --only main --no-root && \
|
||||
apk del libffi-dev gcc libc-dev openssl-dev
|
||||
|
||||
COPY onions /usr/local/src/onions/onions
|
||||
COPY poetry.lock /usr/local/src/onions/
|
||||
RUN cd /usr/local/src/onions && apk add --no-cache gcc libc-dev && \
|
||||
poetry install --no-dev && \
|
||||
poetry install --only main && \
|
||||
apk del gcc libc-dev
|
||||
|
||||
RUN mkdir -p ${HOME}/.tor && \
|
||||
|
|
|
@ -32,8 +32,11 @@ post_run_commands:
|
|||
- onions --run-vanguards
|
||||
|
||||
set_environment:
|
||||
- tor:
|
||||
- TOR_CONTROL_PASSWORD: onions --load-file-env
|
||||
- vanguards:
|
||||
- TOR_CONTROL_PORT: onions --resolve-control-port
|
||||
- TOR_CONTROL_PASSWORD: onions --load-file-env
|
||||
reload:
|
||||
files:
|
||||
- /etc/tor/torrc
|
||||
|
|
|
@ -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):
|
||||
self._set_service_names()
|
||||
self._setup_keys_and_ports_from_env()
|
||||
|
@ -479,6 +491,8 @@ def main():
|
|||
parser.add_argument('--setup-hosts', dest='setup', action='store_true',
|
||||
help='Setup hosts')
|
||||
|
||||
parser.add_argument('--load-file-env', dest='load_file_env', action='store_true')
|
||||
|
||||
parser.add_argument('--run-vanguards', dest='vanguards',
|
||||
action='store_true',
|
||||
help='Run Vanguards in tor container')
|
||||
|
@ -490,6 +504,9 @@ def main():
|
|||
logging.getLogger().setLevel(logging.WARNING)
|
||||
try:
|
||||
onions = Onions()
|
||||
if args.load_file_env:
|
||||
onions.load_file_env()
|
||||
return
|
||||
if args.vanguards:
|
||||
onions.run_vanguards()
|
||||
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>"]
|
||||
license = "WTFPL"
|
||||
repository = "https://github.com/cmehay/docker-tor-hidden-service"
|
||||
classifiers=[
|
||||
"Programming Language :: Python",
|
||||
"Development Status :: 1 - Planning",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Natural Language :: English",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Topic :: System :: Installation/Setup",
|
||||
]
|
||||
packages = [
|
||||
{ include = "onions" },
|
||||
classifiers = [
|
||||
"Programming Language :: Python",
|
||||
"Development Status :: 1 - Planning",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Natural Language :: English",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Topic :: System :: Installation/Setup",
|
||||
]
|
||||
packages = [{ include = "onions" }]
|
||||
|
||||
[tool.poetry.scripts]
|
||||
onions = "onions:main"
|
||||
|
|
Loading…
Add table
Reference in a new issue