linux统一身份认证,OpenLDAP统一身份认证 [CentOS6/7]

这篇博客介绍了如何在CentOS6和CentOS7上搭建OpenLDAP统一身份认证系统,并实现双主从同步,确保数据备份和避免单点故障。内容包括OpenLDAP的安装、管理员密码设置、系统日志配置、基础组织树创建、安全加固、主从复制以及多主同步的详细步骤。
摘要由CSDN通过智能技术生成

本文CentOS6/CentOS7 Linux系统平台,构建OpenLDAP的统一身份认证和双主从同步架构。

即两台LDAP服务器互为主、备,其中任一节点数据更新,将自动同步到另外一个节点上,从而达到数据备份,避免了单点故障。

a06b0740eaa3391d8ae431036d9424b2.png

1.OpenLDAP安装 #CentOS7或CentOS7

[root@centos ~]# yum install -y openldap-servers openldap-clients

[root@centos ~]# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG

[root@centos ~]# chown ldap. /var/lib/ldap/DB_CONFIG

启动OpenLDAP服务,并添加到开机启动列表中 #CentOS6

[root@centos ~]# service slapd start

[root@centos ~]# chkconfig slapd on #CentOS7

[root@centos ~]# systemctl start slapd

[root@centos ~]# systemctl enable slapd

2.设置LDAP管理员密码(admin)

使用slappasswd 生成加密后的密码 [root@centos ~]# slappasswd -s admin

New password:

Re-enter new password:

{SSHA}nKn/k9v72WiAF28quBZiGwBHyINg8rgF

首先查找当前系统ldap的配置数据库名称,注意CentOS7默认采用hdb数据库,CentOS6默认采用bdb数据库 #CentOS6

[root@centos6 ~]# sudo slapcat -b cn=config | grep "^dn: olcDatabase="

dn: olcDatabase={-1}frontend,cn=config

dn: olcDatabase={0}config,cn=config

dn: olcDatabase={1}monitor,cn=config

dn: olcDatabase={2}bdb,cn=config #CentOS7

[root@centos7 ~]# sudo slapcat -b cn=config | grep "^dn: olcDatabase="

dn: olcDatabase={-1}frontend,cn=config

dn: olcDatabase={0}config,cn=config

dn: olcDatabase={1}monitor,cn=config

dn: olcDatabase={2}hdb,cn=config

通过ldap api,将密码写入ldap配置数据库,注意将olcDatabase修改成对应系统的配置数据库名称: #CentOS7

[root@centos6 ~]# ldapmodify -Q -Y EXTERNAL -H ldapi:/// <

dn: olcDatabase={2}bdb,cn=config

changetype: modify

add: olcRootPW

olcRootPW: {SSHA}nKn/k9v72WiAF28quBZiGwBHyINg8rgF

EOF #CentOS6

[root@centos7 ~]# ldapmodify -Q -Y EXTERNAL -H ldapi:/// <

dn: olcDatabase={2}hdb,cn=config

changetype: modify

add: olcRootPW

olcRootPW: {SSHA}nKn/k9v72WiAF28quBZiGwBHyINg8rgF

EOF

注意: (1).两种方式新增的密码,在olcDatabase={2}bdb.ldif或olcDatabase={2}hdb

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值