ldap网络账号(轻量目录访问协议)

来源:互联网 发布:施耐德plc仿真软件 编辑:程序博客网 时间:2024/05/22 14:56

#######################################

##############ldap网络帐号#############

1.ldap是什么

轻量目录访问协议,可以在任何计算机平台上,用很容易获得的而且数目不断增加的LDAP的客户端程序访问LDAP目录。

2.ldap客户端所须软件

yum sssd krb5-workstation -y

3.如何开启ldap用户认证

1)cd /etc/openldap/cacerts                  无cacerts目录的话新建

2)执行wget http://172.25.254.254/pub/example-ca.crt     下载tls证书

3)authconfig-tui

┌────────────────┤ Authentication Configuration ├─────────────────┐

│                                                                 │

│  User Information        Authentication                         │

│  [ ] Cache Information   [ ] Use MD5 Passwords                  │

│  [*] Use LDAP            [*] Use Shadow Passwords               │

│  [ ] Use NIS             [ ] Use LDAP Authentication            │

│  [ ] Use IPAv2           [*] Use Kerberos                       │

│  [ ] Use Winbind         [ ] Use Fingerprint reader             │

│                          [ ] Use Winbind Authentication         │

│                          [*] Local authorization is sufficient  │

│                                                                 │

│            ┌────────┐                      ┌──────┐             │

│            │ Cancel │                      │ Next │             │

│            └────────┘                      └──────┘             │

│                                                                 │

│                                                                 │

└─────────────────────────────────────────────────────────────────┘

                                                                                           

 

 

┌─────────────────┤ LDAP Settings ├─────────────────┐

│                                                   │

│          [*] Use TLS                              │

│  Server: ldap://classroom.example.com/___________ │

│ Base DN: dc=example,dc=com_______________________ │

│                                                   │

│         ┌──────┐                ┌──────┐          │

│         │ Back │                │ Next │          │

│         └──────┘                └──────┘          │

│                                                   │

│                                                   │

└───────────────────────────────────────────────────┘

                                                      

 

 

 

┌─────────────────┤ Kerberos Settings ├──────────────────┐

│                                                        │

│        Realm: EXAMPLE.COM_____________________________ │

│          KDC: classroom.example.com___________________ │

│ Admin Server: classroom.example.com___________________ │

│               [ ] Use DNS to resolve hosts to realms   │

│               [ ] Use DNS to locate KDCs for realms    │

│                                                        │

│          ┌──────┐                    ┌────┐            │

│          │ Back │                    │ Ok │            │

│          └──────┘                    └────┘            │

│                                                        │

│                                                        │

└────────────────────────────────────────────────────────┘

4)测试

getent passwd ldapuser1  可以正常显示用户信息 证明客户端认证成功(还不可以切换到ldapuser1用户)

5)补充:$1若未获得证书直接执行authconfig-tui则会出现以下报错

 

┌────────────────┤ Warning ├─────────────────┐

│                                            │

│ To connect to a LDAP server with TLS       │

│ protocol enabled you need a CA certificate │

│ which signed your server's certificate.    │

│ Copy the certificate in the PEM format to  │

│ the '/etc/openldap/cacerts' directory.     │

│ Then press OK.                             │

│                                            │

│                  ┌────┐                    │

│                  │ Ok │                    │

│                  └────┘                    │

│                                            │

│                                            │

└────────────────────────────────────────────┘

$2

vim  /etc/sssd/sssd.conf

Enumerate=true                      !添加到domain/default 下      列出所有用户

默认会隐藏网络用户

 

systemctl restart sssd                  重启服务

4.自动挂载用户家目录(autofs详见如何访问网络共享文件系统)

1)yum install autofs -y

   vim /etc/autofs.master

  /home/guests        /etc/auto.ldap

 

   vim /etc/auto.ldap

  ldapuser1         172.25.254.254:/home/guests/ldapuser1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

    *                     172.25.254.254:/home/guests/&

 

systemctl restart autofs  

Systemctl enable autofs                         !!!  

此时可以切换到用户ldapuser1  

 

 

 

0 0
原创粉丝点击