echo This script will [hopefully] update Fedora 16+ to use LDAPS
echo written by Jon S. and Nate G. @ JMU.edu
echo A.Y.B.A.B.U.
# First install LDAP PAM Modules missing from basic install
yum install pam_krb5 nss-pam-ldapd -y
# Enable LDAP authentication
/usr/sbin/authconfig --kickstart --enableldapauth --ldapserver ldap.redhat.com --ldapbasedn dc=ldap,dc=redhat,dc=com --update
#edit the /etc/pam_ldap.conf file
cat >>/etc/pam_ldap.conf <<EOF
base dc=ldap,dc=redhat,dc=com
port 636
nss_initgroups_ignoreusers root,ldap,named,avahi,haldaemon,dbus,radvd,tomcat,radiusd,news,mailman,nscd,gdm
ssl on
uri ldaps://ldap.redhat.com:636
tls_cacertdir /etc/openldap/cacerts
pam_password md5
binddn
USERNAME@redhat.com
bindpw BIGPASSWORD
pam_login_attribute cn
EOF
#edit the /etc/openldap/ldap.conf file
cat >>/etc/openldap/ldap.conf <<EOF
URI ldaps://ldap.redhat.com:636
BASE dc=ldap,dc=redhat,dc=com
TLS_REQCERT demand
TLS_CACERTDIR /etc/openldap/cacerts
EOF
cd /etc/pam.d
/bin/cp system-auth /root/system-auth.orig
/bin/sed -e 's/account.*\[default/#account \[default/' system-auth > system-auth.1
/bin/mv -f system-auth.1 system-auth
cd /etc/openldap/cacerts
ln -s /etc/pki/tls/certs/ca-bundle.crt ca-bundle.pem
echo Restart your system and make sure it worked.
echo