|
本文操作系统环境:CentOS Linux release 7.7.1908 (Core)
安装OpenLDAP
使用命令安装OpenLDAP:
软件包 | 软件包说明 | openldap | 服务端和客户端必须用的库文件 | openldap-clients | 在LDAP服务端使用,用户增删改查的命令行环境 | openldap-servers | 用于启动服务和配置,包括单独的LDAP后台守护进程 | openldap-servers-sql | 支持SQL模块 | compat-openldap | openldap兼容性库环境 |
安装完会创建用户ldap和用户组ldap,这个用户是不能登录的/sbin/nologin。可以使用如下命令查看:
查看OpenLDAP版本:
@(#) $OpenLDAP: slapd 2.4.44 (Jan 29 2019 17:42:45) $
mockbuild@x86-01.bsys.centos.org:/builddir/build/BUILD/openldap-2.4.44/openldap-2.4.44/servers/slapd
tlsmc_get_pin: INFO: Please note the extracted key file will not be protected with a PIN any more, however it will be still protected at least by file permissions.
OpenLDAP 的相关配置文件信息
- /etc/openldap/slapd.conf:OpenLDAP的主配置文件,记录根域信息,管理员名称,密码,日志,权限等
- /etc/openldap/slapd.d/*:这下面是/etc/openldap/slapd.conf配置信息生成的文件,每修改一次配置信息,这里的东西就要重新生成
- /etc/openldap/schema/*:OpenLDAP的schema存放的地方
- /var/lib/ldap/*:OpenLDAP的数据文件
- /usr/share/openldap-servers/slapd.conf.obsolete 模板配置文件
- /usr/share/openldap-servers/DB_CONFIG.example 模板数据库配置文件
OpenLDAP监听的端口:
默认监听端口:389(明文数据传输)
加密监听端口:636(密文数据传输)
注意:从OpenLDAP2.4.23版本开始所有配置数据都保存在/etc/openldap/slapd.d/中,建议不再使用slapd.conf作为配置文件。
配置OpenLDAP管理员密码
[root@VM_0_9_centos ~]# slappasswd -s 123456
{SSHA}JwllmtEOe2awW0EJjLsaQ3Fpioxx70nU
[root@VM_0_9_centos ~]#
密码设置好了之后呢,保存好,下面会使用到。
修改olcDatabase={2}hdb.ldif文件
命令:
对于该文件增加一行 olcRootPW: {SSHA}JwllmtEOe2awW0EJjLsaQ3Fpioxx70nU,然后修改域信息:
注意:其中cn=admin中的admin表示OpenLDAP管理员的用户名,而olcRootPW表示OpenLDAP管理员加密后的密码,明文密码是123456。
修改olcDatabase={1}monitor.ldif文件
命令如下:
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=extern
al,cn=auth" read by dn.base="cn=admin,dc=itsvse,dc=com" read by * none
注意:该修改中的dn.base是修改OpenLDAP的管理员的相关信息的。
验证OpenLDAP的基本配置,使用如下命令:
[root@VM_0_9_centos ~]# slaptest -u
5eef6741 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif"
5eef6741 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}hdb.ldif"
config file testing succeeded
提示信息config file testing succeeded表示配置是OK
LDAP数据库配置
OpenLDAP默认使用的数据库是BerkeleyDB,现在来开始配置OpenLDAP数据库,使用如下命令:
启动LDAP服务
导入schemas
创建基本的用户节点,数据库管理员
新建 basedomain.ldif 文件,内容如下:
执行命令,添加配置, 这里要注意修改域名为自己配置的域名,然后需要输入上面我们生成的密码
下载 LdapAdmin 管理工具
下载地址:http://www.ldapadmin.org/download/ldapadmin.html
或者直接下载:
尝试链接,如下图:
(完)
参考资料:
https://www.openldap.org/doc/admin24/
https://blog.csdn.net/dengchenrong/article/details/88389947
https://www.cnblogs.com/lemon-le/p/6266921.html
https://blog.csdn.net/bloodzer0/article/details/106805913/
https://blog.csdn.net/weixin_41004350/article/details/89521170
https://blog.csdn.net/liuying1802028915/article/details/82878585
|
上一篇:OpenLDAP 系列(一)LDAP入门介绍下一篇:OpenLDAP:Failed to start OpenLDAP Server Daemon.
|