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

LDAP user search/custom mapping + TLS support #545

Merged
merged 9 commits into from
Jul 21, 2023
Prev Previous commit
Next Next commit
Update ldap_user_search documentation and plugin config
  • Loading branch information
cecilialau6776 committed Jun 5, 2023
commit 41d9acbe47ee9e44ee95b9c57875e777120eb1df
1 change: 1 addition & 0 deletions coldfront/config/plugins/ldap_user_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
LDAP_USER_SEARCH_PRIV_KEY_FILE = ENV.str("LDAP_USER_SEARCH_PRIV_KEY_FILE", "")
LDAP_USER_SEARCH_CERT_FILE = ENV.str("LDAP_USER_SEARCH_CERT_FILE", "")
LDAP_USER_SEARCH_CACERT_FILE = ENV.str("LDAP_USER_SEARCH_CACERT_FILE", "")

ADDITIONAL_USER_SEARCH_CLASSES = ['coldfront.plugins.ldap_user_search.utils.LDAPUserSearch',]
19 changes: 14 additions & 5 deletions coldfront/plugins/ldap_user_search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,27 @@ search.py code in the FreeIPA plugin.

ColdFront provides an API to define additional user search classes for
extending the default search functionality. This app implements a
LDAPUserSearch class in utils.py which performs the LDAP search. This class is
then registered with ColdFront by setting "ADDITIONAL\_USER\_SEARCH\_CLASSES"
in local\_settings.py.
LDAPUserSearch class in `utils.py` which performs the LDAP search. This class is
then registered with ColdFront by setting `ADDITIONAL_USER_SEARCH_CLASSES`
in `config/plugins/ldap_user_search.py`

## Requirements

- pip install python-ldap ldap3

## Usage

To enable this plugin add the following in your `local_settings.py` file:
To enable this plugin set the following environment variables:

```
ADDITIONAL_USER_SEARCH_CLASSES = ['coldfront.plugins.ldap_user_search.utils.LDAPUserSearch',]
PLUGIN_LDAP_USER_SEARCH=True
LDAP_USER_SEEACH_SERVER_URI=ldap://example.com
LDAP_USER_SEARCH_BASE="dc=example,dc=com"
LDAP_USER_SEARCH_BIND_DN="cn=Manager,dc=example,dc=com"
LDAP_USER_SEARCH_BASE="dc=example,dc=com"
LDAP_USER_SEARCH_USE_SSL=True
LDAP_USER_SEARCH_USE_TLS=True
LDAP_USER_SEARCH_CACERT_FILE=/path/to/cacert
LDAP_USER_SEARCH_CERT_FILE=/path/to/cert
LDAP_USER_SEARCH_PRIV_KEY_FILE=/path/to/key
```
4 changes: 4 additions & 0 deletions docs/pages/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ exist in your backend LDAP to show up in the ColdFront user search.
| LDAP_USER_SEARCH_BASE | User search base dn |
| LDAP_USER_SEARCH_CONNECT_TIMEOUT | Time in seconds to wait before timing out. Default 2.5 |
| LDAP_USER_SEARCH_USE_SSL | Whether to use ssl when connecting to LDAP server. Default True |
| LDAP_USER_SEARCH_USE_TLS | Whether to use tls when connecting to LDAP server. Default False |
| LDAP_USER_SEARCH_PRIV_KEY_FILE | Path to the private key file. |
| LDAP_USER_SEARCH_CERT_FILE | Path to the certificate file. |
| LDAP_USER_SEARCH_CACERT_FILE | Path to the CA cert file. |

## Advanced Configuration

Expand Down