python-ldap

AWS Lambda + Python-ldap

回眸只為那壹抹淺笑 提交于 2021-02-19 03:54:40
问题 I am trying to use python-ldap with AWS Lambda. I downloaded the tarball from : https://pypi.python.org/pypi/python-ldap and code to use lambda (lambda_function.py) from ldap_dir.ldap_query.Lib import ldap and uploaded the zip to Lambda. where my directory structure is ldap_dir -> ldap_query -> Lib -> ldap folder ldap_dir -> lambda_function.py Am I missing out something? 回答1: python-ldap is built on top of native OpenLDAP libraries. This article - even though unrelated to the python ldap

run python-ldap with official python docker image as base

只谈情不闲聊 提交于 2021-02-18 20:30:56
问题 I am using the official python docker image for python 2.7. The application I am working with requires pyhon-ldap. My dockerfile looked like this: FROM python:2.7 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install -r requirements.txt ADD . /code/ Where python-ldap is in requirements.txt Naturally I run into this: In file included from Modules/LDAPObject.c:9:0: Modules/errors.h:8:18: fatal error: lber.h: No such file or directory #include "lber.h"

run python-ldap with official python docker image as base

假装没事ソ 提交于 2021-02-18 20:30:07
问题 I am using the official python docker image for python 2.7. The application I am working with requires pyhon-ldap. My dockerfile looked like this: FROM python:2.7 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install -r requirements.txt ADD . /code/ Where python-ldap is in requirements.txt Naturally I run into this: In file included from Modules/LDAPObject.c:9:0: Modules/errors.h:8:18: fatal error: lber.h: No such file or directory #include "lber.h"

Python-LDAP simple_bind_s timeout

本小妞迷上赌 提交于 2021-02-07 03:13:31
问题 Is there a way to set timeout for "simple_bind_s" in python-LDAP manually? I have tested ldapObject.timeout = 10 it did not work for me. Any ideas? Thanks in advance.. 回答1: Set the option ldap.OPT_NETWORK_TIMEOUT for the ldap object. import ldap l = ldap.initialize('ldap://servername:389') l.set_option(ldap.OPT_NETWORK_TIMEOUT, 10.0) l.simple_bind_s('username', 'password') This will raise a ldap.SERVER_DOWN exception if the specified timeout is reached. 回答2: For some reason ldap.OPT_NETWORK

Python-LDAP simple_bind_s timeout

泄露秘密 提交于 2021-02-07 03:10:31
问题 Is there a way to set timeout for "simple_bind_s" in python-LDAP manually? I have tested ldapObject.timeout = 10 it did not work for me. Any ideas? Thanks in advance.. 回答1: Set the option ldap.OPT_NETWORK_TIMEOUT for the ldap object. import ldap l = ldap.initialize('ldap://servername:389') l.set_option(ldap.OPT_NETWORK_TIMEOUT, 10.0) l.simple_bind_s('username', 'password') This will raise a ldap.SERVER_DOWN exception if the specified timeout is reached. 回答2: For some reason ldap.OPT_NETWORK

Python-LDAP simple_bind_s timeout

↘锁芯ラ 提交于 2021-02-07 03:05:28
问题 Is there a way to set timeout for "simple_bind_s" in python-LDAP manually? I have tested ldapObject.timeout = 10 it did not work for me. Any ideas? Thanks in advance.. 回答1: Set the option ldap.OPT_NETWORK_TIMEOUT for the ldap object. import ldap l = ldap.initialize('ldap://servername:389') l.set_option(ldap.OPT_NETWORK_TIMEOUT, 10.0) l.simple_bind_s('username', 'password') This will raise a ldap.SERVER_DOWN exception if the specified timeout is reached. 回答2: For some reason ldap.OPT_NETWORK

django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is app...

对着背影说爱祢 提交于 2020-08-11 09:01:40
这个错误发生在django数据迁移的时候,(在第一次数据迁移以后,才设置AUTH_USER_MODEL自定义用户模型,就会报这个错) ===================解决方案一 ================ 首先 , 检查配置文件中的 INSTALLED_APPS 是否被注释,将它释放,再次执行还报错,试试第二种方案 INSTALLED_APPS = [ ' django.contrib.admin ' , ' django.contrib.auth ' , ...] =================方案二================== 问题分析,你在配置中设置了 AUTH_USER_MODEL = 'user.User' ( 应用名 . 模型类名 ) , 扩展 django 自带的 user 认证 .由于不是项目的第一次迁移,所以会产生此问题 ,解决方案如下: 0. 先把现有的数据库导出备份,然后清掉数据库中所有的数据表。 1 . 把开发者创建的所有子应用下面的migrations目录下除了__init__.py以外的所有迁移文件,只要涉及到用户的,一律删除 2 . 把django.contrib.admin.migrations目录下除了__init__.py以外的所有迁移文件,全部删除。 3 . 把django.contrib.auth

How to retrieve all the attributes of LDAP database

梦想与她 提交于 2020-05-24 20:57:04
问题 I am using ldap module of python to connect to ldap server . I am able to query the database but I dont know how to retrieve the fields present in the database , so that I can notify the user in advance to quering the database, telling him that the field he is trying to access is not in the database. For example if the fields present are just cn memberOf and if the user tries to query the database with filter cn and memberOf and notcontained I should be able to know that the notcontained

让员工自助修改ldap密码

∥☆過路亽.° 提交于 2020-04-15 09:36:25
【推荐阅读】微服务还能火多久?>>> ldap-password 介绍 自助修改 ldap 用户密码 环境 安装教程 Docker 部署 docker run --restart=always -d -p 8000:8000 --env LDAP_HOST="192.168.1.250" --env LDAP_ADMIN_USER="root.ops.net" --env LDAP_PASSWORD="PASSWD" --name ldap-password lghost/ldap-password:latest # Use the Manager account 调试打印输出 docker -it -p 8000:8000 -rm ...省略 Django version 3.0.5, using settings 'website.settings' Starting development server at http://0.0.0.0:8000/ Quit the server with CONTROL-C [10/Apr/2020 00:09:49] "GET / HTTP/1.1" 200 4824 LDAP connect success! [10/Apr/2020 00:09:58] "POST / HTTP/1.1" 200 18 LDAP connect

How do I search for an object in LDAP based on its dn, in python-ldap?

淺唱寂寞╮ 提交于 2020-01-23 01:27:29
问题 I am trying to use e.g. the search_s function to search for an object based on its full distinguished name, but am not finding this to be convenient. For example, search_s('DC=example, DC=com', ldap.SCOPE_SUBTREE, '(CN=Somebody, OU=Department, DC=example, DC=com)') How do I just retrieve one object based on its full LDAP distinguished name? 回答1: Use SCOPE_BASE and a wildcard filter to return only the dn given by the first argument (the filter still has to match that object!) For example,