Name | ldaputils JSON |
Version |
0.1.10
JSON |
| download |
home_page | |
Summary | Ldap utils library. |
upload_time | 2023-10-19 06:19:26 |
maintainer | Huang YaPeng |
docs_url | None |
author | Huang YaPeng |
requires_python | |
license | MIT |
keywords |
ldaputils
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# ldaputils
Ldap utils library.
## Install
```
pip install ldaputils
```
## Usage
```
# use your own host, port, username and password values.
# username must be a fully qualified dn.
# Use ipython help to see more init parameters.
server = LdapService(
host="localhost,
port=389,
username="cn=admin,dc=example,dc=com",
password="adminpassword",
)
name = nameutils.get_random_name() # use fastutils.nameutils.get_random_name for test
username = pinyinutils.to_pinyin(name).lower()
user_detail = {
"cn": name,
"ou": "AI Tech Group",
"l": "HangZhou, China",
}
assert self.server.add_user_entry(username, user_detail)
assert self.server.delete_user_entry(username)
```
## How to solve `wrap socket error: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1006)` problem.
This is not a problem of `ldaputils` library, nor is a problem of `ldap3` library. It happens because ssl client and the server using different protocols.
### Find out your server ssl information with openssl command
```
openssl s_client -connect x.x.x.x:389 -showcerts -starttls ldap
```
- Type shell command above.
- Replace x.x.x.x:389 with your own ldap server address and port.
- The output may looks like:
```
...
...
---
New, TLSv1.2, Cipher is AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : AES256-GCM-SHA384
Session-ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Session-ID-ctx:
Master-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 19 1a 2e c9 bc 3a c8 2b-27 ab 9c cf 94 12 f8 79 .......['4......
0010 - bd 1a 9a c9 52 3e ac 2d-af ab aa cf c6 09 f8 7f .........R.>...O
0020 - 63 1a b9 c9 73 34 ea 27-4d ab a8 cf 2f 12 f8 79 c..-s4..M..**...
0030 - ac 1a 18 c9 40 35 4f 26-ce ab ca cf 95 60 f8 71 ....@.O....\.`.a
0040 - 19 1a 2e c9 9d 34 ba 28-90 ab 50 cf ce 8c f8 79 .......8.oP7..U.
0050 - d5 1a 3b c9 cc 36 61 27-ff ab 0f cf 4c 34 f8 70 ..;..f..... L4..
0060 - c8 1a 1b c9 b3 3e a5 27-e0 ab 21 cf 1a 84 f8 75 .<........!...d.
0070 - 26 1a 1b c9 6b 34 a2 24-03 ab 57 cf 70 e1 f8 74 fW.ykD.t.vxXt..t
0080 - 8c 1a 52 c9 46 39 e3 2b-44 ab 66 cf 23 b3 f8 7d ..rrfxI..D.x.#.;M
0090 - 74 1a f8 c9 af 37 37 2b-89 ab 62 cf 53 5c f8 7b t8...G7...bGx\..
Start Time: 1697691557
Timeout : 7200 (sec)
Verify return code: 10 (certificate has expired)
Extended master secret: no
---
...
...
```
- You can found out what `Protocol` and `Cipher` your server is using.
### Init ldap service with tls server parameters
```
from ldap3 import Tls
from ldaputils import LdapService
tls = Tls(
version=ssl.PROTOCOL_TLSv1_2,
ciphers="AES256-GCM-SHA384",
)
service = LdapService(
host="x.x.x.x",
port=389,
username="cn=admin,dc=example,dc=com",
password="example",
base_dn="dc=example,dc=com",
server_params={
"tls": tls,
},
)
```
- Add `server_params` and you will get SSL problem solved.
## Releases
### v0.1.0 2020/11/14
- First release.
- Add, update, delete user entry function ready.
- Get user and get users function ready.
### v0.1.4 2020/11/17
- Add util functions.
### v0.1.5 2020/11/21
- Add attributes param for LdapService.get_user_entries.
### v0.1.7 2021/03/24
- Fix add_user_entry changed the user_detail dict problem.
### v0.1.9 2023/09/15
- Doc update.
### v0.1.10 2023/10/19
- Doc update.
Raw data
{
"_id": null,
"home_page": "",
"name": "ldaputils",
"maintainer": "Huang YaPeng",
"docs_url": null,
"requires_python": "",
"maintainer_email": "huangyapeng@zencore.cn",
"keywords": "ldaputils",
"author": "Huang YaPeng",
"author_email": "huangyapeng@zencore.cn",
"download_url": "https://files.pythonhosted.org/packages/32/37/34219b5ac39da49f9910af1045522d86e187d3728722396da4788b8451ce/ldaputils-0.1.10.tar.gz",
"platform": null,
"description": "# ldaputils\n\nLdap utils library.\n\n## Install\n\n```\npip install ldaputils\n```\n\n## Usage\n\n```\n# use your own host, port, username and password values.\n# username must be a fully qualified dn.\n# Use ipython help to see more init parameters.\nserver = LdapService(\n host=\"localhost,\n port=389,\n username=\"cn=admin,dc=example,dc=com\",\n password=\"adminpassword\",\n)\n\nname = nameutils.get_random_name() # use fastutils.nameutils.get_random_name for test\nusername = pinyinutils.to_pinyin(name).lower()\nuser_detail = {\n \"cn\": name,\n \"ou\": \"AI Tech Group\",\n \"l\": \"HangZhou, China\",\n}\nassert self.server.add_user_entry(username, user_detail)\nassert self.server.delete_user_entry(username)\n```\n\n## How to solve `wrap socket error: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1006)` problem.\n\nThis is not a problem of `ldaputils` library, nor is a problem of `ldap3` library. It happens because ssl client and the server using different protocols.\n\n### Find out your server ssl information with openssl command\n\n```\nopenssl s_client -connect x.x.x.x:389 -showcerts -starttls ldap\n```\n\n- Type shell command above.\n- Replace x.x.x.x:389 with your own ldap server address and port.\n- The output may looks like:\n\n ```\n ...\n ...\n ---\n New, TLSv1.2, Cipher is AES256-GCM-SHA384\n Server public key is 2048 bit\n Secure Renegotiation IS supported\n Compression: NONE\n Expansion: NONE\n No ALPN negotiated\n SSL-Session:\n Protocol : TLSv1.2\n Cipher : AES256-GCM-SHA384\n Session-ID: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n Session-ID-ctx: \n Master-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n PSK identity: None\n PSK identity hint: None\n SRP username: None\n TLS session ticket lifetime hint: 300 (seconds)\n TLS session ticket:\n 0000 - 19 1a 2e c9 bc 3a c8 2b-27 ab 9c cf 94 12 f8 79 .......['4......\n 0010 - bd 1a 9a c9 52 3e ac 2d-af ab aa cf c6 09 f8 7f .........R.>...O\n 0020 - 63 1a b9 c9 73 34 ea 27-4d ab a8 cf 2f 12 f8 79 c..-s4..M..**...\n 0030 - ac 1a 18 c9 40 35 4f 26-ce ab ca cf 95 60 f8 71 ....@.O....\\.`.a\n 0040 - 19 1a 2e c9 9d 34 ba 28-90 ab 50 cf ce 8c f8 79 .......8.oP7..U.\n 0050 - d5 1a 3b c9 cc 36 61 27-ff ab 0f cf 4c 34 f8 70 ..;..f..... L4..\n 0060 - c8 1a 1b c9 b3 3e a5 27-e0 ab 21 cf 1a 84 f8 75 .<........!...d.\n 0070 - 26 1a 1b c9 6b 34 a2 24-03 ab 57 cf 70 e1 f8 74 fW.ykD.t.vxXt..t\n 0080 - 8c 1a 52 c9 46 39 e3 2b-44 ab 66 cf 23 b3 f8 7d ..rrfxI..D.x.#.;M\n 0090 - 74 1a f8 c9 af 37 37 2b-89 ab 62 cf 53 5c f8 7b t8...G7...bGx\\..\n\n Start Time: 1697691557\n Timeout : 7200 (sec)\n Verify return code: 10 (certificate has expired)\n Extended master secret: no\n ---\n ...\n ...\n ```\n\n- You can found out what `Protocol` and `Cipher` your server is using.\n\n### Init ldap service with tls server parameters\n\n```\nfrom ldap3 import Tls\nfrom ldaputils import LdapService\n\ntls = Tls(\n version=ssl.PROTOCOL_TLSv1_2,\n ciphers=\"AES256-GCM-SHA384\",\n)\nservice = LdapService(\n host=\"x.x.x.x\",\n port=389,\n username=\"cn=admin,dc=example,dc=com\",\n password=\"example\",\n base_dn=\"dc=example,dc=com\",\n server_params={\n \"tls\": tls,\n },\n)\n```\n\n- Add `server_params` and you will get SSL problem solved.\n\n\n\n\n## Releases\n\n### v0.1.0 2020/11/14\n\n- First release.\n- Add, update, delete user entry function ready.\n- Get user and get users function ready.\n\n### v0.1.4 2020/11/17\n\n- Add util functions.\n\n### v0.1.5 2020/11/21\n\n- Add attributes param for LdapService.get_user_entries.\n\n### v0.1.7 2021/03/24\n\n- Fix add_user_entry changed the user_detail dict problem.\n\n### v0.1.9 2023/09/15\n\n- Doc update.\n\n### v0.1.10 2023/10/19\n\n- Doc update.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Ldap utils library.",
"version": "0.1.10",
"project_urls": null,
"split_keywords": [
"ldaputils"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec472dc0ac72cfbace5bbb0b3614c4e973f11a023e7861edebd6893eda886a9a",
"md5": "536383033fbdbf57d0a0ae2504f0e38e",
"sha256": "154128beb42be47eb5f5bebb051058548254c6952d93f5db27a577f17af2d236"
},
"downloads": -1,
"filename": "ldaputils-0.1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "536383033fbdbf57d0a0ae2504f0e38e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7478,
"upload_time": "2023-10-19T06:19:24",
"upload_time_iso_8601": "2023-10-19T06:19:24.930129Z",
"url": "https://files.pythonhosted.org/packages/ec/47/2dc0ac72cfbace5bbb0b3614c4e973f11a023e7861edebd6893eda886a9a/ldaputils-0.1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "323734219b5ac39da49f9910af1045522d86e187d3728722396da4788b8451ce",
"md5": "b7bf27184e8e1aaff583ea32b6cedf83",
"sha256": "39a8a19218d577c843f4dc733d9c7f8c569bee2d0f5a8fef9d04a7d0a3e372cd"
},
"downloads": -1,
"filename": "ldaputils-0.1.10.tar.gz",
"has_sig": false,
"md5_digest": "b7bf27184e8e1aaff583ea32b6cedf83",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8508,
"upload_time": "2023-10-19T06:19:26",
"upload_time_iso_8601": "2023-10-19T06:19:26.915465Z",
"url": "https://files.pythonhosted.org/packages/32/37/34219b5ac39da49f9910af1045522d86e187d3728722396da4788b8451ce/ldaputils-0.1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-19 06:19:26",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ldaputils"
}