openldap/client-install.sh

raw link view readme
1 yum install oddjob oddjobmkhomedir -y
2
3 systemctl start oddjobd
4 systemctl enable oddjobd
5
6 yum install openldap-clients nss-pam-ldapd -y
7
8 cat > /root/setup.sh << EOF
9 authconfig --enableldaptls --enableldap --ldapserver=$1 --ldapbasedn="dc=example,dc=net" --enablemkhomedir --update
10
11 #+ create template
12 ldapsearch -x -LLL -H ldap://$1 -b dc=example,dc=net "(&(objectclass=account)(uid=davidbetz))" | sed "/^userPassword:/d;/^ /d" > ~/user_template.ldif
13
14 cat > /root/verification.sh << EOF2
15 #!/bin/bash
16 grep ldap /etc/nsswitch.conf
17
18 getent passwd
19
20 ldapsearch -x -H ldap://$1 -b dc=example,dc=net
21 ldapsearch -x -LLL -H ldap://$1 -b dc=example,dc=net
22 ldapsearch -x -LLL -H ldap://$1 -b dc=example,dc=net "(objectclass=account)"
23 ldapsearch -x -LLL -H ldap://$1 -b dc=example,dc=net "(&(objectclass=account)(uid=davidbetz))"
24 ldapsearch -x -LLL -H ldap://$1 -b dc=example,dc=net "(&(objectclass=account)(uid=davidbetz))" uidNumber uid
25 EOF2
26 chmod +x /root/verification.sh
27
28 wget https://linux.azure.david.betz.space/raw/openldap/ldapuseradd.sh -O /root/ldapuseradd.sh
29 chmod +x /root/ldapuseradd.sh
30
31 EOF
32
33 chmod +x /root/setup.sh
34