I want to tunnel TLS traffic on Linux using bash. Can I do it without multithreading? Is there a predictable order of message exchanges so that I only need to listen to one of the parties at any one time?
I'm writing a proxy server for Linux and need to tunnel TLS. I'd prefer to do it in bash.
exec 3<>/dev/tcp/example.com/443
while 1
do
cat <mypipe >&3
cat <&3 >mypipe
done
Can I do it like this? Roughly? I mean, is this a viable architecture? Never mind that I should exit from the loop in the end. I intend to use a messenger to supply data in the named pipe mypipe, and to collect the response.
The messenger is meant to run the code:
cat <&0 >mypipe
cat <mypipe
where the data to be sent comes from stdin (the body of a http request).