10 ms·
This does not work in pipelines where nc5 is to be used more than once. Simpler version using regular files, no fifos, no tmux. test -f /path/stunnel
by 1vuio0pswjnm7 3y ago
This does not work in pipelines where nc5 is to be used more than once.
Simpler version using regular files, no fifos, no tmux.
test -f /path/stunnel_xyz||echo "
foreground=no
debug=debug
pid=/path/stunnel_xyz.pid
[ x ]
accept=127.0.0.62:80
client=yes
options=NO_TICKET
options=NO_RENEGOTIATION
renegotiation=no
sslVersion=TLSv1.3
sni=
connect=127.0.0.61:443
" > /path/stunnel_xyz
test -f /path/stunnel_xyz.pid||stunnel /path/stunnel_xyz
x(){ tcpclient -RHDl0 127.0.0.61:80 sh -c "sed >&6;yy045 <&7";}
x(){ socat stdio,ignoreeof tcp:127.0.0.61:80|yy045;}
x(){ openssl s_client -connect 127.0.0.61:443 -ign_eof 2>/dev/null|yy045;}
x(){ bssl client -connect 127.0.0.61:443 2>/dev/null|yy045;}
x(){ nc -vvn 127.0.0.61 80|yy045;}
xy(){ nc -vvn 127.62 80|yy045;}
xy(){ tcpclient -RHDl0 127.0.0.62:80 sh -c "sed >&6;yy045 <&7";}
xy(){ socat stdio,ignoreeof tcp:127.0.0.62:80|yy045;}
yy025 5>.1 >.2;read x<.1
echo "<base href=https://$x />";
case $# in :)
;;0)x<.2;
;;1|2)
sed -i "/^ *connect=/s/=.*/=$1:443/;/^ *sni=/s/=.*/=$2/" /path/stunnel_xyz;
xy<.2;
esac