有玩过LDAP的鼠大侠玩dnf不管用吗

新手园地& & & 硬件问题Linux系统管理Linux网络问题Linux环境编程Linux桌面系统国产LinuxBSD& & & BSD文档中心AIX& & & 新手入门& & & AIX文档中心& & & 资源下载& & & Power高级应用& & & IBM存储AS400Solaris& & & Solaris文档中心HP-UX& & & HP文档中心SCO UNIX& & & SCO文档中心互操作专区IRIXTru64 UNIXMac OS X门户网站运维集群和高可用服务器应用监控和防护虚拟化技术架构设计行业应用和管理服务器及硬件技术& & & 服务器资源下载云计算& & & 云计算文档中心& & & 云计算业界& & & 云计算资源下载存储备份& & & 存储文档中心& & & 存储业界& & & 存储资源下载& & & Symantec技术交流区安全技术网络技术& & & 网络技术文档中心C/C++& & & GUI编程& & & Functional编程内核源码& & & 内核问题移动开发& & & 移动开发技术资料ShellPerlJava& & & Java文档中心PHP& & & php文档中心Python& & & Python文档中心RubyCPU与编译器嵌入式开发驱动开发Web开发VoIP开发技术MySQL& & & MySQL文档中心SybaseOraclePostgreSQLDB2Informix数据仓库与数据挖掘NoSQL技术IT业界新闻与评论IT职业生涯& & & 猎头招聘IT图书与评论& & & CU技术图书大系& & & Linux书友会二手交易下载共享Linux文档专区IT培训与认证& & & 培训交流& & & 认证培训清茶斋投资理财运动地带快乐数码摄影& & & 摄影器材& & & 摄影比赛专区IT爱车族旅游天下站务交流版主会议室博客SNS站务交流区CU活动专区& & & Power活动专区& & & 拍卖交流区频道交流区
白手起家, 积分 25, 距离下一级还需 175 积分
论坛徽章:0
搞了好久实在搞不出来
请大侠们指点一下错误
按照网上的例子运行了n遍,每次都有错误
& &workgroup = Mshome
& &netbios name = phoenix
& &server string = apei2's Samba Server
& &printcap name = /etc/printcap
& &load printers = yes
& &log file = /var/log/samba/%m.log
& &log level = 2
& &max log size = 50
& &security = user
& &ldap server = 172.16.0.232
& &ldap port = 389
& &ldap admin dn = &cn=root,dc=it,dc=com&
& &ldap suffix = &dc=it,dc=com&
& &ldap ssl = no
&&unix password sync = Yes
&&passwd program = /usr/local/sbin/smbldap-passwd.pl -o&&%u
&&passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n
*passwd:*all*authentication*tokens*updated*successfully*
& &socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
& &local master = yes
& &os level = 64
& &domain master = no
& &preferred master = no
& &logon path = \\%L\Profiles\%U
& &logon home = \\%L\%U\
& &logon drive = W:
& &logon script = netlogon.bat
& &add user script = /usr/local/sbin/smbldap-useradd.pl -m -k /dev/null -
n -g -s /sbin/nologin -A l -B l -u %u
& &dns proxy = no
#============================ Share Definitions =========================
& &comment = Home Directories
& &browseable = no
& &writable = yes
& &valid users = %S
& &create mode = 0664
& &directory mode = 0775
[profiles]
& &path = /home/samba/profiles
& &writeable = yes
& &browseable = no
& &create mask = 0600
& &directory mask = 0700
[netlogon]
& &comment = Network Logon Service
& &path = /home/samba/netlogon
& &read only = yes
& &browseable = no
& &write list = @administrator
& &comment = caiwu
& &path = /home/samba/caiwu
& &public = no
& &valid users = @caiwu,@lingdao,network02
& &write list = caiwu01
& &printable = no
[exchange]
& &comment = Exchange File Directory
& &path = /home/samba/exchange
& &public = yes
& &writable = yes
[printers]
& &comment = All Printers
& &path = /var/spool/samba
& &browseable = no
& &guest ok = no
& &writable = no
& &printable = yes
& &comment = Read Only Public
& &path = /home/public/samba
& &public = yes
& &read only = yes
slapd.conf:如下
include& &&&/usr/local/openldap/etc/openldap/schema/core.schema
include& && && &/usr/local/openldap/etc/openldap/schema/cosine.schema
include& &&&/usr/local/openldap/etc/openldap/schema/inetorgperson.schema
include& &&&/usr/local/openldap/etc/openldap/schema/nis.schema
include& &&&/usr/local/openldap/etc/openldap/schema/samba.schema
pidfile& &&&/usr/local/openldap/var/run/slapd.pid
argsfile& & /usr/local/openldap/var/run/slapd.args
database& & bdb
suffix& && &&dc=it,dc=com&
rootdn& && &&cn=root,dc=it,dc=com&
rootpw& && &888888
directory& &/usr/local/openldap/var/openldap-data
index& &objectClass,uidNumber,gidNumber& &&&eq
index& &cn,sn,uid,displayName& && && &&&pres,sub,eq
index& &memberUid,mail,givenname& && &&&eq,subinitial
index& &sambaSID,sambaPrimaryGroupSID,sambaDomainName& &eq
access to *
& & by anonymous auth
& & by * write
& & by * read
ldap.conf的配置如下:
BASE& & dc=it, dc=com
现在的问题是:我运行smbclient 172.16.0.157 -U caiwu01
提示unknown parameter:ldap server
& & ignore parameter: ldap server
& &unknown parameter: ldap port
& &ignore parameter :ldap port
然后运行正常,但是这样子,它是完全跳过ldap的认证了,怎么才能把用户和密码的信息
存到ldap里面去
还有,我其他的设置基本上没动过,比如pam_ldap,nss_ldap and nscd我都没动过
请各位大侠救急阿
&&nbsp|&&nbsp&&nbsp|&&nbsp&&nbsp|&&nbsp&&nbsp|&&nbsp
论坛徽章:1
请各位大侠帮忙看一下samba3+openldap的配置
我今天刚开始做samba3和ldap的整和,关注你的问题:)
白手起家, 积分 25, 距离下一级还需 175 积分
论坛徽章:0
请各位大侠帮忙看一下samba3+openldap的配置
有msn吗,交流一下
稍有积蓄, 积分 217, 距离下一级还需 283 积分
论坛徽章:0
请各位大侠帮忙看一下samba3+openldap的配置
;security setup
security = user
encrypt passwords = yes
;smb passwd file = /usr/local/samba/private/smbpasswd
passdb backend = ldapsam:ldap://ldapserver
ldap admin dn = &cn=admin,dc=com&
ldap delete dn = yes
ldap user suffix = dc=samba,dc=it
ldap suffix = dc=com
这是我的smb.conf中有关ldap配置的内容,你可参考一下。
论坛徽章:1
请各位大侠帮忙看一下samba3+openldap的配置
原帖由 &yjnet& 发表:
;security setup
security = user
encrypt passwords = yes
;smb passwd file = /usr/local/samba/private/smbpasswd
passdb backend = ldapsam:ldap://ldapserver
ldap admin dn = &cn=admin,dc=com&
ldap de..........
请问你的samba用户密码和ldap的userPassword密码是如何同步的?用smbpasswd可以同步ldap的userPassword的密码,能否通过一些手段实现passwd命令同步samba的密码?
另外如果让samba通过pam_ldap做认证就能解决上述问题,请问可以实现吗?
稍有积蓄, 积分 217, 距离下一级还需 283 积分
论坛徽章:0
请各位大侠帮忙看一下samba3+openldap的配置
samba的密码与ldap的userPassword我是通过写python程序来同步的。smbpasswd程序是不能实现密码同步功能的。
有关pam_ldap的问题我没测试过。
白手起家, 积分 14, 距离下一级还需 186 积分
论坛徽章:0
请各位大侠帮忙看一下samba3+openldap的配置
用个整合工具:smbldap
白手起家, 积分 172, 距离下一级还需 28 积分
论坛徽章:0
请各位大侠帮忙看一下samba3+openldap的配置
http://web.vcs.u52.k12.me.us/linux/smbldap/关于spring security使用ldap的配置疑问 - 权限管理 - ITeye群组
一个web系统需要用公司的域账号登录,
初次使用spring security遇到一些问题,
文档示例中是这么写的:
&ldap-server url="ldap://10.10.10.10:389/" /&
&authentication-manager&&&&
&ldap-authentication-provider
user-dn-pattern="uid={0}"/&
&/authentication-manager&
我把"uid={0}"改成"{0}"后报错:
Your login attempt was not successful, try again.
Reason: Failed to parse DN; nested exception is org.springframework.ldap.core.ParseException: Encountered "" at line 1, column 9. Was expecting: ...
貌似这个user-dn-pattern只能是 xxx={0} 这种形式,那怎么验证过呢?
根据ldap的查询语法写就可以了啊。
谢谢大侠的关注,我对ldap也是刚接触,使用jdk带的那个javax.naming包可以成功验证,验证部分代码如下:
public boolean authenricate(String ID, String password) {
boolean valid =
String userDN = ID;
userDN = "china\\" + userDN;
env = new Hashtable&String, String&();
env.put(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
env.put(Context.PROVIDER_URL, URL);// LDAP server
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, userDN);
env.put(Context.SECURITY_CREDENTIALS, password);
// 此处若不指定用户名和密码,则自动转换为匿名登录
ctx = new InitialLdapContext(env, null);
} catch (javax.naming.AuthenticationException e) {
System.out.println("Authentication faild: " + e.toString());
} catch (Exception e) {
System.out.println("Something wrong while authenticating: "
+ e.toString());
使用pasband登录,ethereal抓包是:
DN: china\pasband
Password:
而用spring security验证时,不能通过,
ethereal抓包是:
DN: uid=pasband
Password:
所以我试图把
&ldap-authentication-provider
user-dn-pattern="uid={0}"/&
改成
&ldap-authentication-provider
user-dn-pattern="china\\{0}"/&
结果就报错:
Your login attempt was not successful, try again.
Reason: Failed to parse DN; nested exception is org.springframework.ldap.core.TokenMgrError: Lexical error at line 1, column 6. Encountered: "\\" (92), after : ""
估计是解析user-dn-pattern的时候,只允许xxx=yyy这种样式,可这满足不了场景啊,这个解析代码是在spring-ldap,而不是security包中,而spring发布的源码,
未包含DnParserImpl.java这个文件(发布包是有DnParserImpl.class的)
现在不知道怎么处理了,可能是我使用的方式不对?请给点意见~谢谢!
xyz20003 写道根据ldap的查询语法写就可以了啊。对于NOVELL&LDAP&轻量级目录服务的学习理解
对于NOVELL LDAP 轻量级目录服务的学习理解
采用NOVELL 的API
用到得包如下
import com.novell.ldap.LDAPAttributeS
import com.novell.ldap.LDAPC
import com.novell.ldap.LDAPA
import com.novell.ldap.LDAPE
import com.novell.ldap.LDAPE
如何获取到一个LDAP服务器的连接
&&&首先要知道
&&&&服务器地址
&&&&服务器端口
ldapPort, 默认为 LDAPConnection.DEFAULT_PORT|389
&&&&服务器版本
ldapVersion, 默认为 LDAPConnection.LDAP_V3|3
&&&&服务器管理员
&&&&服务器密码
&&&LDAPConnection
lc = new LDAPConnection();
&&&lc.connect(ldapHost,ldapPort);
&&&lc.bind(ldapVersion,
username, password.getBytes("UTF8"));
&&&如果没抛异常,lc即为到LDAPConnection的连接
&&&在操作完成之后一定要关闭LDAP连接
lc.disconnect();
如何在LDAP服务器中加入一个实体即com.novell.ldap.LDAPE
&&&定义LDAPAttributeSet
attributeSet = new LDAPAttributeSet();
&&&在attributeSet
中加入属性 注意各种实体参数正确 比如 objectclass 具体说明见:ldap 协议 objectclasses 与
&&&&attributeSet.add(new
LDAPAttribute("objectclass", "inetOrgPerson"));
&&&&attributeSet.add(new
LDAPAttribute("riseGUID", riseGUID.toString()));
&&&&attributeSet.add(new
LDAPAttribute("fullName", name));
&&&&attributeSet.add(new
LDAPAttribute("userpassword", password));
&&&&attributeSet.add(new
LDAPAttribute("sn", name));
&&&确定实体dn 即实体在
LDAP 上的树形结构中的位置
&&&建立实体对象
&&&LDAPEntry
newEntry = new LDAPEntry(dn, attributeSet);
LDAPConnection 连接 添加此实体&
&&&lc.add(newEntry);
如何在LDAP服务器中获取某实体
&&&第一、获取到LDAP服务器的管理员连接
&&&第二、确定查找参数
包括:该实体的DN 、String returnAttrs[] = {
"LoginDisabled",&
&&&&&&"loginExpirationTime","passwordExpirationTime","loginAllowedTimeMap","lockedByIntruder"
&&&&&//字符串数组
表示要查找的参数 类似数据库中要查找的数据表字段名
&&&第三、验证某实体的属性
&&&LDAPAttribute
attribute = new LDAPAttribute("userPassword", userPWD);
&&&<pare(userDN,
attribute)&&&//返回true
or false 可以用来判断用户的密码是否正确
&&&第四、进行查找
&&&&LDAPEntry
entry = lc.read(userDN, returnAttrs); //返回的是 LDAPEntry 对象 通过
LDAPEntry 对象来获取该实体的信息
如何在LDAP服务器中查找实体&
&&&第一、获取到LDAP服务器的管理员连接
&&&第二、确定查找范围,查找参数,查找内容等
&&&&如:String
searchBase = "o=武钢氧气有限责任公司";
&&&&&String
searchFilter = "(cn=a000001)";
// 此处为查找表达式,支持正则表达式
&&&&&String
searchScope&=&LDAPConnection.SCOPE_ONE
&// 只查找基节点第一层的子节点
&&&&&&&&&&&|LDAPConnection.SCOPE_BASE&//
只查找基节点
&&&&&&&&&&&|LDAPConnection.SCOPE_SUB
&// 查找基节点下面的所有子节点
&&&第三、根据参数进行查找
返回 LDAPSearchResults 对象
&&&LDAPSearchResults
searchResults = lc.search(searchBase,
&&&&&searchScope,
searchFilter, new String[] { "cn",
&&&&&&&"objectClass",
"userPassword","riseGUID"},false);
&&&&&&&&&&&&&&&&&&//
此方法中字符串数组表示查询的实体的属性,并在结果中返回这些属性
&&&第四:列出查询结果
(searchResults.hasMore()) {&
&&&&&&//LDAPSearchResults
实现了 collection 接口
&&&&LDAPEntry
le = searchResults.next();
&&&&&//结果集中每个内容都是一个
LDAPEntry 对象
&&&&System.out.println(le.getDN());
&&&&LDAPAttributeSet
attributeSet = le.getAttributeSet(); &//通过
LDAPEntry 对象来获取 LDAPAttributeSet 对象
sortedAttributes = new TreeSet(attributeSet);
&&&&Iterator
allAttributes = sortedAttributes.iterator();
(allAttributes.hasNext()) {
&&&&&LDAPAttribute
attribute = (LDAPAttribute) allAttributes.next();
&&&&&String
attributeName = attribute.getName();
&&//获取参数名
&&&&&System.out.println("\t\t"
attributeName);&&&
&&&&&Enumeration
allValues = attribute.getStringValues();//其参数值可以为多个,利用Enumeration
列出全部该属性的值
(allValues != null) {
&&&&&&while
(allValues.hasMoreElements()) {
&&&&&&&String
Value = (String) allValues.nextElement();
&&&&&&&System.out.println("\t\t\t"
如何修改、删除 已存在的某实体的 属性 Attribute
&&&&第一、获取到LDAP服务器的管理员连接
&&&&第二、创建该实体要修改的属性列表
ArrayList modList = new ArrayList();
&&&&第三、用
LDAPModification 对象填充该列表 如:
&&&&&&LDAPAttribute
attribute = new LDAPAttribute("telephoneNumber", "1 801 555
&&&&&&modList.add(new
LDAPModification(LDAPModification.ADD, attribute));
这里 LDAPModification 对象有几种方式
LDAPModification.ADD、LDAPModification.DELETE、LDAPModification.REPLACE
&&&&第四、用list填充
LDAPModification& 对象
&&&&&&LDAPModification[]
modsadd = new LDAPModification[modList.size()];
&&&&&&modsadd
= (LDAPModification[]) modList.toArray(modsadd);
&&&&第五、通过
LDAP连接就行修改操作
&&&&&&lc.modify(dn,
modsadd);&&
&&&&&&//注:lc为LDAP服务器的连接
modsadd 为封装后的LDAPModification 对象
如何删除某个已存在实体
&&&&通过获取LDAP连接
deleteDN为该节点的DN
&&&&lc.delete(deleteDN);
JLDAP 访问LDAP服务器的错误代码含义(已知的)
91:Unable to connect to server 172.16.5.12:389 (91) Connect
Error& //在获取连接的时候LDAP 服务器连接地址或端口不正确
68:Entry Already Exists (68) Entry Already Exists
&&&&&//添加实体时抛出实体已经存在信息
32:No Such Object (32) No Such
Object&&&&&&&&//实体不存在
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。

我要回帖

更多关于 兄弟玩大侠传 的文章

 

随机推荐