Documentationcurrent version
Help us improve the docs by fixing typos and proposing enhancements.


Action ""

Opens a connection to an LDAP server, binds, and performs a search using specified parameters.


const {stdout} = await{
  base: 'dc=example,dc=org'
// dn: dc=example,dc=org

Schema definitions

definitions =
    type: 'object'
        type: 'array'
        items: type: 'string'
        default: []
        description: '''
        List of attributes to return, default to all.
        type: 'boolean'
        description: '''
        Continuous  operation  mode.  Errors  are reported, but ldapsearch
        will continue with searches.
        type: 'string'
        description: '''
        One or multiple DN to remove.
        type: 'string'
        description: '''
        The filter should conform to the string representation for search
        filters as defined in RFC 4515. If not provided, the default filter,
        (objectClass=*), is used.
        type: 'string'
        enum: ['base', 'one', 'sub', 'children']
        description: '''
        Distinguish name storing the "olcAccess" property, using the database
        address (eg: "olcDatabase={2}bdb,cn=config").
      # General LDAP connection information
        type: 'string'
        description: '''
        Distinguished Name to bind to the LDAP directory.
        type: 'string'
        description: '''
        Specify the SASL mechanism to be used for authentication. If it's not
        specified, the program will choose the best  mechanism  the  server
        type: 'string'
        description: '''
        Password for simple authentication.
        type: 'string'
        description: '''
        LDAP Uniform Resource Identifier(s), "ldapi:///" if true, default to
        false in which case it will use your openldap client environment
    required: ['base']


handler = ({config}) ->
  # Auth related config
  if config.uri is true
    config.mesh ?= 'EXTERNAL'
    config.uri = 'ldapi:///'
  # Add related config
  await @execute config, [
    '-o ldif-wrap=no'
    '-LLL' # Remove comments
    '-c' if config.continuous
    "-Y #{utils.string.escapeshellarg config.mesh}" if config.mesh
    "-D #{utils.string.escapeshellarg config.binddn}" if config.binddn
    "-w #{utils.string.escapeshellarg config.passwd}" if config.passwd
    "-H #{utils.string.escapeshellarg config.uri}" if config.uri
    "-b #{utils.string.escapeshellarg config.base}"
    "-s #{utils.string.escapeshellarg config.scope}" if config.scope
    "#{utils.string.escapeshellarg config.filter}" if config.filter
    ...( utils.string.escapeshellarg
  ].join ' '


module.exports =
  handler: handler
    global: 'ldap'
    shy: true
    definitions: definitions


utils = require './utils'
Edit on GitHub

Nikita is an open source project hosted on GitHub and developed by Adaltas.