Difficulty setting up a resilient socat tunnel
I'm having a difficulty setting up socat the way I need. The setup I have is as follows:
- Server with the console on the serial port.
- Openwrt router with its serial port connected to the server's.
- Laptop where I would like to access the server's console from.
I have got it working wonderfully, with openssl, running an instance of socat on the router and another one on the laptop. On the laptop I use screen over the virtual pty.
The issue shows up whenever I suspend my laptop or exit screen. I believe the server's serial console gets messed up if the connection with the router is closed. Most of the times I have to reboot the server to have a working console again after resuming my laptop, because of it.
On both sides socat is respawned if killed. I have tried countless options like fork, reuseaddr, ignoreeof, ... Right now I have left it as:
socat -ly -lh openssl-listen:4433,fork,reuseaddr,cert=/etc/server.pem,cafile=/etc/client.crt /dev/ttyS0,b115200,ignoreeof,end-close,shut-none,echo=0,echoctl=1,echoe=1,echok=1,icrnl=1,inlcr=1,isig=1,ixon=1,ixoff=1,onlcr=1,opost=1,raw
socat pty,link=com1 openssl-connect:thallix:4433,reuseaddr,cert=certs/client.pem,cafile=certs/server.crt
Do you see a way to do it or know what might be the reason the server's console is unusable after closing the first connection?