0

try to find user information from ldap, but I get the timed out error. locally it is working

I've tried with both python-ldap and ldap3

at this moment, I am confused as I see some documentation and instruction how to use/deploy ldap on AWS Lambda but also found from AWS doc Lambda supports two types of connections: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).

so at the end, is it possible to connect to ldap?

import ldap

def lambda_handler(event, context):

    baseDN = 'xxx'
    searchDN = 'xxx'
    pw = "xxx"

    ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
    ldap_host = 'ldaps://ldap-server:3377'
    ldap_conn = ldap.initialize(ldap_host)

    ldap_conn.simple_bind_s(baseDN, pw)

    user = 'testuser'

    result = ldap_conn.search_s(searchDN,
                              ldap.SCOPE_SUBTREE,
                              f'(sAMAccountName={user})',['userAccountControl'])

1 Answer 1

1

Explain it to someone, in this case here, then it will pop up some possible fix into your head

so the issue was I had to attach the VPC with correct Security group into Lmbda configuration.

Sign up to request clarification or add additional context in comments.

1 Comment

In short, you needed to configure the Lambda function to access resources in your VPC, by the sound of things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.