2006-04-23 03:11:20 +02:00
|
|
|
#!/bin/bash
|
2006-02-09 00:14:01 +01:00
|
|
|
# Adding CASA pam entries to pam files.
|
2006-02-09 01:46:36 +01:00
|
|
|
for file in "/etc/pam.d/login" "/etc/pam.d/sshd" "/etc/pam.d/xdm" "/etc/pam.d/gdm" "/etc/pam.d/kdm"
|
2006-02-09 00:14:01 +01:00
|
|
|
do
|
2006-02-09 01:46:36 +01:00
|
|
|
if [ -f $file ]
|
2006-02-09 00:14:01 +01:00
|
|
|
then
|
2006-02-09 01:46:36 +01:00
|
|
|
sed -i '/pam_micasa/d' $file
|
|
|
|
var=`grep pam_unix2.so $file`
|
|
|
|
entry=`echo -e "auth\t required\tpam_micasa.so"`
|
|
|
|
if [ "$var" != "" ]
|
2006-02-09 00:14:01 +01:00
|
|
|
then
|
2006-02-09 01:46:36 +01:00
|
|
|
sed -i "/^auth.*required.*pam_unix2.so/a$entry" $file
|
2006-02-18 00:14:27 +01:00
|
|
|
continue
|
2006-02-09 01:46:36 +01:00
|
|
|
fi
|
|
|
|
var2=`grep common-auth $file`
|
|
|
|
if [ "$var2" != "" ]
|
|
|
|
then
|
|
|
|
sed -i "/^auth.*include.*common-auth/a$entry" $file
|
2006-02-18 00:14:27 +01:00
|
|
|
continue
|
2006-02-09 00:14:01 +01:00
|
|
|
fi
|
2006-02-18 00:14:27 +01:00
|
|
|
sed -i "0,/^auth/s/^\(auth.*\)/\1\n$entry/" $file
|
2006-02-09 00:14:01 +01:00
|
|
|
fi
|
2006-02-09 01:46:36 +01:00
|
|
|
done
|