Aurel
Aurel

Reputation: 3

Retrieve user command in Linux PAM module

I write a pam module that is called when user execute the sudo command. I have already got the username, password, tty, but now, I have to get the user command to encrypt.

If user exec

sudo ls -l

I have to get ls -l

I have no pam app for my module. (So I use only pam_modules.h) and my module is called first in /etc/pam.d/sudo

I thought about using the netlink socket like pam_tty_audit, but I don't thinks this is the best method (or the most simple)

Have you any idea for getting the user command ?

Thank you and sorry for my bad english

Upvotes: 0

Views: 437

Answers (1)

Phillip
Phillip

Reputation: 13668

According to the API documentation of sudo's authentication mechanisms, the command is not passed to the authentication backend, so PAM is the wrong place to do whatever you are trying to do. Consider writing a sudo plugin instead.

Upvotes: 0

Related Questions