I'm running a test server behind NAT. I've forwarded remote port
2222 from another public IP server (
example.com) to port
22 of the server behind NAT (
localhost) as follows.
autossh -f -N -i /root/.ssh/id_rsa -R 2222:localhost:22 email@example.com
Now the local
ssh server behind NAT getting only
::1 as IP address of all clients irrespective of client's actual IP address.
localhost is like this.
22:27:37 up 8:03, 2 users, load average: 0.03, 0.03, 0.09 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT user tty7 :0 14:24 8:03m 1.27s 0.33s /usr/bin/lxsession -s LXDE-pi -e LXDE user pts/0 ::1 22:27 1.00s 0.34s 0.03s w
localhost has entry like this
Feb 28 22:27:32 localhost sshd: Accepted password for user from ::1 port 55168 ssh2
Now I want to run
csf firewall to block spam IP addresses. So, I want client's actual IP address. How can I do this? Is any
NAT rewriting rule helpful?