第八单元
LDAP 网络用户账户
学习目标
• LDAP 客户端配置
• 自动挂载器元字符
使用 LDAP 服务器进行网络身份验证
在多个系统上将本地用户账户协调一致非常困难本节中 , 我们将介绍如何将计算机设置为客户端 , 以使用现有 LDAP 目录服务提供的网络用户账户。这样 , LDAP 目录就成为我们组织中所有网络用户和组的中心机构用户账户信息可以确定装户的特征和配置。身份验证方式用于确定尝试登录的人员是否应该获得对账户的使用权限。网络目录服务可以提供用户账户信息和身份验证方法LDAP 目录服务器可以用作分布式、集中式、网络用户管理服务。目录条目按树结构排列 , 可以在其中进行搜索。基础 DN ( 区分名称 ) 是树的基础 , 用于搜索用户和组的目录条目
LDAP 客户端配置的主要元素
– 1. 服务器的完全限定主机名
– 2. 基础 DN , 用于搜索用户定义
– 3. 认证机构 (“ CA” ) 证书 , 用于签署 LDAP 服务器的 SSL 证书
安装客户端软件
• authconfig-gtk
• sssd
• krb5-workstation
[root@localhost mnt]# yum install sssd krb5-workstation authconfig-gtk -y
通过 authconfig-gtk 认证 ldap 用户
• authconfig-gtk
检测 ldap 认证用户
• getent passwd ldapuserx
• vim /etc/sssd.conf
– enumerate = ture | false
– systemctl restart sssd
通过 authconfig-tui 认证 ldap 用户
• authconfig-tui
用脚本实现认证
[root@localhost mnt]# vim auth-config.sh
#!/bin/bash
echo "install packages..."
yum install sssd krb5-workstation autofs -y &> /dev/null
echo "config authconfig..."
authconfig \
--enableldap \
--enablekrb5 \
--disableldapauth \
--enableldaptls \
--ldapserver="classroom.example.com" \
--ldapbasedn="dc=example,dc=com" \
--ldaploadcacert=http://172.25.254.254/pub/example-ca.crt \
--krb5realm="EXAMPLE.COM" \
--krb5kdc="classroom.example.com" \
--krb5adminserver="classroom.example.com" \
--update
echo "config autofs..."
echo "/home/guests /etc/auto.ldap" >>/etc/auto.master
echo "* 172.25.254.254:/home/guests/&" >>/etc/auto.ldap
systemctl restart autofs
下载证书文件
• cd /etc/openldap/cacerts
• wget http://classroom.example.com/pub/example-ca.crt
• ls /etc/openldap/cacerts
• 安装 autofs
• 编辑 autofs 策略文件
– vim /etc/autos.master
/home/guests /etc/auto.ldap
– vim /etc/auto.ldap
ldapuser0 classroom.example.com:/home/guests/ldapuser0
LDAP 网络用户账户
学习目标
• LDAP 客户端配置
• 自动挂载器元字符
使用 LDAP 服务器进行网络身份验证
在多个系统上将本地用户账户协调一致非常困难本节中 , 我们将介绍如何将计算机设置为客户端 , 以使用现有 LDAP 目录服务提供的网络用户账户。这样 , LDAP 目录就成为我们组织中所有网络用户和组的中心机构用户账户信息可以确定装户的特征和配置。身份验证方式用于确定尝试登录的人员是否应该获得对账户的使用权限。网络目录服务可以提供用户账户信息和身份验证方法LDAP 目录服务器可以用作分布式、集中式、网络用户管理服务。目录条目按树结构排列 , 可以在其中进行搜索。基础 DN ( 区分名称 ) 是树的基础 , 用于搜索用户和组的目录条目
LDAP 客户端配置的主要元素
– 1. 服务器的完全限定主机名
– 2. 基础 DN , 用于搜索用户定义
– 3. 认证机构 (“ CA” ) 证书 , 用于签署 LDAP 服务器的 SSL 证书
安装客户端软件
• authconfig-gtk
• sssd
• krb5-workstation
[root@localhost mnt]# yum install sssd krb5-workstation authconfig-gtk -y
通过 authconfig-gtk 认证 ldap 用户
• authconfig-gtk
检测 ldap 认证用户
• getent passwd ldapuserx
• vim /etc/sssd.conf
– enumerate = ture | false
– systemctl restart sssd
通过 authconfig-tui 认证 ldap 用户
• authconfig-tui
[root@localhost mnt]# authconfig-tui
用脚本实现认证
[root@localhost mnt]# vim auth-config.sh
#!/bin/bash
echo "install packages..."
yum install sssd krb5-workstation autofs -y &> /dev/null
echo "config authconfig..."
authconfig \
--enableldap \
--enablekrb5 \
--disableldapauth \
--enableldaptls \
--ldapserver="classroom.example.com" \
--ldapbasedn="dc=example,dc=com" \
--ldaploadcacert=http://172.25.254.254/pub/example-ca.crt \
--krb5realm="EXAMPLE.COM" \
--krb5kdc="classroom.example.com" \
--krb5adminserver="classroom.example.com" \
--update
echo "config autofs..."
echo "/home/guests /etc/auto.ldap" >>/etc/auto.master
echo "* 172.25.254.254:/home/guests/&" >>/etc/auto.ldap
systemctl restart autofs
echo "ok !!"
[root@localhost mnt]# sh auth-config.sh
下载证书文件
• cd /etc/openldap/cacerts
• wget http://classroom.example.com/pub/example-ca.crt
• ls /etc/openldap/cacerts
[root@localhost mnt]# wget http:/172.25.254.254/pub/example-ca.crt ##下载证书文件
• 安装 autofs
• 编辑 autofs 策略文件
[root@localhost mnt]# yum install autofs -y
– vim /etc/autos.master
/home/guests /etc/auto.ldap
– vim /etc/auto.ldap
ldapuser0 classroom.example.com:/home/guests/ldapuser0
[root@localhost mnt]# vim /etc/autofs.master ##在配置文件中写入/home/guests /etc/auto.ldap
[root@localhost mnt]# vim /etc/auto.ldap ##在配置文件写入* 172.25.66.254:/home/guests/& 自动挂在 ldap 用户家目录