npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-ldapquery

v1.1.0

Published

A custom n8n node for querying and managing LDAP/Active Directory servers with AI-powered natural language query support

Readme

n8n-nodes-ldapquery

A custom n8n node for querying and managing LDAP/Active Directory servers with AI-powered natural language query support.

Features

  • 🔍 LDAP Query Operations: Search users, groups, and other objects in your LDAP directory
  • 🤖 AI-Powered Natural Language Queries: Convert plain English queries to LDAP filters using OpenAI
  • 👤 User Creation: Create new Active Directory users with comprehensive attributes
  • 🔐 Secure Authentication: Support for bind DN authentication with optional SSL/TLS
  • 📊 Pagination Support: Handle large result sets with configurable page sizes
  • 🎛️ Flexible Configuration: Extensive options for user creation and query customization

Installation

Option 1: Install from npm (Recommended)

npm install n8n-nodes-ldapquery

Option 2: Manual Installation

  1. Clone this repository
  2. Build the project:
    npm install
    npm run build
  3. Copy the dist folder to your n8n custom nodes directory

Option 3: n8n Community Nodes

  1. Go to Settings > Community Nodes in your n8n instance
  2. Click Install a community node
  3. Enter: n8n-nodes-ldapquery
  4. Click Install

Configuration

LDAP Credentials

Before using this node, you need to configure LDAP credentials:

  1. Go to Credentials in your n8n instance
  2. Click Create New
  3. Select LDAP Credentials
  4. Fill in:
    • LDAP Server URL: ldap://your-server.com:389 or ldaps://your-server.com:636
    • Bind DN: CN=service-account,OU=Users,DC=company,DC=com
    • Bind Password: Your service account password

OpenAI API (Optional)

For natural language query support:

  1. Create OpenAI API credentials
  2. Add your OpenAI API key

Usage

Query Operations

Natural Language Queries

Find all users in the Sales department
Show me John Smith's contact information
List all disabled accounts
Find users with manager email [email protected]

Manual LDAP Filters

(objectClass=person)
(&(objectClass=user)(department=Sales))
(&(cn=John*)(mail=*))
(userAccountControl:1.2.840.113556.1.4.803:=2)

User Creation

Create new Active Directory users with:

  • Required Fields: Full Name, Last Name, First Name, Username, UPN, Password, Target OU
  • Optional Fields: Title, Department, Email, Phone, Manager, Company, Office

Examples

Basic User Query

{
  "operation": "query",
  "searchBase": "DC=company,DC=com",
  "searchFilter": "(objectClass=person)",
  "attributes": "cn,mail,department",
  "pageSize": 100
}

AI-Powered Query

{
  "operation": "query",
  "nlQuery": "Find all users in IT department",
  "searchBase": "DC=company,DC=com",
  "attributes": "cn,mail,title,department"
}

Create New User

{
  "operation": "create",
  "newCn": "John Doe",
  "newSn": "Doe",
  "newGivenName": "John",
  "newUsername": "jdoe",
  "newUpn": "[email protected]",
  "newPassword": "SecurePassword123!",
  "newOu": "OU=Users,DC=company,DC=com",
  "options": {
    "title": "Software Engineer",
    "department": "IT",
    "email": "[email protected]",
    "phoneNumber": "+1-555-0123"
  }
}

Node Properties

Query Operation

| Property | Type | Description | |----------|------|-------------| | Natural Language Query | string | Plain English query (requires OpenAI API) | | Manual Search Filter | string | LDAP filter syntax | | Search Base | string | Base DN for search | | Attributes | string | Comma-separated list of attributes | | Page Size | number | Maximum results per page | | AI System Prompt | string | Custom prompt for AI query conversion |

Create User Operation

| Property | Type | Description | |----------|------|-------------| | Full Name | string | Complete name (CN) | | Last Name | string | Surname (sn) | | First Name | string | Given name | | Username | string | sAMAccountName | | UPN | string | User Principal Name | | Password | string | User password | | Target OU | string | Organizational Unit DN | | Options | collection | Additional user attributes |

Security Considerations

  • Use service accounts with minimal required permissions
  • Enable SSL/TLS for production environments
  • Store credentials securely in n8n's credential system
  • Regularly rotate service account passwords
  • Monitor LDAP access logs

Troubleshooting

Common Issues

  1. Connection Timeout

    • Check LDAP server URL and port
    • Verify network connectivity
    • Check firewall settings
  2. Authentication Failed

    • Verify Bind DN format
    • Check service account password
    • Ensure account has necessary permissions
  3. SSL/TLS Errors

    • Use ldaps:// for secure connections
    • Enable "Disable Certificate Validation" for testing only
    • Verify certificate chain
  4. Search Returns No Results

    • Check search base DN
    • Verify LDAP filter syntax
    • Ensure attributes exist in schema

Debug Mode

Enable debug logging in n8n to see detailed LDAP operations:

N8N_LOG_LEVEL=debug npm start

Development

Building from Source

git clone https://github.com/widjis/LdapQuery.git
cd LdapQuery
npm install
npm run build

Project Structure

src/
├── LdapQuery.node.ts          # Main node implementation
├── credentials/
│   └── LdapCredentials.credentials.ts  # Credential definition
└── lib/
    └── ldapService.ts          # LDAP service functions

Dependencies

  • ldapjs: LDAP client library
  • n8n-workflow: n8n workflow types and utilities
  • axios: HTTP client for OpenAI API calls

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Support

For issues and questions:

  • Create an issue on GitHub
  • Check the n8n community forum
  • Review the troubleshooting section above

Changelog

v1.0.0

  • Initial release
  • LDAP query and user creation operations
  • AI-powered natural language queries
  • Comprehensive user attribute support
  • SSL/TLS support with certificate validation options