| 1 |
README |
| 2 |
|
| 3 |
PAM-script has been written by Jeroen Nijhof <[email protected]> |
| 4 |
with packaging and some modifications by R.K. Owen <[email protected]>. |
| 5 |
|
| 6 |
Description: |
| 7 |
PAM-script allows you to execute scripts during authorization, |
| 8 |
passwd changes, or session opening or closing. |
| 9 |
|
| 10 |
So if you need extra work done after login you can use this pam |
| 11 |
module to execute a session script. |
| 12 |
|
| 13 |
Options to pam_script.so: |
| 14 |
onerr=(success|fail) - default behavior if the module can not find |
| 15 |
or execute the various pam-scripts. The default is 'fail'. |
| 16 |
|
| 17 |
dir=/some/path - where to find the pam-scripts listed below. |
| 18 |
|
| 19 |
All options are passed on to the script commandlines and those not |
| 20 |
intercepted by PAM may be used to modify the script behavior. |
| 21 |
|
| 22 |
Module-type and Scripts: |
| 23 |
auth: pam_script_auth - username/password handshake |
| 24 |
account: pam_script_acct - non-auth account management |
| 25 |
passwd: pam_script_passwd - changing a password |
| 26 |
session: pam_script_ses_open - actions performed before and |
| 27 |
pam_script_ses_close after a session |
| 28 |
|
| 29 |
All the scripts will be passed several environment variables: |
| 30 |
PAM_USER, PAM_RUSER, PAM_RHOST, PAM_SERVICE, PAM_AUTHTOK, |
| 31 |
PAM_OLDAUTHTOK, PAM_TTY, and PAM_TYPE referring to the module-type. |
| 32 |
Whether the variable has a non-null value or not depends on the |
| 33 |
context. |
| 34 |
|
| 35 |
Pam.conf example: |
| 36 |
|
| 37 |
--- start pam.conf --- |
| 38 |
ssh auth required pam_script.so |
| 39 |
ssh session required pam_script.so |
| 40 |
ssh passwd required pam_script.so |
| 41 |
--- end pam.conf --- |
| 42 |
|
| 43 |
or as an extra step (here pam_script.so is optional because this application |
| 44 |
does some extra logging and doesn't want access denied if there is a problem): |
| 45 |
|
| 46 |
--- start pam.conf --- |
| 47 |
ssh auth required pam_unix.so |
| 48 |
ssh auth optional pam_script.so |
| 49 |
ssh session required pam_unix.so |
| 50 |
ssh session optional pam_script.so |
| 51 |
ssh passwd required pam_unix.so |
| 52 |
ssh passwd optional pam_script.so |
| 53 |
--- end pam.conf --- |
| 54 |
|
| 55 |
This example application has the pam_script_auth script check a database |
| 56 |
and return non-zero if the user should not be granted access. If the |
| 57 |
script does not exist or is not executable at all levels (chmod a+x) |
| 58 |
then deny access. |
| 59 |
ssh auth required pam_unix.so |
| 60 |
ssh auth required pam_script.so onerr=fail |
| 61 |
|
| 62 |
Debugging: |
| 63 |
Get the pamtest.c program from the pam-dotfile distribution and it can be |
| 64 |
used to step through the module. |
| 65 |
|
| 66 |
Examples: |
| 67 |
Look at the README.examples file, which may be located under |
| 68 |
/usr/share/doc/libpam-script/ for a Debian derived distribution. |
| 69 |
|
| 70 |
Problem/BUGS report: |
| 71 |
If you find any bugs or problems just mail me |
| 72 |
Jeroen Nijhof <[email protected]> |
| 73 |
|