Power Global

Power Global

A central meeting place for IBM Power. Connect, ask questions, share ideas, and explore the full spectrum of Power technologies across workloads, industries, and use cases.


#TechXchangePresenter
#Power

 View Only
  • 1.  LDAP QUERY

    Posted Wed May 25, 2022 03:56 PM

    We have installed the application "LDAP and Active Directory Functions for SOAR", https://exchange.xforce.ibmcloud.com/hub/extension/72b8204066d3b290b68bae2eeb1942cd

    The below error still exists:

    "An error occurred while processing the action acknowledgement." Please suggest the changes in the scripts if any

    We have mentioned the pre and Post scripts as per the guide only:

    Pre process script:

    inputs.ldap_search_base = "DC=tic-tb, DC=com"

    inputs.ldap_search_filter = "(&(objectClass=person)(sAMAccountName=%ldap_param%))"

    inputs.ldap_search_attributes = "uid,cn,sn,mail,telephoneNumber"

    inputs.ldap_search_param = "cyber1"

    Post Process script

    """

    'entries': [{"dn": "uid=newton,dc=example,dc=com",

    "telephoneNumber": [],

    "uid": ["newton"],

    "mail": ["newton@ldap.forumsys.com"],

    "sn": ["Newton"], "cn": ["Isaac Newton"]},

    {"dn": "uid=einstein,dc=example,dc=com",

    "telephoneNumber": ["314-159-2653"],

    "uid": ["einstein"],

    "mail": ["einstein@ldap.forumsys.com"],

    "sn": ["Einstein"],

    "cn": ["Albert Einstein"]}]

    """

    # Example of expected results - ActiveDirectory

    """

    'entries': [{u'dn': u'CN=Isaac Newton,OU=IBMResilient,DC=ibm,DC=resilient,DC=com',

    u'telephoneNumber': u'314-159-2653', u'cn': u'Isaac Newton',

    u'mail': u'einstein@resilient.ibm.com', u'sn': u'Newton'}]

    """

    # Globals

    ENTRY_TO_DATATABLE_MAP = {

    "uid": "uid",

    "cn": "fullname",

    "sn": "surname",

    "mail": "email_address",

    "telephoneNumber": "telephone_number"

    }

    # Processing if the function is a success

    if(results.success):

    for entry in results["entries"]:

    if entry is None:

    break

    else:

    # Add Row

    row = incident.addRow("ldap_query_results")

    for k in ENTRY_TO_DATATABLE_MAP:

    if entry[k] is None:

    row[ENTRY_TO_DATATABLE_MAP[k]] = "N/A"

    else:

    try:

    # if 'entry[k]' is empty

    if len(entry[k]) == 0:

    row[ENTRY_TO_DATATABLE_MAP[k]] = "N/A"

    # Handle for Active Directory

    elif isinstance(entry[k], unicode):

    row[ENTRY_TO_DATATABLE_MAP[k]] = entry[k]

    # Handle for OpenLdap

    else:

    row[ENTRY_TO_DATATABLE_MAP[k]] = entry[k][0]

    except IndexError:

    row[ENTRY_TO_DATATABLE_MAP[k]] = "N/A"

     


    Thanks & Regards,
    Srinivas



    ------------------------------
    Srinivas M
    ------------------------------