From b04ff8857a03a3ebe0c16917ff5364ef04e17d43 Mon Sep 17 00:00:00 2001 From: Ryan Persaud Date: Sun, 29 Mar 2020 11:36:38 -0600 Subject: [PATCH 1/2] Added Docker support --- Dockerfile | 23 +++++++++++++++++++++++ README.md | 12 +++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bb88ffc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.8-slim-buster + +# Create non-root user to run pyja3mas as +RUN useradd ja3user + +WORKDIR /opt/pyja3mas + +COPY requirements.txt *.py ./ + +RUN python3 -m pip install -r requirements.txt + +RUN mkdir certs logs + +# Generate key and certificate for pyja3mas +RUN openssl req -newkey rsa:4096 -nodes -keyout certs/privkey.pem -x509 -days 365 -out certs/fullchain.pem -subj "/C=US/ST=VA/L=Springfield/O=ACME/OU=IT/CN=localhost" + +RUN chown -R ja3user:ja3user certs logs + +WORKDIR /opt/pyja3mas + +USER ja3user + +CMD python3 https_server.py diff --git a/README.md b/README.md index bb85fbe..4bed647 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ python3 https_server.py ``` This will start the server on `localhost:4443` by default. You can visit -`https://localhost:4443` on your browser. Make sure you inlcude `https` in +`https://localhost:4443` on your browser. Make sure you include `https` in front of the domain, or the browser will not connect properly. To change the host/port, go into the code and edit the `HOST` and `PORT` global variables. @@ -68,3 +68,13 @@ browser's JA3 fingerprint, browser name, and browser version. It extracts all of this data, except for the JA3 fingerprint, from the User-Agent string your browser sends with the initial GET request. + +### Docker +To run pyja3mas as a Docker container, first build the Docker image with: +`docker build -t pyja3mas .` + +Then run the container with: +`docker run -p 127.0.0.1:443:4443 pyja3mas` + +This will listen on port 443 of your loopback adapter for connections and +forward them to the running pyja3mas script inside the container. From c6f9c246c8f1a7bb3de7c64fb03b686d85d752ac Mon Sep 17 00:00:00 2001 From: Ryan Persaud Date: Sun, 29 Mar 2020 14:32:08 -0600 Subject: [PATCH 2/2] Removed dupliate WORKDIR --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb88ffc..b358df0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,6 @@ RUN openssl req -newkey rsa:4096 -nodes -keyout certs/privkey.pem -x509 -days 36 RUN chown -R ja3user:ja3user certs logs -WORKDIR /opt/pyja3mas - USER ja3user CMD python3 https_server.py