I have a reverse tunnel on my home server so that I can have access to it from the external world. My home server is behind a firewall.

When I access [mydomain]:8080 it forwards my HTTP request through the established connection, that was initiated by my home computer, to my home computer where it creates a connection (from localhost) to my server on port 80. Everything works, just all apache's logs now say requests came from localhost. I really would like to find out more about who connects to my server.

This is the command I'm running to create the reverse tunnel:

autossh -i mykeyfile -N -f -g -R \*:8080:localhost:80 myuser@mydomain

I've tried checking /var/log/auth.log it didn't have anything relevant though.

  • If the firewall is doing it, I am afraid you will need firewall logs. If Apache is seeing the public IP, you will need to log X-Forwarded-For. techstacks.com/howto/… I personally use a VPN, and if you scan my public IP, you just see the isakmp port. Everything else, including ssh (and nginx, DNS, DHCP, asterisk) only works after the VPN is established. (bonus: it is configured to work with the native VPN clientes of OS/X and iOS) Commented Dec 6, 2015 at 8:58

1 Answer 1

  • Change your tunnel to listen remotely on localhost:8080 instead of *:80.

  • Install Apache on mydomain and configure a reverse proxy from 80 to localhost:8080 using ProxyPass and ProxyPassReverse directives.

  • Tell apache to add client's address as standard http headers X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Port using RequestHeader append directive

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .