| 1 |
This directory gives some pam-script examples. To use these scripts |
| 2 |
they must be placed in the directory indicated by "configure --sysconfdir", |
| 3 |
which is usually /etc/pam-script, and symbolic links need to be made to |
| 4 |
conform to the acceptable list of scripts that are invoked by pam-script: |
| 5 |
pam_script_auth |
| 6 |
pam_script_acct |
| 7 |
pam_script_passwd |
| 8 |
pam_script_ses_open |
| 9 |
pam_script_ses_close |
| 10 |
|
| 11 |
Note that each example requires log or data files that are readable and |
| 12 |
writeable at all levels of authorization, because not all services that |
| 13 |
use PAM are run as the root user (e.g. gnome-screensaver, etc.) and may |
| 14 |
not allow successful access otherwise. Therefore, be aware of the security |
| 15 |
implications though. |
| 16 |
|
| 17 |
logscript: |
| 18 |
Simply records the PAM_* environment variables and the pam_script.so |
| 19 |
arguments to /tmp/pam-script.log. |
| 20 |
It's useful to observe which stages are executed and by whom. |
| 21 |
However, if the script is modified to show PAM_AUTHTOK, this exposes |
| 22 |
the raw password text. |
| 23 |
|
| 24 |
The default behavior for pam-script is to fail if a needed script is |
| 25 |
missing for the corresponding module-type. |
| 26 |
|
| 27 |
To try out the pam-script.so module and the logscript program with the |
| 28 |
various module-types, it's easiest to edit the individual common service |
| 29 |
configuration files. |
| 30 |
|
| 31 |
Make the following symbolic links in /etc/pam-script/ |
| 32 |
ln -s logscript pam_script_auth |
| 33 |
ln -s logscript pam_script_acct |
| 34 |
ln -s logscript pam_script_passwd |
| 35 |
ln -s logscript pam_script_ses_open |
| 36 |
ln -s logscript pam_script_ses_close |
| 37 |
|
| 38 |
or do |
| 39 |
env PAMSCRIPTDIR=. ./pam_script -v -x -s all logscript |
| 40 |
|
| 41 |
For Ubuntu/Debian: |
| 42 |
cat >>/etc/pam.d/common-account <<! |
| 43 |
account optional pam_script.so |
| 44 |
! |
| 45 |
cat >>/etc/pam.d/common-auth <<! |
| 46 |
auth optional pam_script.so |
| 47 |
! |
| 48 |
cat >>/etc/pam.d/common-password <<! |
| 49 |
password optional pam_script.so |
| 50 |
! |
| 51 |
cat >>/etc/pam.d/common-session <<! |
| 52 |
session optional pam_script.so |
| 53 |
! |
| 54 |
|
| 55 |
For RedHat/Fedora: |
| 56 |
cat >> /etc/pam.d/system-auth <<! |
| 57 |
account optional /lib/security/$ISA/pam_script.so |
| 58 |
auth optional /lib/security/$ISA/pam_script.so |
| 59 |
password optional /lib/security/$ISA/pam_script.so |
| 60 |
session optional /lib/security/$ISA/pam_script.so |
| 61 |
! |
| 62 |
|
| 63 |
The RedHat system-auth is generated by authconfig, so these changes will |
| 64 |
vanish unless measures are taken. |
| 65 |
|
| 66 |
For this case, pam_script.so is optional so any failures should not affect |
| 67 |
the rest of the PAM stack. However, be careful though. A mistake could |
| 68 |
render your system inoperable and you may not be able to login easily to fix |
| 69 |
the errant PAM configuration. |
| 70 |
|
| 71 |
tally: |
| 72 |
A pam-script version of the pam-tally module, supporting some of the same |
| 73 |
options: deny, lock_time, unlock_time, magic_root, and even_deny_root_account. |
| 74 |
The other options are ignored. |
| 75 |
The script itself is written in perl and keeps the info in a database, |
| 76 |
/tmp/pam-script-tally.*. Use the tally script to query, set, or reset |
| 77 |
items. Run "tally -h" for further info. |
| 78 |
Set the following symbolic links pointing to tally: |
| 79 |
pam_script_auth |
| 80 |
pam_script_acct |
| 81 |
|
| 82 |
To try out the pam-script.so module and the tally program with the |
| 83 |
auth and account module-types, it's easiest to edit the individual |
| 84 |
common service configuration files. |
| 85 |
|
| 86 |
Make the following symbolic links in /etc/pam-script/ |
| 87 |
ln -s tally pam_script_auth |
| 88 |
ln -s tally pam_script_acct |
| 89 |
|
| 90 |
or |
| 91 |
env PAMSCRIPTDIR=. ./pam_script -v -x -s auth,acct tally |
| 92 |
|
| 93 |
For Ubuntu/Debian: |
| 94 |
cat >>/etc/pam.d/common-account <<! |
| 95 |
account required pam_script.so |
| 96 |
! |
| 97 |
cat >>/etc/pam.d/common-auth <<! |
| 98 |
auth required pam_script.so deny=5 lock_time=30 unlock_time=600 |
| 99 |
! |
| 100 |
|
| 101 |
For RedHat/Fedora: |
| 102 |
cat >> /etc/pam.d/system-auth <<! |
| 103 |
account required /lib/security/$ISA/pam_script.so |
| 104 |
auth required /lib/security/$ISA/pam_script.so \ |
| 105 |
deny=5 lock_time=30 unlock_time=600 |
| 106 |
! |
| 107 |
|
| 108 |
Pam_script.so is listed as "required" so failures will affect the outcome |
| 109 |
of the PAM stack, particularly for authentication, which will lock a |
| 110 |
user with greater than "deny" login failures. |
| 111 |
|