Retrieving tcp socket port in PAM module

Sudarshan Soma sudarshan12s at gmail.com
Tue Dec 19 18:34:16 UTC 2017


Hi,
I am invoking my own login shell /bin/myshell once  PAM authentication is
successfull.

My login shell, /bin/myshell requires remote ip (of client) , remote port
(socket opened on node, where PAM module is sitting.

I could get remote host, from PAM_RHOST

retval = pam_get_item(pamh, PAM_RHOST, (const void **) &rhost);


Can somebody please suggest, how to get port. I know sshd has this
information as i cna see in the sshd logs, but how do i retrieve it in PAM
module .


sshd logs has port no, 50469

Oct  9 07:20:43 x86-hw auth.info sshd[13128]: Accepted none for secadmin
from 10.220.82.17 port 50469 ssh2




Regards,
Ivan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pam-list/attachments/20171220/4c5e8543/attachment.htm>


More information about the Pam-list mailing list