rhel 6.0 rhcsa openldap安装配置文档

上传人:第*** 文档编号:31079365 上传时间:2018-02-04 格式:DOCX 页数:15 大小:690.42KB
返回 下载 相关 举报
rhel 6.0 rhcsa openldap安装配置文档_第1页
第1页 / 共15页
rhel 6.0 rhcsa openldap安装配置文档_第2页
第2页 / 共15页
rhel 6.0 rhcsa openldap安装配置文档_第3页
第3页 / 共15页
rhel 6.0 rhcsa openldap安装配置文档_第4页
第4页 / 共15页
rhel 6.0 rhcsa openldap安装配置文档_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《rhel 6.0 rhcsa openldap安装配置文档》由会员分享,可在线阅读,更多相关《rhel 6.0 rhcsa openldap安装配置文档(15页珍藏版)》请在金锄头文库上搜索。

1、RHEL6 OPENLDAP 的搭建及本地帐户向 LDAP 的迁移一. 服务器环境准备1. 防火墙、selinux 配置安装 RHEL6.0 操作系统(注意是 RHEL6.0,因为不同版本操作系统对应修改的配置文件可能就不一样)配置前我们需要先关闭 iptables 和 selinux。rootldap # iptables -Frootldap # service iptables saveiptables:将防火墙规则保存到 /etc/sysconfig/iptables: 确定rootldap # service iptables stopiptables:清除防火墙规则: 确定ipta

2、bles:将链设置为政策 ACCEPT:filter 确定iptables:正在卸载模块: 确定rootldap # chkconfig iptables offrootldap # setenforce 0rootldap # getenforce Permissiverootldap # grep disabled /etc/selinux/config # disabled - No SELinux policy is loaded.SELINUX=disabled2. 网卡文件配置rootldap # cat /etc/sysconfig/network-scripts/ifcfg-e

3、th0 DEVICE=eth0HWADDR=00:0C:29:97:96:05NM_CONTROLLED=yesONBOOT=staticIPADDR=192.168.37.37NETMASK=255.255.255.0GATEWAY=192.168.37.1DNS1=192.168.37.373. 主机名配置rootldap # cat /etc/sysconfig/networkNETWORKING=yesHOSTNAME=二. 安装配置 Bind DNS Server1. 安装软件 Bind 软件包Linux 下面使用的 DNS 服务端软件叫 bindrpm -qa | grep bin

4、d #查询是否安装了 bind 软件如果没有安装就需要安装了yum install bind* -y2. 修改 Bind 配置文件修改根域配置文件如下,三个 any。最后一个指向是区域配置文件的位置,主要为了和根域配置文件分离,方便管理。rootldap # vim /etc/named.confoptions listen-on port 53 any; ;listen-on-v6 port 53 any; ;allow-query any; ;include /etc/named.rfc1912.zones;修改区域配置文件,添加如下信息,一个是正向解析,一个是方向解析。rootldap

5、# tail /etc/named.rfc1912.zoneszone IN type master;file example.master;allow-update none; ;zone 37.168.192.in-addr.arpa IN type master;file example.ptr;allow-update none; ;3. 创建正向和方向解析文件区域配置文件可以通过拷贝 named.localhost 文件获得rootldap named# pwd/var/namedrootldap named# lschroot dynamic example.ptr named.

6、empty named.loopbackdata example.master named.ca named.localhost slavesrootldap named# cat example.master $TTL 1D IN SOA rname.invalid. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimumNS A 127.0.0.1AAAA :1ldap A 192.168.37.37node1 A 192.168.37.21instructor A 192.168.37.20rootldap named# ca

7、t example.ptr $TTL 1D IN SOA rname.invalid. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimumNS A 127.0.0.1AAAA :137 PTR 20 PTR 38 PTR 三. 安装配置 openldap Server1. 配置好本地 yum 源rootldap ldapuser1# cat /etc/yum.repos.d/rhel.repo servername=serverbaseurl=file:/mntenable=1gpgcheck=0# yum -y install

8、 openldap-servers openldap-clientsrootldap # rpm -qa |grep openldap-*openldap-clients-2.4.19-15.el6.x86_64openldap-2.4.19-15.el6.x86_64openldap-servers-2.4.19-15.el6.x86_642. 生成密码slappasswd 复制显示的密码rootldap # slappasswdNew password: #根据自己的习惯设置响应的密码,此密码为Re-enter new password: #LDAP 密码,导入用户和登陆 phpldapa

9、dminSSHAGXM2gG/n8jyIoFvTzTzo3Isgq9jUKEXk -#redhat,牢记后面有用。3. 生成 openldap 的公钥和私钥# openssl req -new -x509 -nodes -out /etc/pki/tls/certs/slapdcert.pem keyout /etc/pki/tls/certs/slapdkey.pem -days 3654. 编辑 ldap 数据库文件# vim /etc/openldap/slapd.d/cn=config/olcDatabase=1bdb.ldif将 dc=my-domain,dc=com 替换为 dc=

10、example,dc=com在该文件最后增加以下三行olcRootPW: SSHAGXM2gG/n8jyIoFvTzTzo3Isgq9jUKEXk 此处为前面生成的密码,及我的环境的 redhatolcTLSCertificateFile: /etc/pki/tls/certs/slapdcert.pemolcTLSCertificateKeyFile: /etc/pki/tls/certs/slapdkey.pem5. 指定管理员 root 的 DN# vim /etc/openldap/slapd.d/cn=config/olcDatabase=2monitor.ldif将 cn=mana

11、ger,dc=my-domain,dc=com 替换为 cn=Manager,dc=example,dc=com6. 生成 DB 配置文件DB_CONFIG.example 复制到 /var/lib/ldap 重命令为 DB_CONFIGRhel6.0$ cp /usr/share/doc/openldap-servers-2.4.19/DB_CONFIG.example /var/lib/ldap/DB_CONFIGRhel6.1$ cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG7. 开启 sl

12、apd 的 tls 功能# vim /etc/sysconfig/ldap将 SLAPD=LDAPS=no 将的注释取消掉,同时将 no 改为 yes8. 测试 ldap 的配置并启动# slaptest -u# service slapd start# chkconfig slapd on# ldapsearch -x -b dc=example,dc=com9. 迁移本地帐户到 ldap server1. 安装迁移包# yum -y install migrationtools2. 修改迁移脚本# vim /usr/share/migrationtools/migrate_common.p

13、h将 else 部分中的$NAMINGCONTEXTgroup = ou=Group;改为$NAMINGCONTEXTgroup = ou=Groups;修改以下两行$DEFAULT_MAIL_DOMAIN = ””;$DEFAULT_BASE = ”dc=example,dc=com”;将$EXTENDED_SCHEMA = 0; 改为 $EXTENDED_SCHEMA = 1;10.生成 base.ldif 文件rootldap migrationtools# pwd/usr/share/migrationtools# ./migrate_base.pl /tmp/base.ldif将/e

14、tc/passwd, /etc/group 当中需要迁移到 ldapserver 的用户及组的条目分别复制到/tmp/passwd, /tmp/group 中,也可以全部复制过去。生成 passwd.ldif, group.ldif# ./migrate_passwd.pl passwd /tmp/passwd.ldif# ./migrate_group.pl group /tmp/group.ldif11.导入 ldif 文件到 ldap此处会提示你输入密码,此密码即为前面生成的加密密码,我这里是 redhat。# ldapadd -x -W -D ”cn=Manager,dc=example,dc=com” -f /tmp/base.ldif# ldapadd -x -W -D ”cn=Manager,dc=example,dc=com” -f /tmp/passwd.ldif# ldapadd -x -W -D ”cn=Manager,dc=example,dc=com” -f /tmp/group.ldif成功完成,Ok!四. 安装配置 phpldapadmin GUI Web1. 下载 pgpldapadmin 软件到此网址下载:http:/ 安装依赖软件包主要依赖 apache 和 PHP 来实现:#yum i

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号