I'd like to make a git-daemon go through a permanent ssh tunnel. I accomplished this task. How do I block any remote untunneled connection to the GIT_DAEMON port (9418 in my case)?
I already tried simple rules in iptables (block everything except localhost):
$ iptables -A INPUT -p tcp -d ! localhost --destination-port 9418 -j DROP
But it also blocks a tunnel (since it saves source ip address). If I have one more host for firewall it can be simply done by blocking any remote connection to this port, but I need this host to do this job.
The tunnel is created in one of two ways:
For Windows:
plink.exe -N -i <key> -L 127.0.0.1:9418:192.168.1.69:9418 tunnel@192.168.1.69
For Linux:
ssh -N -i <key> -L 127.0.0.1:9418:192.168.1.69:9418 tunnel@192.168.1.69