A puzzle about PAM session

Guannan Ma mythmgn at gmail.com
Thu Nov 25 08:09:36 UTC 2010


Hi, all,

I am a newbie to PAM. Recently, I am planning to design a c/s program which
needs auth/session management module.
I thought of PAM. Since i am new to it, things below puzzle me.


*[1] About pam session*

In pam, we get two functions ,pam_open_session pam_close_session

My puzzle is----
after calling pam_open_session, what have i got?

Does that mean I get a fresh env?

In a c/s design, how can i maintain the session?

(I have some exp on web-program design in which i get a structure called
session that can maintain the relationship between a browser user and web
server). But in pam, how can i know the session runs out of time?
Do I have to write a feature to fulfill it? E.g. Store a time_t variable.
Fresh it when a users send some tcp/udp package to the server.


*[2] About credential*

Cite some pam doc lines here:

On a Linux system the user's UID and GID's are credentials too. However, it
has been decided that these properties (along with the default supplementary
groups of which the user is a member) are credentials that should be set
directly by the application and not by PAM. Such credentials should be
established, by the application, prior to a call to this function. For
example, initgroups(2) (or equivalent) should have been performed.

Here, the pam_setcred does not set uid or gid. I've no idea what the
function can do?
How can I use it?



int pam_setcred(pamh,
 flags);
pam_handle_t *pamh;
int flags;


3.1.8.1. DESCRIPTION

The pam_setcred function is used to establish, maintain and delete the
credentials of a user. It should be called to set the credentials after a
user has been authenticated and before a session is opened for the user
(with pam_open_session(3)). The credentials should be deleted after the
session has been closed (with pam_close_session(3)).

A credential is something that the user possesses. It is some property, such
as a Kerberos ticket, or a supplementary group membership that make up the
uniqueness of a given user. On a Linux system the user's UID and GID's are
credentials too. However, it has been decided that these properties (along
with the default supplementary groups of which the user is a member) are
credentials that should be set directly by the application and not by PAM.
Such credentials should be established, by the application, prior to a call
to this function. For example, initgroups(2) (or equivalent) should have
been performed.




Thanks a million.

--
Regards,
Guannan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pam-list/attachments/20101125/2fa6a0af/attachment.htm>


More information about the Pam-list mailing list