Say I have an SSH server, with port forwarding enabled. It's fairly simple for a user to set up an SSH connection and forward BitTorrent traffic or other illegal or abusive traffic over it. How can I set up logging to record what port forwards users make?
|
|
I have used the patch on this web page (slightly altered) http://blog.rootshell.be/2009/03/01/keep-an-eye-on-ssh-forwarding/ to log ssh port forwards. |
|||
|
|
|
I'm asking a question here How can a SSH host process detect which ports have been forwarded by the client (-R not -L) to find a more elegant way to do this same thing. However, since it's not looking like there is a better way, I do it with
99999 is the PID of the There are a few ways to make use of this snippet. Either have a long-running process that watches for new instances of |
|||
|
|
|
you might try wireshark. I'm honestly not sure if it will do specifically what you want, but it can certainly determine what users are doing on the network. Spiceworks is another free option |
|||
|
|
|
meanwhile in the other side of the console
Of course you won't know the port specified in grep, grep it's here to constraint my output and
et voila! you know that user "user" is redirecting port 12345 using sshd script & cron something using this |
|||
|
|