ssh tunnel env switch and logging

This commit is contained in:
finn 2024-08-10 06:12:26 -07:00
parent 78384a31fb
commit 08ae04a154
5 changed files with 20 additions and 8 deletions

View File

@ -140,10 +140,11 @@ services:
context: sshtun context: sshtun
dockerfile: Dockerfile dockerfile: Dockerfile
restart: always restart: always
environment:
- USE_TUN=${USE_TUN}
ports: ports:
- "22222:22" - "22222:22"
expose: expose:
- "11111"
- "11112" - "11112"
networks: networks:
- frontnet - frontnet

View File

@ -140,10 +140,11 @@ services:
context: sshtun context: sshtun
dockerfile: Dockerfile dockerfile: Dockerfile
restart: always restart: always
environment:
- USE_TUN=${USE_TUN}
ports: ports:
- "22222:22" - "22222:22"
expose: expose:
- "11111"
- "11112" - "11112"
networks: networks:
- frontnet - frontnet

View File

@ -140,10 +140,11 @@ services:
context: sshtun context: sshtun
dockerfile: Dockerfile dockerfile: Dockerfile
restart: always restart: always
environment:
- USE_TUN=${USE_TUN}
ports: ports:
- "22222:22" - "22222:22"
expose: expose:
- "11111"
- "11112" - "11112"
networks: networks:
- frontnet - frontnet

3
dotenv
View File

@ -13,6 +13,9 @@ BUILD_GPG_PP=
# Tor: # Tor:
# true/false: # true/false:
USE_TOR=false USE_TOR=false
# SSH Tun:
# true/false:
USE_TUN=false
# Backend: # Backend:
FLASK_SECRET_KEY="flaskkey" FLASK_SECRET_KEY="flaskkey"

View File

@ -1,8 +1,14 @@
#!/bin/bash #!/bin/bash
# Container goal: # Container goal: egress
# autossh -N -R 11111:localhost:11434 -i sshtun/oilykey/<SOMEKEY> -p 22222 <SOMEURL> # first: physical_box$ autossh -N -R 11111:localhost:11434 -i sshtun/oilykey/<SOMEKEY> -p 22222 <rem_vps_url>
# forwards rem_c_port:(operator_pc:op_pc_port) ...some args... rem_host_p rem_host_url # will forward rem_c_port:physical_box:physical_box_port ...some args... rem_vps_p rem_vps_url
# then: frontnet_c$ curl sshtun.frontnet:11112 --> physical_box:11434
if $USE_TUN ; then
echo "@@@@@@@@@@ SSH TUNNEL ENABLED BY ENV"
nohup socat TCP-LISTEN:11112,fork TCP:localhost:11111 & nohup socat TCP-LISTEN:11112,fork TCP:localhost:11111 &
/usr/sbin/sshd -D /usr/sbin/sshd -De
else
echo "@@@@@@@@@@ SSH TUNNEL DISABLED BY ENV"
fi