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
dockerfile: Dockerfile
restart: always
environment:
- USE_TUN=${USE_TUN}
ports:
- "22222:22"
expose:
- "11111"
- "11112"
networks:
- frontnet

View File

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

View File

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

3
dotenv
View File

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

View File

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