Giter Club home page Giter Club logo

hubot-ldap-auth's Introduction

Hubot LDAP Authorization

npm version

This module is derived from the hubot-auth module and it delegates the main functions of authorization to an LDAP server using the ldapjs LDAP client. In the implementation, it is meant to be a drop in replacement for the existing module so that the other integrations that exist around hubot-auth can continue to function properly. All modifying actions have been removed from the auth client so that the LDAP server can act as a service providing authorization details to Hubot, rather than providing Hubot ability to do such modifications. Theoretically, this would be a separate script to do such an integration, but it is not in the scope of this module.

Configuration

  • HUBOT_LDAP_AUTH_LDAP_URL - the URL to the LDAP server
  • HUBOT_LDAP_AUTH_BIND_DN - the bind DN to authenticate with
  • HUBOT_LDAP_AUTH_BIND_PASSWORD - the bind password to authenticate with
  • HUBOT_LDAP_AUTH_TLS_OPTIONS_CA - the full path to a CA certificate file in PEM format. Passed to TLS connection layer when connecting via ldaps://
  • HUBOT_LDAP_AUTH_TLS_OPTIONS_CERT - the full path to a certificate file in PEM format. Passed to TLS connection layer when connecting via ldaps://
  • HUBOT_LDAP_AUTH_TLS_OPTIONS_KEY - the full path to a private key file in PEM format. Passed to TLS connection layer when connecting via ldaps://
  • HUBOT_LDAP_AUTH_TLS_OPTIONS_CIPHERS - cipher suite string. Passed to TLS connection layer when connecting via ldaps://
  • HUBOT_LDAP_AUTH_TLS_OPTIONS_SECURE_PROTOCOL - ssl method to use. Passed to TLS connection layer when connecting via ldaps://
  • HUBOT_LDAP_AUTH_USER_SEARCH_FILTER - the ldap filter search for a specific user - e.g. 'cn={0}' where '{0}' will be replaced by the hubot user attribute
  • HUBOT_LDAP_AUTH_GROUP_MEMBERSHIP_ATTRIBUTE - the member attribute within the user object
  • HUBOT_LDAP_AUTH_GROUP_MEMBERSHIP_FILTER - the membership filter to find groups based on user DN - e.g. 'member={0}' where '{0}' will be replaced by user DN
  • HUBOT_LDAP_AUTH_GROUP_MEMBERSHIP_SEARCH_METHOD - (filter | attribute) - how to find groups belong to users
  • HUBOT_LDAP_AUTH_ROLES_TO_INCLUDE - comma separated group names that will be used as roles, all the rest of the groups will be filtered out
  • HUBOT_LDAP_AUTH_USE_ONLY_LISTENER_ROLES - if true, groups will be filtered by all listener options, all the rest of the groups will be filtered out
  • HUBOT_LDAP_AUTH_SEARCH_BASE_DN - search DN to start finding users and groups within the ldap directory
  • HUBOT_LDAP_AUTH_USER_LDAP_ATTRIBUTE - the ldap attribute to match hubot users within the ldap directory
  • HUBOT_LDAP_AUTH_HUBOT_USER_ATTRIBUTE - the hubot user attribute to search for a user within the ldap directory
  • HUBOT_LDAP_AUTH_GROUP_LDAP_ATTRIBUTE - the ldap attribute of a group that will be used as role name
  • HUBOT_LDAP_AUTH_LDAP_REFRESH_TIME - time in millisecods to refresh the roles and users
  • HUBOT_LDAP_AUTH_DN_ATTRIBUTE_NAME - the dn attribute name, used for queries by DN. In ActiveDirectory should be distinguishedName
  • HUBOT_LDAP_AUTH_USER_ATTRIBUTE_REWRITE_RULE - regex for rewriting the hubot username to the one used in ldap - e.g. '@(.+):matrix.org' where the first capturing group will be used as username. No subsitution if omitted

Integration with Hubot

This script is meant to be used with the hubot-auth-middleware project which uses the auth plugin in Hubot to determine whether a user can take a particular action. See the README.md of that project for more details on configuring roles for user actions.

In order to set up this plugin, first install it in the project:

npm install hubot-ldap-auth --save

Then, add the script to the external-scripts.json file:

[
  "hubot-ldap-auth"
]

hubot-ldap-auth's People

Contributors

jlindquist-godaddy avatar jmcshane avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hubot-ldap-auth's Issues

Missing debugging mode

There are a lot of environment variables and configuration isn't straightforward because LDAP directory structure isn't always the same. I've tried enabling "HUBOT_LOG_LEVEL=debug" but that isn't enough to view the actual LDAP queries being launched to do some useful troubleshooting. Right now hubot starts and shows the following block:

[Thu Oct 18 2018 12:23:02 GMT+0200 (CEST)] INFO Starting ldap search with ldapURL: ldap://ldap.mydomain.local, bindDn: cn=rocketchat,dc=mydomain,dc=local, userSearchFilter: uid={0},ou=Users,dc=mydomain,dc=local, groupMembershipFilter: uniqueMember=uid={0},ou=Users,dc=mydomain,dc=local, groupMembershipAttribute: username, groupMembershipSearchMethod: filter, rolesToInclude: undefined, useOnlyListenerRoles: false, baseDn: dc=mydomain,dc=local, ldapUserNameAttribute: uid, hubotUserNameAttribute: dn, groupNameAttribute: cn

but no roles or users are being loaded.

The module should either provide either a way to debug LDAP queries happening behind the scenes or a real life example in the README.md showing how a sample LDAP directory structure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.