ufw and ssh tunnel
Dec 13, 2020
You have two computers and you want to create connection to a specific port from one to another. Let’s have computer L(localhost) and R(remote server).
ssh -N -L <PORT>:127.0.0.1:<PORT> <R-USERNAME>@<R-IP-ADDRESS>
Obviously you are running this script from localhost and connecting to remote.
ufw rules are pretty simple then
sudo ufw allow in from <R-IP-ADDRESS> port <PORT>
sudo ufw allow out to <R-IP-ADDRESS> port <PORT>