PAM LDAP在Linux Redhat 5和Solaris 10系统上的用户认证

LDAP搭建,实现Linux账号统一管理 详细的LDAP server端和client端的搭建方法 阅读详情

                                     PAM LDAP在Linux Redhat 5和Solaris 10系统上的用户认证


每个系统都需要对用户进行认证Authentication和鉴权Authorization,用户集中管理只需要一份用户信息,简化了管理。通过PAM能够对不同的认证系统进行动态配置,如Radius,LDAP。


PAM LDAP on Linux Redhat5


1 Configure OpenLDAP

OpenLDAP is installed at /usr/local/, the LDAP server configuration file is /usr/local/etc/openldap/slapd.conf, and including the following setting which will be modified according the specific context.

 

#access control

access to * by * read

atabase        bdb

suffix          "dc=cisco,dc=com"

rootdn          "cn=root,dc=cisco,dc=com"

rootpw               Crdc%123

#if log is needed, and add “local4.* /var/log/ldap/ldap.log” into /etc/syslog.conf

loglevel any

 

LDAP client configuration file is etc/openldap/ldap.conf.

 

Then start LDAP server:

# /usr/local/libexec/slapd

 

2 Import user accounts

Create the ldif file to include all the user accounts information. One binding user is required to send binding request to LDAP before authentication start.

 

users.ldif :

 

dn: uid=testbind,dc=cisco,dc=com

uid: testbind

cn: testbind

sn: testbind

userPassword: testbind

uidNumber: 1104

gidNumber: 1100

homeDirectory: /home/testbind

loginShell: /bin/bash

objectClass: inetOrgPerson

objectClass: posixAccount

 

dn: uid=test,dc=cisco,dc=com

uid: test

cn: test

sn: test

userPassword: test

uidNumber: 1105

gidNumber: 1100

homeDirectory: /home/test

loginShell: /bin/bash

objectClass: inetOrgPerson

objectClass: posixAccount

 

….

 

Use the following command to add and search the user accounts:

 

#ldapadd -x -D "cn=root,dc=cisco,dc=com" -W -f users.ldif

#ldapsearch -x -D "cn=root,dc=cisco,dc=com" -W -b "cn=test,dc=cisco,dc=com"

#ldapdelete -x -D "cn=root,dc=cisco,dc=com" -W "ou=people,dc=cisco,dc=com"

 

3 PAM setting

There are many different PAM modules which communicate with different AAA server, these PAM library files are located in /lib64/security(for Linux 64). Use /etc/pam.d/<yourservice-jpam > to relay the authentication to LDAP or other AAA, for instance Radius, modify the ppm-jpam with the following lines:

 

auth        sufficient  /lib64/security/pam_ldap.so config=/etc/ldap.conf

account     sufficient   /lib64/security/pam_ldap.so config=/etc/ldap.conf

 

PAM_LDAP service will use /etc/ldap.conf file to create the connection with LDAP server and verify the users.

 

# Your LDAP server.

host 10.74.125.39

# The distinguished name of the search base.

base dc=cisco,dc=com

ldap_version 3

 

# The distinguished name to bind to the server with.

# Optional: default is to bind anonymously.

binddn uid=testbind,dc=cisco,dc=com

 

# The credentials to bind with.

# Optional: default is no credential.

bindpw testbind

 

# The port.

# Optional: default is 389.

port 389

 

# The search scope.

scope sub

 

# The user ID attribute (defaults to uid)

pam_login_attribute uid


 

4 Verify
 

PAM LDAP on Solaris 10


1 Configure OpenLDAP

OpenLDAP is installed at /usr/local/, the LDAP server configuration file is /usr/local/etc/openldap/slapd.conf, and including the following setting which will be modified according the specific context.

#

# See slapd.conf(5) for details on configuration options.

# This file should NOT be world readable.

#

include         /usr/local/etc/openldap/schema/core.schema

include         /usr/local/etc/openldap/schema/corba.schema

include         /usr/local/etc/openldap/schema/cosine.schema

include         /usr/local/etc/openldap/schema/inetorgperson.schema

include         /usr/local/etc/openldap/schema/misc.schema

include         /usr/local/etc/openldap/schema/openldap.schema

include         /usr/local/etc/openldap/schema/nis.schema

include         /usr/local/etc/openldap/schema/gehua.schema

include         /usr/local/etc/openldap/schema/duaconf.schema

include         /usr/local/etc/openldap/schema/solaris.schema

#include        /usr/local/etc/openldap/schema/DUAConfigProfile.schema

 

# Define global ACLs to disable default read access.

 

# Do not enable referrals until AFTER you have a working directory

# service AND an understanding of referrals.

#referral       ldap://root.openldap.org

 

pidfile         /usr/local/var/run/slapd.pid

argsfile        /usr/local/var/run/slapd.args

 

# Load dynamic backend modules:

# modulepath    /usr/local/libexec/openldap

# moduleload    back_bdb.la

# moduleload    back_hdb.la

# moduleload    back_ldap.la

 

# Sample security restrictions

#       Require integrity protection (prevent hijacking)

#       Require 112-bit (3DES or better) encryption for updates

#       Require 63-bit encryption for simple bind

# security ssf=1 update_ssf=112 simple_bind=64

 

# Sample access control policy:

#       Root DSE: allow anyone to read it

#       Subschema (sub)entry DSE: allow anyone to read it

#       Other DSEs:

#               Allow self write access

#               Allow authenticated users read access

#               Allow anonymous users to authenticate

#       Directives needed to implement policy:

# access to dn.base="" by * read

# access to dn.base="cn=Subschema" by * read

# access to *

#       by self write

#       by users read

#       by anonymous auth

 

 

access to * by * read

 

#

# if no access controls are present, the default policy

# allows anyone and everyone to read anything but restricts

# updates to rootdn.  (e.g., "access to * by * read")

#

# rootdn can always read and write EVERYTHING!

 

#######################################################################

# BDB database definitions

#######################################################################

 

database        bdb

suffix          "dc=cisco,dc=com"

# suffix                "DC=mbaruch, DC=local"

rootdn          "cn=root,dc=cisco,dc=com"

# rootdn                "CN=root,DC=mbaruch, DC=local"

# Cleartext passwords, especially for the rootdn, should

# be avoid.  See slappasswd(8) and slapd.conf(5) for details.

# Use of strong authentication encouraged.

# rootpw                secret

rootpw               Crdc%123

# The database directory MUST exist prior to running slapd AND

# should only be accessible by the slapd and slap tools.

# Mode 700 recommended.

directory       /usr/local/var/openldap-data

# Indices to maintain

index   objectClass     eq

 

sizelimit 1000

loglevel any

 

#TLSCACertificateFile /etc/openldap/cacerts/cacert.pem

#TLSCertificateFile /etc/openldap/cacerts/server.cert

#TLSCertificateKeyFile /etc/openldap/cacerts/server.key

 

TLSCACertificateFile /usr/local/etc/openldap/ca/cacert.pem

TLSCertificateFile /usr/local/etc/openldap/ca/servercrt.pem

TLSCertificateKeyFile /usr/local/etc/openldap/ca/serverkey.pem

 

TLSVerifyClient never

#ssl start_tls

 

2 Import user accounts

Create the ldif file to include all the user accounts information. One binding user is required to send binding request to LDAP before authentication start.

 

Use the following command to import base.ldif, groups.ldif and passwd.ldif into LDAP server.

 

#ldapadd -x -D "cn=root,dc=cisco,dc=com" -W -f ***.ldif

 

base.ldif

 

dn: ou=People,dc=cisco,dc=com

ou: People

objectClass: top

objectClass: organizationalUnit

 

dn: ou=Group,dc=cisco,dc=com

ou: Group

objectClass: top

objectClass: organizationalUnit

 

group.ldif

 

dn: cn=root,ou=Group,dc=cisco,dc=com

objectClass: posixGroup

objectClass: top

cn: root

gidNumber: 0

 

dn: cn=other,ou=Group,dc=cisco,dc=com

objectClass: posixGroup

objectClass: top

cn: other

gidNumber: 1

memberUid: root

 

passwd.ldif

 

dn: uid=testbind,dc=cisco,dc=com

uid: testbind

cn: testbind

sn: testbind

userPassword: testbind

uidNumber: 1104

gidNumber: 1100

homeDirectory: /home/testbind

loginShell: /bin/bash

objectClass: inetOrgPerson

objectClass: posixAccount

 

dn: uid=nmtgtest,ou=People,dc=cisco,dc=com

uid: nmtgtest

cn: nmtgtest

objectClass: account

objectClass: posixAccount

objectClass: top

objectClass: shadowAccount

userPassword: nmtgtest

shadowLastChange: 15064

loginShell: /bin/sh

uidNumber: 1315

gidNumber: 1

homeDirectory: /home/nmtg

 

3 PAM setting

There are many different PAM modules which communicate with different AAA server, Solaris has the native PAM LDAP library, use /etc/pam.conf to relay the authentication to LDAP or other AAA, for instance LDAP:


<serive name>   auth       required    pam_ldap.so

<service name>  account    required    pam_ldap.so

 

Run the following command to configure Solaris native LDAP:

 

ldapclient -v manual -a defaultSearchBase=dc=cisco,dc=com -a serviceSearchDescriptor=passwd:ou=People,dc=cisco,dc=com -a serviceSearchDescriptor=shadow:ou=People,dc=cisco,dc=com -a defaultServerList=10.74.125.39 -a domainName=cisco.com -a authenticationMethod=simple -a defaultSearchScope=sub -a credentialLevel=proxy -a proxyDN=uid=testbind,dc=cisco,dc=com -a proxyPassword=testbind

 

To verify if the LDAP client is working well, run the following command:

 

# getent passwd <username>
# ldaplist -l passwd <username>

 

To Verify the following to file with correct parameters:

/var/ldap/ldap_client_file

 

NS_LDAP_FILE_VERSION= 2.0

NS_LDAP_SERVERS= 10.74.125.39

NS_LDAP_SEARCH_BASEDN= dc=cisco,dc=com

NS_LDAP_AUTH= simple

NS_LDAP_SEARCH_SCOPE= sub

NS_LDAP_CACHETTL= 0

NS_LDAP_CREDENTIAL_LEVEL= proxy

NS_LDAP_SERVICE_SEARCH_DESC= passwd:ou=People,dc=cisco,dc=com

NS_LDAP_SERVICE_SEARCH_DESC= shadow:ou=People,dc=cisco,dc=com
 

/var/ldap/ldap_client_cred



NS_LDAP_BINDDN= uid=testbind,dc=cisco,dc=com

NS_LDAP_BINDPASSWD= {NS1}4a3788e834634411


6 Verify

CentOS下LDAP服务配置指南   1.LDAP服务器端配置 2.LDAP客户端配置 3.LDAP服务器复制 4.LDAP服务器安全通信 一LDAP服务器端配置管理 1.     LDAP服务器软件包安装 CentOS系统中要实现openLDAP的功能必须要安装openldap,openldap-servers,openldap-c Lients三个软件包。CentOS安装光盘中提供LDA... 阅读详情

相关推荐

[OpenBMC] LDAP 设定(一) - nss-pam-ldapd

Note. OpenBMC的官方已经有文件对帐户管理有简单的介绍,可以先阅读 OpenBMC ldap设定和验证,可分成几个部分,本篇会先介绍第一个部分nss-pam-ldapd nss-pam-ldapd LDAP server 架设 Redfish/Web设定 LDAP over TLS nss-pam-ldapd 底下 OpenBMC 对nss-pam-ldapd 的描述 Bringing the LDAP authentication module support in openb

yeiris的博客 4101

使用 OpenLDAP 集中管理用户帐号

Linux-PAM 和 OpenLDAP 简介Linux-PAM 简介Linux-PAM (Linux 系统的可插入式认证模块) 是一套共享函数库,它表示一种性能健硕而且灵活方便的用户级认证方式,允许系统管理员来决定应用程序如何识别用户,即不需要 (重写和) 重新编译一个 (支持 PAM 的) 应用,就可以切换它所用的认证机制。目前,Linux-PAM 已经成为 Linux、...

weixin_34209406的博客 908

38、用户认证:PAM与LDAP的全面解析

本文全面解析了用户认证中的PAM(可插拔认证模块)和LDAP(轻量级目录访问协议)技术。首先介绍了PAM模块的功能及其应用场景,包括密码强度检查、访问时间限制等。接着详细阐述了LDAP的基本概念、目录结构、模式定义以及OpenLDAP的安装配置步骤。最后,讨论了LDAP的使用场景、优势及其与其他认证方式的比较,旨在帮助读者更好地理解和应用PAM与LDAP技术以提升系统安全性。

vim8coder的博客 76

pam_ldap详细配置

本文转自《pam_ldap详细配置》   Fedora 6下配置nss_ldap,pam_ldap,openldap以及加入ssl/tls安全认证 nss_ldap-253-1 包含两个模块:nss_ldap和pam_ldap nss_ldap: 其中nss是name service switch.nss_ldap模块用以连接ldap服务器,可以让系统识别ldap中的用户和群组。 pam_ldap: pam是Pluggable Authentication Module,即插件式认证模块

flyoxs的专栏 1万+

深入理解PAM:网络客户端管理和认证

本文深入探讨了PAM(Pluggable Authentication Modules)的网络客户端管理和认证机制。我们学习了如何通过PAM配置文件管理和控制认证流程,以及如何使用PAM模块进行不同类型的身份验证。同时,我们也探讨了PAM在LDAP认证中的应用,并了解了在Debian和Red Hat等Linux发行版中配置PAM模块的具体步骤。

weixin_42627459的博客 416

VMware Converter 6.2.0保姆级教程:从物理机到ESXi主机的完整迁移指南(含常见错误排查)

本文提供VMware Converter 6.2.0从物理机迁移至ESXi主机的完整保姆级教程。详细解析了迁移前的环境规划、核心转换过程步骤、版本差异对比,并重点针对代理安装失败、任务卡顿、虚拟机无法启动等常见错误提供了实战排查与解决方案,确保P2V迁移顺利进行。

sam99的博客 380

linux+配置ldap认证,Linux LDAP 认证配置

Linux通过LDAP方式,使用windows AD帐户登录linux shell,这个想法很cool吧。之前配置过一次,但过了太久忘记了,因此,今天把配Linux通过LDAP方式,使用windows AD帐户登录linux shell,这个想法很cool吧。之前配置过一次,但过了太久忘记了,因此,今天把配置方法记录下来。先说一下环境:域控服务器:1.1.1.1 域名 123.cc dns就是域控...

weixin_35725389的博客 1329

AI学习记录 - transformer的位置编码的理解

先看三角函数为什么可以,我们看下三角函数的图像先提一个点:位置信息肯定是唯一的,或者是在很长的文字当中,起码重复度不会太高,x轴代表位置,y轴代表叠加上去的值1、假设只使用一个三角函数sin,我们将第2和第14两个位置输入到sin,他们的值很像,在神经网络的训练中,很容易把第2个位置和第14个位置当成是一个位置,不满足我们上面说到的要求位置唯一性。sin2sin14。

weixin_43954090的博客 1412

LDAP安装指南

为什么80%的码农都做不了架构师?>>> ...

weixin_34241036的博客 651

FFTW多核优化避坑指南:从交叉编译到ELF2板载OpenMP部署全流程

本文详细介绍了在ELF2开发板(RK3588平台)上为FFTW库配置OpenMP多核并行的完整流程与避坑指南。内容涵盖从交叉编译、库依赖处理到板载部署的实战步骤,并深入分析了RK3588的big.LITTLE架构对线程调优的影响,帮助开发者在嵌入式环境中高效利用多核性能。

2a4s6d8f0g的博客 270

RK3588开发板RKNPU2环境部署实战:更新rknn_server与librknnrt.so详解

本文详细介绍了在RK3588开发板上更新rknn_server与librknnrt.so核心组件的完整实战流程。通过adb工具推送文件、设置权限并执行同步操作,确保RKNPU2环境部署成功,从而解决推理速度慢或初始化失败等问题,提升AI模型运行效率与稳定性。

weixin_29194817的博客 341

PAM | 账户安全 | 管理

PAM(Pluggable Authentication Modules,可插入式身份验证模块)是一个灵活的身份验证系统,允许我们通过配置和组合各种模块来实现不同的身份验证策略。以上只是一些常见的 PAM 模块,实际还有许多其他模块可用于不同的身份验证需求。限制账号安全的配置涉及很多步骤,包括密码策略、访问控制、身份验证、日志和监控等。Linux系统的账户安全是保护系统免受未授权访问和潜在威胁的关键方面。

梓芮 2075

22版本Altium Designer导出生产文件的规范化操作指南

本文详细介绍了PCB设计中的Gerber文件导出流程及相关文件生成方法。主要内容包括:1)Gerber文件导出的5个关键设置步骤;2)NC钻孔文件的导出方法;3)坐标文件的生成方式;4)文件打包规范要求必须包含Gerber文件、NC钻孔文件和坐标文件;5)文件提交的两种方式(新手推荐提交原始工程文件,量产推荐仅提交Gerber文件包)。文章还特别强调了单位一致性、精度验证等注意事项,为PCB设计文件的规范输出提供了完整指导。

qq_56506325的博客 1055

PAM SASL LDAP kerberos SSL辨析!

PAM,一种可插拔的验证机制,通俗的讲就是,某个服务需要一个认证环节,但这个环节又不想自己专门去实现,那么就可以使用PAM机制,相当于找一个第三方认证机构,这个第三方认证机构是可插拔,可选的,PAM被认证服务与认证服务的一个中介。 LDAP,轻量级目录访问协议,可以作为PAM的后端实现。 SASL,用户在访问LDAP服务时,用户的信息(用户名和密码)明文传输,需要一种加密认证协

sufetion的专栏 1717

新版MQL语言程序设计:用vscode编写编译调试mt4和mt5程序

使用VScode搭建MT4与MT5开发环境,实现编辑编译调试统一。

超哥量化的博客 6872

GXHT40温湿度传感器:I2C通信与CRC校验实战解析

本文详细解析GXHT40温湿度传感器的I2C通信协议与CRC校验机制,涵盖硬件连接、时序控制、数据读取及加热功能应用。通过实战案例分享优化技巧与异常处理,帮助开发者提升嵌入式系统中传感器数据的准确性与可靠性。

rgv234567的博客 241

Linux使用pam_ldap实现windows ad认证

配置linux通过ad认证的方法有很多,如samba使用的winbind方式。这里我使用的是pam_ldap方式,网上有很多这样相关的文章,都是按官网上一步步做,先配nsswitch.conf,再配ldap.conf。配置nsswitch.conf的作用是告诉系统去哪里获取到用户的pw信息(如getpwnam,getpwuid等函数调用时用),有时候,我们通常希望将帐号配置在...

weixin_33895695的博客 1027

Sentaurus TCAD建模:宽温区n型FinFET模型校准与低温仿真分析

本文基于Sentaurus TCAD平台,建立了n型FinFET的宽温区(233K-393K)仿真模型,解决了低温(73K-193K)仿真失效问题。研究对比了Sprocess工艺仿真与SDE几何建模两种方法,分析了载流子冻析效应、不完全电离和迁移率退化等低温物理机制。通过优化模型参数,实现了在233K、313K和393K条件下仿真误差小于10%,并建立了符合物理趋势的低温外推模型。研究提供了完整的Sentaurus TCAD代码实现,包括器件结构定义、物理模型配置和温度相关参数校准,为宽温区FinFET仿真

huanghm88的专栏 264

【redhat5.5】linux的LDAP认证服务器的配置及客户端pam网络验证实例

【1】 LDAP简介            LDAP(Lightweight Directory Access Protocol) 代表轻量级目录访问协议            LDAP 是一种非关系型数据库            LDAP 可扩展性和灵活性良好 安装和配置简单 【2】 几个重要的概念            dn :    一条记录的位置            dc

kakane的专栏 7760

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

JupyterHub认证系统全解析:PAM、OAuth与LDAP方案对比

在多用户Jupyter Notebook环境中,选择合适的认证系统直接影响安全性与用户体验。本文深入对比JupyterHub支持的三种主流认证方案——PAM(Pluggable Authentication Modules)、OAuth和LDAP(Lightweight Directory Access Protocol),帮助管理员根据实际场景选择最佳方案。 ## 认证系统架构概览 Jupy...

gitblog_00080的博客 888

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

linux用户带密码迁移 LDAP

http://www.360doc.com/content/13/0221/09/11635640_266880763.shtml http://bbs.chinaunix.net/thread-1915727-1-1.html http://blog.youkuaiyun.com/frylion/article/details/8538571 因为要将各系统的用户目录统一到LDAP服务器上,正在做li

走马观花 6218

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Linux--PAM机制

一、PAM是什么? 二、PAM模块设置语法 2.1 /etc/pam.d/里面的配置文件 2.1.1第一个字段:验证类别(Type) 2.1.2第二个字段:验证的控制标识(control flag) 三、常用模块简介 总结

TYJhhxx的博客 5504

linux服务器实现AD域认证,linux 使用pam_ldap通过ad域认证

配置linux通过ad认证的方法有很多,如samba使用的winbind方式。这里我使用的是pam_ldap方式,网上有很多这样相关的文章,都是按官网上一步步做,先配nsswitch.conf,再配ldap.conf。配置nsswitch.conf的作用是告诉系统去哪里获取到用户的pw信息(如getpwnam,getpwuid等函数调用时用),有时候,我们通常希望将帐号配置在系统的/etc/pas...

weixin_28941265的博客 338

linux ldap同步微软ad,Linux使用pam_ldap实现windows ad认证

配置linux通过ad认证的方法有很多,如samba使用的winbind方式。这里我使用的是pam_ldap方式,网上有很多这样相关的文章,都是按官网上一步步做,先配nsswitch.conf,再配ldap.conf。配置nsswitch.conf的作用是告诉系统去哪里获取到用户的pw信息(如getpwnam,getpwuid等函数调用时用),有时候,我们通常希望将帐号配置在系统的/etc/pas...

weixin_35702498的博客 1088

php5 pam,PAM配置ldap验证

PAM是linux上提供的一个可插拔认证模块,应该说还是比较强大、方便好用的,但是一旦配置不好,遇到问题也是不好解决的。通过authconfig-tui图形界面配置是比较简单的,但是,现在有遇到问题了。vsftpd通过ldap验证无法正常登录,如果去读pam的相关规范然后debugpam代码去发现问题将会花费很多的时间,怎么办呢?首先, 通过strace、tcpdump确认ftp验证确实走了lda...

weixin_30423205的博客 357

什么网络验证可以在linux运行,linux的LDAP认证服务器的配置及客户端pam网络验证实例...

【1】 LDAP简介 LDAP(Lightweight Directory Access Protocol) 代表轻量级目录访问协议 LDAP 是一种非关系型数据库 LDAP 可扩展性和灵活性良好 安装和配置简单 【2】 几个重要的概念 dn : 一条记录的位置 dc : 一条记录的所属区域 ou : 一条记录的所属组织 c【1】 LDAP简介LDAP(Lightweight Directory ...

weixin_42099151的博客 464
上一篇: JAVA bootstrap ClassLoader和JAVA核心API替换
飞天金刚
博客等级 码龄17年 35粉丝 15原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值