zoukankan      html  css  js  c++  java
  • OpenLDAP on Centos7

    一、环境准备

    echo nameserver 114.114.114.114 > /etc/resolv.conf ##更改DNS
    echo 192.168.0.190 hello.com >> /etc/hosts
    systemctl disable firewalld.service && systemctl stop firewalld.service #关闭防火墙
    sed -i 's//#SELINUX/SELINUX=disable/g' /etc/selinux/config ##永久关闭selinux
    setenforce 0
    rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    ##安装扩展源
    yum -y install openldap-servers openldap-clients ##安装openldap服务端和客户端
    cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
    chown ldap:ldap /var/lib/ldap/DB_CONFIG ##授权
    systemctl start slapd && systemctl enable slapd ##启动服务,设置开机启动

    二、配置管理员密码
    ①.slappasswd 或 slappasswd -s 密码(-s 指定密码)
    输入完密码后会生成一串加密字符串
    例:{SSHA}5Qiqn6d4U4U9b1G8A7dKmJAkJcUOA4fE #保存,后面会用到
    ②.vim chrootpw.ldif
    # specify the password generated above for "olcRootPW" section
    dn: olcDatabase={0}config,cn=config
    changetype: modify
    add: olcRootPW
    olcRootPW: 上面生成的密码
    ldapadd -Y EXTERNAL -H ldapi:/// -f chrootpw.ldif
    ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
    ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif
    ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif

    三、在数据库中设置你的域名
    1.生成密码
    slappasswd
    2.vi chdomain.ldif
    # replace to your own domain name for "dc=***,dc=***" section
    # specify the password generated above for "olcRootPW" section
    dn: olcDatabase={1}monitor,cn=config
    changetype: modify
    replace: olcAccess
    olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth"
    read by dn.base="cn=admin,dc=hello,dc=com" read by * none

    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    replace: olcSuffix
    olcSuffix: dc=hello,dc=com

    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    replace: olcRootDN
    olcRootDN: cn=admin,dc=hello,dc=com
    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    add: olcRootPW
    olcRootPW: 步奏1中生成的密码

    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    add: olcAccess
    olcAccess: {0}to attrs=userPassword,shadowLastChange by
    dn="cn=admin,dc=hello,dc=com" write by anonymous auth by self write by * none
    olcAccess: {1}to dn.base="" by * read
    olcAccess: {2}to * by dn="cn=admin,dc=hello,dc=com" write by * read
    三、ldapmodify -Y EXTERNAL -H ldapi:/// -f chdomain.ldif
    四、vi basedomain.ldif
    # replace to your own domain name for "dc=***,dc=***" section
    dn: dc=hello,dc=com
    objectClass: top
    objectClass: dcObject
    objectclass: organization
    o: qiqiu com
    dc: qiqiu
    dn: cn=admin,dc=hello,dc=com
    objectClass: organizationalRole
    cn: admin
    description: Directory admin
    dn: ou=People,dc=hello,dc=com
    objectClass: organizationalUnit
    ou: People
    dn: ou=Group,dc=hello,dc=com
    objectClass: organizationalUnit

    ou: Group
    5.ldapadd -x -D cn=admin,dc=hello,dc=com -W -f basedomain.ldif

  • 相关阅读:
    共创力董事长杨学明先生受邀参加CED智慧大会!
    杨学明老师为华宇金信(北京)软件有限公司提供为期两天的内训服务!
    《互联网敏捷测试管理实践》课程大纲 2018.12.15~16 (上海)
    共创力咨询杨学明老师为国电南瑞提供两天的内训服务!
    《软件测试管理》深圳公开课预告 2018.11.23~24 中南海滨大酒店
    软件测试管理的十大挑战
    对于开发人员修改代码引发新问题的处理措施
    热烈庆祝杨学明老师为上海某著名金融互联网公司提供两天的内训服务!
    《高效的互联网研发项目管理》课程大纲
    《软件测试管理》北京公开课预告 2018.9.28~29
  • 原文地址:https://www.cnblogs.com/Z-style/p/5618655.html
Copyright © 2011-2022 走看看