function pam_on()
{
[ ! -f $PAM_BACKUP ] && cp $PAM_SSHD $PAM_BACKUP
cat >$PAM_SSHD <<EOF
#%PAM-1.0
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
#account required pam_access.so
account requisite pam_listfile.so item=user sense=allow file=$CONF onerr=succeed
account include password-auth
password include password-auth
# pam_seLinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session optional pam_keyinit.so force revoke
session include password-auth
EOF
cat > $CONF <<EOF
root
user1
user2
EOF
cat > $SUDO <<EOF
user1 ALL=(ALL) NOPASSWD: ALL
user2 ALL=(ALL) NOPASSWD: ALL
EOF
for u in `echo $1 | tr ',' ' '`;do
echo "$u" >> $CONF
echo "$u ALL=(ALL) NOPASSWD: ALL" >> $SUDO
done
}
|