#!/bin/bash
# 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

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

