Open KanagalakshmiGobiViswanathan opened 7 years ago
Awaiting for the response.
In the PAM module there is a global variable task_id which get set by the method pam_sm_open_session: https://github.com/jeroennijhof/pam_tacplus/blob/master/pam_tacplus.c#L715
... to a random value.
Depending on the application using this PAM module (e.g. sshd) there will be only one instance of the pam_tacplus in memory. So every open PAM session (e.g. ssh login) might override the task_id with another random value.
Requires individual research on each PAM-enabled application.
I'm more current on the Tacacs+ protocol than the PAM API, so someone else will need to answer this. Can we store the task_id
in a struct pam_data
hanging off pamh->data
?
@KanagalakshmiGobiViswanathan , which SSH daemon implementation is used? I have doubt that openssh is used here.
In my version, I added a global session_taskid, set it in pam_sm_open_session after task_id is initialized, and set task_id from session_taskid in pam_sm_close_session, so they match in the accounting record. That seemed to resolve the problem for me and our customers.
I don't see a need to stash it off the pam handle. It doesn't matter how many copies of this library are in use, what matters is that for each use, the open/close id matches in the accounting start/stop for each instance.
Opened three ssh sessions using pam_tacplus.so library and observed that task ids are not matching in the start and stop messages.
Dump of start accounting messages
Now i closed the ssh session in the order of
abc3
,abc1
andabc2
But i observe same task_id41556
for all stop messages.Dump of stop accounting messages:
Expected : taskid for
abc3
is to be17774
but it shows task_id as41556