openldap/client-install.sh

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