LDAP(轻量目录访问协议)是一种用于访问和维护分布式目录信息服务的应用层协议。它基于X.500标准,但更为轻量且易于实现。以下是关于LDAP端口号的详细解答:
LDAP端口号:LDAP服务默认使用389端口进行未加密的通信。如果使用SSL/TLS加密,则通常使用636端口。
以下是一个简单的Python示例,展示如何使用ldap3
库连接到LDAP服务器:
from ldap3 import Server, Connection, ALL
# 定义服务器和连接参数
server = Server('your-ldap-server', port=389, get_info=ALL)
conn = Connection(server, user='cn=admin,dc=example,dc=com', password='secret')
# 绑定并执行查询
if conn.bind():
print("Connected successfully!")
conn.search('dc=example,dc=com', '(objectClass=person)')
for entry in conn.entries:
print(entry)
else:
print("Failed to connect!")
# 断开连接
conn.unbind()
希望以上内容能帮助您更好地理解和解决关于LDAP端口号的相关问题。如有更多疑问,请随时提问!
领取专属 10元无门槛券
手把手带您无忧上云