Categorygithub.com/OSC/k8-ldap-configmap
module
0.10.0
Repository: https://github.com/osc/k8-ldap-configmap.git
Documentation: pkg.go.dev

# README

CI Status GitHub release GitHub All Releases Go Report Card codecov

k8-ldap-configmap

Kubernetes service that generates Kubernetes ConfigMap resources based on LDAP data.

The purpose of the LDAP data in a ConfigMap is to allow policy engines such as Kyverno to have policies that make use of the LDAP data stored in ConfigMaps.

This service uses predefined mappers to build the data for each ConfigMap. Current mappers are:

  • user-uid - The key is the username and the value is the user UID
  • user-gid - The Key is the username and the value is the user GID
  • user-groups - The key is the username and the value is JSON string that is array of groups that user is a member of
  • user-gids - The key is the username and the value is JSON string that is array of group GIDs that user is a member of (GIDs are strings)

Kubernetes support

Currently this code is built and tested against Kubernetes 1.25.x and 1.26.x.

Install

Install with Helm

Only Helm 3 is supported.

helm repo add k8-ldap-configmap https://osc.github.io/k8-ldap-configmap
helm install k8-ldap-configmap k8-ldap-configmap/k8-ldap-configmap -n k8-ldap-configmap --create-namespace \
  --set ldapUrl=ldaps://ldap.example.com:636 \
  --set ldapUserBaseDN=ou=People,dc=example,dc=com \
  --set ldapGroupBaseDN=ou=Groups,dc=example,dc=com

See chart README for documentation on options.

Install with YAML

First install the necessary Namespace and RBAC resources.

kubectl apply -f https://github.com/OSC/k8-ldap-configmap/releases/latest/download/namespace-rbac.yaml

The deployment should be downloaded as adjustments are needed to arguments to at minimum supply values for empty arguments.

wget https://github.com/OSC/k8-ldap-configmap/releases/latest/download/deployment.yaml
# Make changes to arguments
kubectl apply -f deployment.yaml

Configuration

The k8-ldap-configmap is intended to be deployed inside a Kubernetes cluster. It can also be run outside the cluster as a service.

For Active Directory it's likely paged searches are required so at minimum the --ldap-paged-search flag would be required.

The default filters for searching users and groups (--ldap-user-filter and --ldap-group-filter) can be overridden for specific mappers. For example, to override the group filter for user-gids mapper: --mappers-group-filter=user-gids=(objectClass=posixAccount). Each mapper override must be seperated by a comma.

The following flags and environment variables can modify the behavior of the k8-ldap-configmap:

FlagEnvironment VariableDescriptionDefault/Required
--ldap-urlLDAP_URLLDAP URL to query, example: ldap://ldap.example.com:389Required
--ldap-tlsLDAP_TLSEnable TLS when connecting to LDAPfalse
--no-ldap-tls-verifyLDAP_TLS_VERIFY=falseDisable TLS verification when connecting to LDAPtrue
--ldap-tls-ca-certLDAP_TLS_CA_CERTThe contents of TLS CA cert when the certificate needs to be verified and not in global trust storeNone
--ldap-group-base-dnLDAP_GROUP_BASE_DNBase DN of the Groups OU in LDAPRequired
--ldap-user-base-dnLDAP_USER_BASE_DNBase DN of the Users OU in LDAPRequired
--ldap-bind-dnLDAP_BIND_DNBind DN when connecting to LDAPNone (anonymous binds)
--ldap-bind-passwordLDAP_BIND_PASSWORDBind password when connecting to LDAPNone (anonymous binds)
--ldap-group-filterLDAP_GROUP_FILTERGroup LDAP filter(objectClass=posixGroup)
--ldap-user-filterLDAP_USER_FILTERUser LDAP filter(objectClass=posixAccount)
--ldap-paged-searchLDAP_PAGED_SEARCHEnable paged searches against LDAPfalse
--ldap-paged-search-sizeLDAP_PAGED_SEARCH_SIZESize of searches when using paged searches1000
--ldap-member-schemeLDAP_MEMBER_SCHEMEHow group members are defined, memberof, member or memberuidmemberof
--ldap-user-attr-mapLDAP_USER_ATTR_MAPAttribute map for usersname=uid,uid=uidNumber,gid=gidNumber
--ldap-group-attr-mapLDAP_GROUP_ATTR_MAPAttribute map for groupsname=cn,gid=gidNumber
--mappersMAPPERSThe mappers to runuser-uid,user-gid
--mappers-group-filterMAPPERS_GROUP_FILTERThe mapper specific group filtersNone (use --ldap-group-filter)
--mappers-user-filterMAPPERS_USER_FILTERThe mapper specific user filtersNone (use --ldap-user-filter)
--namespaceNAMESPACEThe namespace to write ConfigMaps toRequired
--user-prefixUSER_PREFIXPrefix to add to all username valuesNone
--intervalINTERLVALInterval to run LDAP sync to ConfigMaps5m
--kubeconfigKUBECONFIGThe path to Kubernetes config, required when run outside Kubernetes
--listen-addressLISTEN_ADDRESS=:8080Address to listen for HTTP requests
--no-process-metricsPROCESS_METRICS=falseDisable metrics about the running processes such as CPU, memory and Go stats
--log-level=infoLOG_LEVEL=infoThe logging level One of: [debug, info, warn, error]
--log-format=logfmtLOG_FORMAT=logfmtThe logging format, either logfmt or json

# Packages

No description provided by the author