diff --git a/samples/httpaste.it/docker-compose.yml b/samples/httpaste.it/docker-compose.yml index 35fb3db..a334189 100644 --- a/samples/httpaste.it/docker-compose.yml +++ b/samples/httpaste.it/docker-compose.yml @@ -4,6 +4,7 @@ services: build: context: ../.. dockerfile: Dockerfile + target: uwsgi environment: HTTPASTE_CONFIGPATH: /usr/local/httpaste/config.ini volumes: @@ -13,7 +14,7 @@ services: target: /shared volume: nocopy: true - - ./httpaste/config.ini:/usr/local/httpaste/config.ini + - ./httpaste/usr/local/httpaste/config.ini:/usr/local/httpaste/config.ini command: -s /shared/uwsgi.sock --chmod-socket=666 httpd: build: @@ -28,6 +29,12 @@ services: target: /shared volume: nocopy: true - - ./httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf + - ./httpd/usr/local/apache2/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf + tor: + build: + context: ./tor + dockerfile: Dockerfile + volumes: + - ./tor/etc/tor/torrc:/etc/tor/torrc volumes: system-shared: \ No newline at end of file diff --git a/samples/httpaste.it/httpaste.service b/samples/httpaste.it/httpaste.service new file mode 100644 index 0000000..37a85cb --- /dev/null +++ b/samples/httpaste.it/httpaste.service @@ -0,0 +1,17 @@ + +[Unit] +Description=httpaste (via Docker Compose) +Requires=docker.service +After=docker.service + +[Service] +WorkingDirectory=/usr/local/src/httpaste/samples/httpaste.it +ExecStart=docker-compose up +ExecStop=docker-compose down +TimeoutStartSec=0 +Restart=on-failure +StartLimitIntervalSec=60 +StartLimitBurst=3 + +[Install] +WantedBy=multi-user.target diff --git a/samples/httpaste.it/httpaste/config.ini b/samples/httpaste.it/httpaste/usr/local/httpaste/config.ini similarity index 100% rename from samples/httpaste.it/httpaste/config.ini rename to samples/httpaste.it/httpaste/usr/local/httpaste/config.ini diff --git a/samples/httpaste.it/httpd/httpd.conf b/samples/httpaste.it/httpd/usr/local/apache2/conf/httpd.conf similarity index 90% rename from samples/httpaste.it/httpd/httpd.conf rename to samples/httpaste.it/httpd/usr/local/apache2/conf/httpd.conf index 04b90e0..4c5ead0 100644 --- a/samples/httpaste.it/httpd/httpd.conf +++ b/samples/httpaste.it/httpd/usr/local/apache2/conf/httpd.conf @@ -61,3 +61,10 @@ ServerName 127.0.0.1 SetEnv proxy-sendchunks ProxyPass "/" "unix:/shared/uwsgi.sock|uwsgi://localhost/" + + + #ProxyPreserveHost On + ServerAlias *.onion + SetEnv proxy-sendchunks + ProxyPass "/" "unix:/shared/uwsgi.sock|uwsgi://localhost/" + diff --git a/samples/httpaste.it/tor/Dockerfile b/samples/httpaste.it/tor/Dockerfile new file mode 100644 index 0000000..cca2e04 --- /dev/null +++ b/samples/httpaste.it/tor/Dockerfile @@ -0,0 +1,10 @@ +FROM debian:bullseye-slim + +RUN apt-get update -y && apt-get install -y tor + +COPY ./usr/local/sbin/hostname.sh /usr/local/sbin/hostname +RUN chmod +x /usr/local/sbin/hostname + +USER debian-tor + +ENTRYPOINT ["tor"] \ No newline at end of file diff --git a/samples/httpaste.it/tor/etc/tor/torrc b/samples/httpaste.it/tor/etc/tor/torrc new file mode 100644 index 0000000..677f5b2 --- /dev/null +++ b/samples/httpaste.it/tor/etc/tor/torrc @@ -0,0 +1,3 @@ +DataDirectory /var/lib/tor +HiddenServiceDir /var/lib/tor/hidden_service/ +HiddenServicePort 80 httpd:80 diff --git a/samples/httpaste.it/tor/usr/local/sbin/hostname.sh b/samples/httpaste.it/tor/usr/local/sbin/hostname.sh new file mode 100755 index 0000000..ee0ff27 --- /dev/null +++ b/samples/httpaste.it/tor/usr/local/sbin/hostname.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +prop=HiddenServiceDir +cat $(grep $prop /etc/tor/torrc | sed "s/$prop //g")/hostname \ No newline at end of file