refactor(samples/httpaste.it): finalize initial sample

- add tor daemon
- clean directory structure
This commit is contained in:
Tiara Rodney 2022-04-13 12:54:59 +02:00
parent d558a65609
commit 60a01ea511
7 changed files with 49 additions and 2 deletions

View file

@ -4,6 +4,7 @@ services:
build: build:
context: ../.. context: ../..
dockerfile: Dockerfile dockerfile: Dockerfile
target: uwsgi
environment: environment:
HTTPASTE_CONFIGPATH: /usr/local/httpaste/config.ini HTTPASTE_CONFIGPATH: /usr/local/httpaste/config.ini
volumes: volumes:
@ -13,7 +14,7 @@ services:
target: /shared target: /shared
volume: volume:
nocopy: true 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 command: -s /shared/uwsgi.sock --chmod-socket=666
httpd: httpd:
build: build:
@ -28,6 +29,12 @@ services:
target: /shared target: /shared
volume: volume:
nocopy: true 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: volumes:
system-shared: system-shared:

View file

@ -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

View file

@ -61,3 +61,10 @@ ServerName 127.0.0.1
SetEnv proxy-sendchunks SetEnv proxy-sendchunks
ProxyPass "/" "unix:/shared/uwsgi.sock|uwsgi://localhost/" ProxyPass "/" "unix:/shared/uwsgi.sock|uwsgi://localhost/"
</VirtualHost> </VirtualHost>
<VirtualHost 0.0.0.0:80>
#ProxyPreserveHost On
ServerAlias *.onion
SetEnv proxy-sendchunks
ProxyPass "/" "unix:/shared/uwsgi.sock|uwsgi://localhost/"
</VirtualHost>

View file

@ -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"]

View file

@ -0,0 +1,3 @@
DataDirectory /var/lib/tor
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 httpd:80

View file

@ -0,0 +1,3 @@
#!/usr/bin/env sh
prop=HiddenServiceDir
cat $(grep $prop /etc/tor/torrc | sed "s/$prop //g")/hostname