CIT 470 Advanced Network and System Administration: Lab #8: LDAP Authentication | |||||||
|
|||||||
In this lab, we'll migrate the existing user accounts and groups on our system to the LDAP directory, then configure PAM to use the LDAP server on the virtual machine for authentication. This task is a common procedure in environments that are migrating from file-based network-based authentication systems.
This lab assumes that you have completed the previous LDAP lab, where you set up an LDAP server on the physical machine and configured your virtual machine as an LDAP client. Since you are obtaining your IP addresses via DHCP, your IP addresses may have changed since the previous lab, requiring you to modify the LDAP client configuration to point to the correct server. Use the ifconfig command to check the IP address of your physical machine (the LDAP server) and compare it against /etc/openldap/ldap.conf on the virtual machine before doing any of the steps of the lab. Use the service command on the physical machine to verify that the LDAP server is running before starting the lab too.
Edit the LDAP client configuration file on both physical and virtual machines.
cd /etc/openldap cp -p ldap.conf ldap.conf.bak
vim /etc/openldap/ldap.conf
grep password /etc/pam.d/system-auth
cd /etc cp -p ldap.conf ldap.conf.dist
vim ldap.conf
service ldap stop
rm /var/lib/ldap/*
cd /usr/share/openldap/migration less README
vim migrate_common.ph
cat >base.ldif <<EOF dn: dc=cit470,dc=nku,dc=edu dc: cit470 objectClass: top objectClass: domain dn: ou=People,dc=cit470,dc=nku,dc=edu ou: People objectClass: top objectClass: organizationalUnit dn: ou=Group,dc=cit470,dc=nku,dc=edu ou: Group objectClass: top objectClass: organizationalUnit EOF slapadd -v -l base.ldif
./migrate_passwd.pl /etc/passwd >passwd.ldif ls -l /etc/passwd passwd.ldif less passwd.ldif slapadd -v -l passwd.ldif
slapcat | less
./migrate_group.pl /etc/group >group.ldif ls -l /etc/group group.ldif less group.ldif slapadd -v -l group.ldif
slapcat | less
ls -l /var/lib/ldap chown -R ldap.ldap /var/lib/ldap
service ldap start
ldapsearch -x -b dc=cit470,dc=nku,dc=edu | less
ldapsearch -x -b uid=root,ou=People,dc=cit470,dc=nku,dc=edu ldapsearch -x -b cn=wheel,ou=Group,dc=cit470,dc=nku,dc=edu
id student
cd /etc cp -p nsswitch.conf nsswitch.conf.dist vim nsswitch.conf
vipw
id student
ssh student@localhost
w
reboot
wireshark &