From fe99d0ec9e388c5ce9614ca417bed90eb38de32a Mon Sep 17 00:00:00 2001 From: Simon Beginn Date: Tue, 16 Feb 2021 14:31:50 +0100 Subject: [PATCH] Initial commit with Docker(Compose) support --- docker/Dockerfile | 20 ++++++++++++++++++++ docker/README.md | 2 ++ docker/docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..89da78b --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM goofball222/pritunl:latest + +ENV ORIG_API_SERVER app.pritunl.com +ENV FAKE_API_SERVER pritunl-api.simonmicro.de +ENV ORIG_AUTH_SERVER auth.pritunl.com +ENV FAKE_AUTH_SERVER pritunl-api.simonmicro.de\\/auth + +# This is basically the classic installer script... +RUN ORIG_API_SERVER_ESCAPED=$(echo "$ORIG_API_SERVER" | sed -e 's/\./\\./g') && \ + FAKE_API_SERVER_ESCAPED=$(echo "$FAKE_API_SERVER" | sed -e 's/\./\\./g') && \ + ORIG_AUTH_SERVER_ESCAPED=$(echo "$ORIG_AUTH_SERVER" | sed -e 's/\./\\./g') && \ + FAKE_AUTH_SERVER_ESCAPED=$(echo "$FAKE_AUTH_SERVER" | sed -e 's/\./\\./g') && \ + echo 'Rewriting pritunl api endpoint: libs' && \ + find /usr/lib/python2.7 -type f -print0 | xargs -0 sed -i "s/$ORIG_API_SERVER_ESCAPED/$FAKE_API_SERVER_ESCAPED/g" && \ + echo 'Rewriting pritunl api endpoint: www' && \ + find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$ORIG_API_SERVER_ESCAPED/$FAKE_API_SERVER_ESCAPED/g" && \ + echo 'Rewriting pritunl auth (SSO) endpoint: libs+www' && \ + find /usr/lib/python2.7 -type f -print0 | xargs -0 sed -i "s/$ORIG_AUTH_SERVER_ESCAPED/$FAKE_AUTH_SERVER_ESCAPED/g" && \ + find /usr/share/pritunl/www/ -type f -print0 | xargs -0 sed -i "s/$ORIG_AUTH_SERVER_ESCAPED/$FAKE_AUTH_SERVER_ESCAPED/g" && \ + echo 'Done...' diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..1067a64 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,2 @@ +This uses the docker image for Pritunl by `goofball222/pritunl` and installs the fake api hooks directly into it. +The prebuild image is also available as `realsimonmicro/pritunl-with-fake-api`. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..d56a37e --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' +services: + mongodb: + image: mongo:latest + restart: always + volumes: + - ./mongodb:/data/db + + pritunl: + image: realsimonmicro/pritunl-with-fake-api:latest + # Use the following to build the image from source. +# build: +# context: . + restart: always + depends_on: + - mongodb + privileged: true + sysctls: + - net.ipv6.conf.all.disable_ipv6=0 + links: + - mongodb + volumes: + - /etc/localtime:/etc/localtime:ro + ports: + # Under this port the Pritunl web interface will be exposed + - 9700:9700 + # The following are two random ports for the tcp+udp servers (you may edit these as needed!) + - 46648:46648 + - 46648:46648/udp + environment: + - TZ=UTC + - MONGODB_URI=mongodb://mongodb:27017/pritunl + - REVERSE_PROXY=true + labels: + - com.centurylinklabs.watchtower.enable=false