Skip to content

Commit

Permalink
Merge pull request #16 from KoalaSat/patch-2
Browse files Browse the repository at this point in the history
Block admin access in public onion
  • Loading branch information
KoalaSat authored Aug 2, 2024
2 parents 5c2165f + 8d5e245 commit 5239425
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions compose/backup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM debian:bullseye-slim
RUN apt update
RUN apt-get install rsync -y

WORKDIR /usr/src/backup.sh
COPY backup.sh /usr/src

COPY backup.sh /usr/src/backup.sh
WORKDIR /usr/src

CMD ["bash","backup.sh"]
3 changes: 2 additions & 1 deletion compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ services:
# NETWORK: ${NETWORK}
# volumes:
# - ${DATABASE}:/running/database:ro
# - ${BITCOIN_DATA}:/running/bitcoin:ro
# - ${BITCOIN_CONF:?}:/running/bitcoin/bitcoin.conf:ro
# - ${LND_DATA}:/running/lnd:ro
# - ${LND_CONF}:/running/lnd/lnd.conf:ro
# - ${LIT_DATA}:/running/lit:ro
# - ${STATIC}:/running/static:ro
# - ${BU_DIR1}:/backup1
Expand Down
4 changes: 4 additions & 0 deletions compose/env-sample/lndtn/torrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:80

# Robosats Admin Testnet Onion Service
HiddenServiceDir /var/lib/tor/robotest-admin/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:80

HiddenServiceDir /var/lib/tor/robotest-thunderhub/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:3000
Expand Down
14 changes: 14 additions & 0 deletions compose/nginx/mn.conf.d/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ server {
limit_req zone=tenpersec burst=10;
}

location /coordinator {
# Blocks admin access from the public onion address
if ($host ~* "robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion") {
return 403; # Forbidden
}

proxy_pass http://robosats_gunicorn_rest;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
# Replace with the onion hidden service of your coordinator
add_header Onion-Location https://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion$request_uri;

}

location /ws/ {
# websockets are passed to Daphne
Expand Down
15 changes: 15 additions & 0 deletions compose/nginx/tn.conf.d/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ server {
limit_req zone=fivepersec burst=10;
}

location /coordinator {
# Blocks admin access from the public onion address
if ($host ~* "robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion") {
return 403; # Forbidden
}

proxy_pass http://robosats_gunicorn_rest;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
# Replace with the onion hidden service of your coordinator
add_header Onion-Location https://robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion$request_uri;

}

location /ws/ {
# websockets are passed to Daphne
proxy_pass http://robosats_daphne_websocket;
Expand Down

0 comments on commit 5239425

Please sign in to comment.