http://www.jslink.org/linux/openldap-ssl-sssd.html

http://www.unix-power.net/centos7/openldap.html

http://www.learnitguide.net/2016/01/configure-openldap-server-on-rhel7.html

https://www.server-world.info/en/note?os=CentOS_7&p=openldap&f=1

http://news.gtmtech.co.uk/blog/2013/04/03/puppet-ldap-ssh-keys-the-whole-mess/

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html

http://chuansong.me/n/1786706

http://www.yolinux.com/TUTORIALS/LinuxTutorialLDAP-BindPW.html

https://www.pigo.idv.tw/archives/2914

安装

yum -y install openldap openldap-clients openldap-servers migrationtools

配置数据库启动

cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
chown -R ldap:ldap /var/lib/ldap systemctl start slapd
systemctl enable slapd

生成密码

slappasswd
New password:
Re-enter new password:
{SSHA}rXEozcP/ZzlkNfEXUyX8rtvlCgXJUvUi

生成配置文件

cat > /etc/openldap/slapd.conf << _EOF_
#include /etc/openldap/schema/corba.schema
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
#include /etc/openldap/schema/duaconf.schema
#include /etc/openldap/schema/dyngroup.schema
include /etc/openldap/schema/inetorgperson.schema
#include /etc/openldap/schema/java.schema
#include /etc/openldap/schema/misc.schema
include /etc/openldap/schema/nis.schema
#include /etc/openldap/schema/openldap.schema
#include /etc/openldap/schema/ppolicy.schema
#include /etc/openldap/schema/collective.schema allow bind_v2 pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args database config
access to *
by dn.exact="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" manage
by * none database monitor
access to *
by dn.exact="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read
by dn.exact="cn=Manager,dc=suntv,dc=tv" read
by * none database hdb
#下面2条是允许用户自己修改密码
access to attrs=userPassword,shadowLastChange
by self write
by dn.base="cn=Manager,dc=suntv,dc=tv" write
by anonymous auth
by * none
access to *
by dn.base="cn=Manager,dc=suntv,dc=tv" write
by self write
by * read suffix "dc=suntv,dc=tv"
checkpoint 1024 15
rootdn "cn=Manager,dc=suntv,dc=tv"
rootpw {SSHA}rXEozcP/ZzlkNfEXUyX8rtvlCgXJUvUi directory /var/lib/ldap index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub loglevel 256
_EOF_

配置openldap

cd /etc/openldap/
rm -rf slapd.d/*
slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d
chown -R ldap:ldap /etc/openldap/slapd.d
systemctl restart slapd

配置日志

touch /var/log/slapd.log
chown ldap:ldap /var/log/slapd.log
echo 'local4.* /var/log/slapd.log' >> /etc/rsyslog.conf
systemctl restart rsyslog

建立组织结构

vim /usr/share/migrationtools/migrate_common.ph
$DEFAULT_MAIL_DOMAIN = "suntv.tv";
$DEFAULT_BASE = "dc=suntv,dc=tv";
/usr/share/migrationtools/migrate_base.pl > /tmp/base.ldif

# base.ldif 只保留以下内容
dn: dc=suntv,dc=tv
dc: suntv
objectClass: top
objectClass: domain dn: ou=people,dc=suntv,dc=tv
ou: people
objectClass: organizationalUnit dn: ou=group,dc=suntv,dc=tv
ou: group
objectClass: organizationalUnit

ldapadd -x -W -H ldap:/// -D cn=Manager,dc=suntv,dc=tv -f /tmp/base.ldif

or

cat << _EOF_ | ldapadd -x -W -H ldap:/// -D cn=Manager,dc=suntv,dc=tv
dn: dc=suntv,dc=tv
dc: suntv
objectClass: domain
objectClass: top dn: ou=people,dc=suntv,dc=tv
ou: people
objectClass: organizationalUnit dn: ou=group,dc=suntv,dc=tv
ou: group
objectClass: organizationalUnit
_EOF_

建立用户及组

groupadd -g 2001 op
useradd -u 1001 -g 2001 op01; echo '123456' | passwd op01 --stdin
cat /etc/group |egrep '^[a-z]*[0-9]*:x:2[0-9]{3}:' > /tmp/group.txt
/usr/share/migrationtools/migrate_group.pl /tmp/group.txt > /tmp/group.ldif
ldapadd -H ldap:/// -D cn=Manager,dc=suntv,dc=tv -W -x -f /tmp/group.ldif

or

cat << _EOF_ | ldapadd -x -W -H ldap:/// -D cn=Manager,dc=suntv,dc=tv
dn: cn=op,ou=group,dc=suntv,dc=tv
objectClass: posixGroup
cn: op
gidNumber: 2001
_EOF_
cat /etc/passwd |egrep '^[a-z]*[0-9]*:x:1[0-9]{3}:' > /tmp/user.txt
/usr/share/migrationtools/migrate_passwd.pl /tmp/user.txt > /tmp/user.ldif
ldapadd -H ldap:/// -D cn=Manager,dc=suntv,dc=tv -W -x -f /tmp/user.ldif

or

cat << _EOF_ | ldapadd -x -W -H ldap:/// -D cn=Manager,dc=suntv,dc=tv
dn: uid=op01,ou=people,dc=suntv,dc=tv
uid: op01
cn: op01
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
userPassword: 123456
shadowLastChange: 17085
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1001
gidNumber: 2001
homeDirectory: /home/op01
_EOF_
# 查询用户
ldapsearch -H ldap:/// -D cn=manager,dc=suntv,dc=tv -b ou=people,dc=suntv,dc=tv -W -x

客户端

yum -y install openldap-clients nss-pam-ldapd

authconfig --enableldap --enableldapauth --ldapserver=ldap://master.local,ldap://slave.local --ldapbasedn='dc=suntv,dc=tv' --enablemkhomedir --update

登录后变更密码
passwd

openldap安装配置的更多相关文章

  1. openldap 安装 配置 使用

    1.安装 #安装 yum install -y openldap-servers openldap-clients openldap-devel 2.复制配置文件 #复制配置文件 cp /usr/sh ...

  2. OpenLDAP 安装及配置 笔记

    首先下载 OpenLdap(Ldap服务器) 和 LdapAdmin(客户端) 两个软件 OpenLDAPforWindows_2.4.39.part1.rar OpenLDAPforWindows_ ...

  3. 图文介绍openLDAP在windows上的安装配置

    目录 概述 测试环境 安装过程 配置启动 客户端介绍 多级DC的ldif文件的配置 [一].概述 什么叫LDAP呢,概念的东西这里就不多讲了,网上搜索下有很多,本文的重点是介绍如何在windows平台 ...

  4. 【JMeter4.0学习(二)】之搭建openLDAP在windows8.1上的安装配置以及JMeter对LDAP服务器的性能测试脚本开发

    目录: 概述 安装测试环境 安装过程 配置启动 配置搭建OpenLDAP 给数据库添加数据 测试查询刚刚插入的数据 客户端介绍 JMeter建立一个扩展LDAP服务器的性能测试脚本开发 附:LDAP学 ...

  5. centos6.5安装配置LDAP服务[转]

    安装之前查一下 1 find / -name openldap* centos6.4默认安装了LDAP,但没有装ldap-server和ldap-client 于是yum安装 1 su root 2 ...

  6. LDAP安装配置(windows)

    目录 概述 测试环境 安装过程 配置启动 客户端介绍 多级DC的ldif文件的配置 [一].概述 什么叫LDAP呢,概念的东西这里就不多讲了,网上搜索下有很多,本文的重点是介绍如何在windows平台 ...

  7. 03-openldap服务端安装配置

    openldap服务端安装配置 阅读目录 基础环境准备 安装openldap服务端 初始化openldap配置 启动OpenLDAP 重新生成配置文件信息 规划OpenLDAP目录树组织架构 使用GU ...

  8. RHEL7-openldap安装配置二(客户端安装配置)

    LDAP用户登录流程: 当在客户端输入账号登录系统时,系统根据/etc/nsswitch.conf配置文件获取账号查找顺序,然后再根据PAM配置文件调用相关模块,对账号(/etc/passwd)及密码 ...

  9. RHEL7-openldap安装配置一(服务器端安装配置)

    LDAP的术语:entry:一个单独的单元,使用DN(distinguish name)区别attribute:entry的属性,比如,如果entry是组织机构的话,那么它的属性包括地址,电话,传真号 ...

随机推荐

  1. xhprof 安装使用

    1.安装扩展 windows下把 xhprof.dll 放到extensions目录下 修改配置文件 [xhprof] extension=xhprof.so; ; directory used by ...

  2. EXISTS、EXCEPT、INTERSECT 运算符

    转:http://www.cnblogs.com/WizardWu/archive/2011/10/01/2197147.html EXISTS运算符 EXISTS 可称之为运算符,有些书称它为关键词 ...

  3. ylbtech-LanguageSamples-Unsafe(不安全代码)

    ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-Unsafe(不安全代码) 1.A,示例(Sample) 返回顶部 “不安全代码”示例 ...

  4. Linux系统时间设置(转载)

    Linux时钟分为系统时钟(System Clock)和硬件(Real Time Clock,简称RTC)时钟.系统时钟是指当前Linux Kernel中的时钟,而硬件时钟则是主板上由电池供电的时钟, ...

  5. CentOS yum安装和配置MySQL(转载)

    From:http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html] 一.MySQL简介 说到数据库,我们大多想到 ...

  6. APPDelegate----launchOptions启动类型

    IOS 中的 AppDelegate.m/h 文件是很重要的呢,因为它是对 Application 的整个生命周期进行管理的. 先明白,每个iPhone应用程序都有一个UIApplication,UI ...

  7. SPR EAD NET 6

    SPR EAD_NET6 下载地址 http://www.gcpowertools.com.cn/downloads/trial/Spread.NET/EN_SPREAD_NET6_SETUP_RA_ ...

  8. [ActionScript 3.0] AS3.0 获取像素点的灰度

    /** * 获取像素点的灰度 * @color 像素点的颜色值 * @return uint */ function getGray(color:uint):uint { return getR(co ...

  9. gomobile 真机 log 打出的日志跟踪

    go mobile 开发的应用,真机调试时,我们期望看到log包打出的日志, 这时候就需要借用 Android Device Monitor 了. 我们的 go 代码中用最简单的 log.Printl ...

  10. flask log

    import logging from logging.handlers import RotatingFileHandler from flask import Flask app = Flask( ...