Python 3.5, ldap3 and modify_password()(Python 3.5、ldap3 和 modify_password())
问题描述
我一直在努力尝试通过脚本发送更新我自己的密码的请求.这是代码:
I've been pulling my hair out trying to send a request to update my own password via a script. here is the code:
#!/usr/bin/python3.5
from ldap3 import Server, Connection, NTLM, ALL
server = Server('ldap://192.168.0.80', use_ssl=True)
conn = Connection(server, user="local\dctest", password="Pa55word1", authentication=NTLM, auto_bind=True)
dn = "CN=dctest,CN=Users,DC=home,DC=local"
conn.extend.microsoft.modify_password(dn, new_password="Pa55word2", old_password="Pa55word1")
我得到的错误是:
{'dn': '', 'type': 'modifyResponse', 'description':'unwillingToPerform','推荐':无,'结果':53,'消息':'00002077: SvcErr: DSID-03190E44, 问题 5003 (WILL_NOT_PERFORM),数据 0 x00'}
{'dn': '', 'type': 'modifyResponse', 'description': 'unwillingToPerform', 'referrals': None, 'result': 53, 'message': '00002077: SvcErr: DSID-03190E44, problem 5003 (WILL_NOT_PERFORM), data 0 x00'}
知道我做错了什么吗?
我拥有对 DC 的完全访问权限,并且我已确保密码正确等.我已阅读所有文档,但无法理解它.
I have full access to the DC and I've made sure that the passwords are correct etc. I've read all the docs and just can't get my head around it.
任何帮助都会很棒!
推荐答案
好的,谢谢大家的帮助,还有github上的开发者.
OK thank you to everyone for your help, and the developers on github.
最后我用来完成这项工作的代码是......
the code i used to make this work in the end was...
from ldap3 import Server, Connection
server = Server('ldaps://<AD server address>', use_ssl=True)
conn = Connection(server, user="<domain>\<username>", password="<current password>", auto_bind=True)
dn = 'CN=<username>,OU=Users,DC=<dominaname>'
res = conn.extend.microsoft.modify_password(dn, old_password='<current password>', new_password='<new password>')
print(res)
我想我会发布可行的解决方案,因为互联网上似乎没有任何解决方案!上帝会加速我的同胞开发人员.
Thought i'd post the working solution as there doesn't seem to be any on the internets!! God speed my fellow devops people.
这篇关于Python 3.5、ldap3 和 modify_password()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python 3.5、ldap3 和 modify_password()
基础教程推荐
- 在 Python 中将货币解析为数字 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
