5 ms·
Or, y'know, just open a reverse tunnel using autossh.
by zilti 3y ago
Or, y'know, just open a reverse tunnel using autossh.
- aussieguy1234 3y agocould you give more details? what steps are involved in this?
- zilti 3y agoBasically: autossh -M 20000 -N -R host:8080:localhost:80 user@host -M sets the control port for autossh which it uses to check if all is working right. The rest is standard SSH syntax; in this example, a loopback socket on port 8080 on host will get opened, and all requests to it are forwarded to localhost's port 80. If you want it to be a "real" socket instead of just loopback, set "GatewayPorts clientspecified" in sshd_config.
- deleted 3y ago[deleted]
- aussieguy1234 3y agois the `host` part here a server that you run yourself?
- em-bee 3y agoyes
- aussieguy1234 3y agoThe main purpose of services like Tunnelmole and ngrok is to basically provide this functionality and save you from having to run your own server. Its easy for people like us, I've used SSH for more than 20 years. Alot of devs however don't have good Linux/infra/ssh exposure. Others might have that exposure, but don't have the spare time or energy to run their own server.
- brirec 3y agoAll autossh does is try to keep open/restart an ssh connection as a daemon — I’m not sure there’s any benefit to it these days than just using a systemd service. That being said, as an example `ssh user@host.com -R 8181:localhost:8080` will open port 8181 on the remote machine you’re connecting to, and forward traffic that’s addressed there to port 8181 on the machine you’re connecting from. That is, you’ll be able to open a browser to http://host.com:8181 http://host.com:8181 to test something running on your dev machine at port 8080. Traffic gets forwarded along the ssh tunnel. Autossh (or a systemd service supervising an `ssh` connection) will keep that tunnel open.
- qudat 3y agosish uses ssh tunneling that you can read about in their docs: https://docs.ssi.sh/ https://docs.ssi.sh/