From ef339ef9167b017073372b4a72b58bbd8feb170b Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sun, 20 Nov 2022 22:00:12 -0700 Subject: [PATCH] Setting up to do some minimal admin auth for the relay --- projects/activitypub_relay/BUILD | 1 + projects/activitypub_relay/Dockerfile | 9 +++++---- tools/python/requirements.txt | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/projects/activitypub_relay/BUILD b/projects/activitypub_relay/BUILD index ceaa590..2996201 100644 --- a/projects/activitypub_relay/BUILD +++ b/projects/activitypub_relay/BUILD @@ -2,6 +2,7 @@ py_project( name = "activitypub_relay", lib_deps = [ py_requirement("aiohttp"), + py_requirement("aiohttp_basicauth"), py_requirement("async_lru"), py_requirement("cachetools"), py_requirement("click"), diff --git a/projects/activitypub_relay/Dockerfile b/projects/activitypub_relay/Dockerfile index aa4a80c..1e71c3a 100644 --- a/projects/activitypub_relay/Dockerfile +++ b/projects/activitypub_relay/Dockerfile @@ -1,19 +1,20 @@ FROM library/python:3.10 - MAINTAINER Reid McKenzie + MAINTAINER Reid 'arrdem' McKenzie RUN pip install --upgrade pip -RUN adduser app -RUN mkdir /app +RUN useradd -d /app app +RUN mkdir -p /app RUN chown -R app:app /app USER app WORKDIR /app ENV PATH="/app/.local/bin:${PATH}" ENV PYTHONPATH="/app:${PYTHONPATH}" +ENV DOCKER_RUNNING=true # Trivialize detecting dockerization ### App specific crap # Deps vary least so do them first -RUN pip install --user install aiohttp async_lru cachetools click pycryptodome pyyaml retry +RUN pip install --user install aiohttp aiohttp_basicauth async_lru cachetools click pycryptodome pyyaml retry COPY --chown=app:app src/python . COPY --chown=app:app relay.yaml . diff --git a/tools/python/requirements.txt b/tools/python/requirements.txt index 4c4fa91..23d700f 100644 --- a/tools/python/requirements.txt +++ b/tools/python/requirements.txt @@ -1,4 +1,5 @@ aiohttp==3.8.1 +aiohttp-basicauth==1.0.0 aiosignal==1.2.0 alabaster==0.7.12 async-lru==1.0.3 @@ -125,8 +126,8 @@ toposort==1.7 tornado==6.1 typed-ast==1.5.1 types-setuptools==57.4.7 -typing-validation==0.0.1.post7 typing_extensions==4.0.1 +typing-validation==0.0.1.post7 unify==0.5 untokenize==0.1.1 urllib3==1.26.8