OpenLDAPから運用属性を取得する

OpenLDAPから運用属性を取得する

OpenLDAP から操作属性を取得する方法に関する適切なドキュメントを見つけるのに苦労しています。

LDAP 検索を実行して、LDAP サーバーの基本識別名を取得したいと思います。

namingContexts 属性を明示的に要求すると、検索が機能しないのはなぜですか? 属性リストにプラス ('+') 記号を追加する必要があると言われました。

この場合、「namingContexts」属性を削除するか、両方を設定する必要がありますか?

ldapsearch -H ldap://ldap.mydomain.com -x -s base -b "" +
# note the + returns operational attributes

編集:要求された属性が空であるように見えることに注意してください。属性リストにプラス記号があるべきではないでしょうか?http://www.zytrax.com/books/ldap/ch3/#operational

参照:OpenLDAP のプラス記号演算子

答え1

namingContexts 属性を明示的に要求すると、検索が機能しないのはなぜですか?

何が機能していないのですか? エラーが表示されますか?

プラス記号がある場合は、namingContexts が追加されているかどうかに関係なく、すべての属性が返されます。

使用方法:

ldapsearch -x -H ldap://ldap.example.com -s base -b "" namingContexts

戻り値:

# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: namingContexts 
#

#
dn:
namingContexts: o=example.com

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

以下を使用してリストすることもできます:

ldapsearch -x -H ldap://ldap.example.com -s base -b "" +

返品:

# extended LDIF
#
# LDAPv3
# base <> with scope baseObject
# filter: (objectclass=*)
# requesting: + 
#

#
dn:
structuralObjectClass: OpenLDAProotDSE
namingContexts: o=example.com
supportedControl: 2.16.840.1.113730.3.4.18
supportedControl: 2.16.840.1.113730.3.4.2
supportedControl: 1.3.6.1.4.1.4203.1.10.1
supportedControl: 1.2.840.113556.1.4.1413
supportedControl: 1.2.840.113556.1.4.1339
supportedControl: 1.2.840.113556.1.4.319
supportedControl: 1.2.826.0.1.334810.2.3
supportedExtension: 1.3.6.1.4.1.1466.20037
supportedExtension: 1.3.6.1.4.1.4203.1.11.1
supportedExtension: 1.3.6.1.4.1.4203.1.11.3
supportedFeatures: 1.3.6.1.4.1.4203.1.5.1
supportedFeatures: 1.3.6.1.4.1.4203.1.5.2
supportedFeatures: 1.3.6.1.4.1.4203.1.5.3
supportedFeatures: 1.3.6.1.4.1.4203.1.5.4
supportedFeatures: 1.3.6.1.4.1.4203.1.5.5
supportedLDAPVersion: 2
supportedLDAPVersion: 3
supportedSASLMechanisms: DIGEST-MD5
supportedSASLMechanisms: CRAM-MD5
subschemaSubentry: cn=Subschema

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

答え2

私の slapd.conf の最初のアクセス ルールは、これが許可されていることを明示的に確認するためのものです。同様のものがあることを確認してください。

# Let all clients figure out what auth mechanisms are available, determine
# that TLS is okay, etc
access to dn.base=""
        by *            read

関連情報