Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Advanced LDAP authentication plugin #8958

Open
bzp2010 opened this issue Feb 28, 2023 · 3 comments
Open

Proposal: Advanced LDAP authentication plugin #8958

bzp2010 opened this issue Feb 28, 2023 · 3 comments
Assignees
Labels
discuss enhancement New feature or request

Comments

@bzp2010
Copy link
Contributor

bzp2010 commented Feb 28, 2023

Background

Currently APISIX has provided a simple LDAP authentication plugin that supports simple bind functions, but does not support, for example, user groups, for which users have a need. We can do this by introducing a new plugin to provide a platform to host these newly added and future needed features.

Benefits

Users can use the new plug-in to bind identity groups to consumers, and colleagues can also use consumerless mode (i.e., authentication only). In the future, the plug-in can be extended to support more complex authentication models.

Goals

Create a new plugin, called ldap-auth-advanced.

Configuration design

Route configuration

Name Type Optional Default Description
ldap_uri string no    
use_starttls boolean yes false  
use_ldaps boolean yes false  
ssl_verify boolean yes true  
timeout integer yes 10000 socket timeout time
keepalive boolean yes yes Whether to enable connection pool
keepalive_timeout integer yes 60000 Connection pool connection timeout time
keepalive_pool_size integer yes 5 Connection pool size
keepalive_pool_name string yes : Connection pool name
ldap_debug boolean yes false Record search logs
consumer_required boolean yes true Whether the consumer must attach it or not, the certification will fail.
user_dn string no   DN template for identifying users (cn=%s,ou=users,dc=example,dc=org)
user_membership_attribute string no memberOf Add: Used to indicate which attribute in a user object indicates the group to which it belongs. For example memberOf.

Consumer configuration

Name Type Optional Default Description
user_dn string yes   User DN, mutually exclusive
group_dn string yes   Group DN, mutually exclusive

Plugin logic

  1. User access triggered route's access phase
  2. The plugin uses lua-resty-ldap to connect to the LDAP server. (Connection reuseable)
  3. Execute the binding according to the configuration.
  4. Performs a search based on the user dn to fetch user_membership_attribute
  5. Try to attach user dn or group dn to consumer (user dn > group dn)

Tips

  • The plugin allows the use of route + consumer and pure route modes.
  • Consumer support for mapping individual users or individual groups.
  • The plugin runs in the access phase.
  • The plugin maintains its own connection pool (specified configuration).

Other

I would like to hear your opinions and welcome comments.

@bzp2010 bzp2010 added enhancement New feature or request discuss labels Feb 28, 2023
@bzp2010 bzp2010 self-assigned this Feb 28, 2023
@Fabriceli
Copy link
Contributor

Can add these features in the ldap-auth plugin, not create new plugin?

@bzp2010
Copy link
Contributor Author

bzp2010 commented Mar 3, 2023

Can add these features in the ldap-auth plugin, not create new plugin?

Hi, @Fabriceli and @nic-chen.

It seems to me that the old plugin contains some non-standard naming, such as tls_verify, etc. (usually ssl_verify), and if new functionality is implemented based on it, some break change will have to be made, and I'm not sure how well people will accept such a change.

@Fabriceli
Copy link
Contributor

Can we continue to use the old name, that will be more friendly for the users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants