Only experienced developer please!!
We need a stable way of determining the:
1) remote hosts public IP address of a linux login session, if the session is indeed initiated remotely (ssh/telnet).
2) the TCP port of the destination public ip address;
The C code:
A) must deliver the same public IP address AND the destination TCP port even across sub-sessions like sudo/su/pbrun.
B) must be in the form of a C function or a set of utility functions written in C.
C) must be portable between different linux distributions.
Example: A user using public IP [url removed, login to view] connects to a server IP address [url removed, login to view]
On the server side I entered the command: netstat |grep -i [url removed, login to view]
tcp 0 0 li598-171.members.l:ssh [url removed, login to view] ESTABLISHED
The C code will need to provide: 1) remote host IP address: [url removed, login to view] and 2) the TCP port is 54205
To my understanding it is not possible to run netstat or ss because you can only see process groups you own.
Most important:: I want to tell you that we managed to get via ssh the public IP, but not the TCP port. Via Sudo we got the TCP port, but not the public IP
Hi I am linux kernel developer, So I may help you with your issue. I think that bash script could be good enough, but C code is okay too. Please pm me of interested