Skip to content

Commit

Permalink
Merge pull request #18 from dignajar/refactor/helm-chart-and-minor-bu…
Browse files Browse the repository at this point in the history
…gs-fixes

Bug Fix for "Allowed users" and Helm chart updates
  • Loading branch information
dignajar authored May 31, 2021
2 parents 88a8a31 + 7f4b3a2 commit 6b24bac
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions chart/another-ldap-auth/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: another-ldap-auth
description: A Helm chart using another-ldap-auth to enable AD or LDAP based basic-authentication for ingress resources
type: application
version: 0.1.0
appVersion: 1.9.0
version: 0.2.0
appVersion: 2.0.1
keywords:
- ingress
- nginx
Expand Down
4 changes: 2 additions & 2 deletions chart/another-ldap-auth/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# another-ldap-auth

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.9.0](https://img.shields.io/badge/AppVersion-1.9.0-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.1](https://img.shields.io/badge/AppVersion-2.0.1-informational?style=flat-square)

A Helm chart using another-ldap-auth to enable AD or LDAP based basic-authentication for ingress resources

Expand Down Expand Up @@ -32,7 +32,7 @@ A Helm chart using another-ldap-auth to enable AD or LDAP based basic-authentica
| ldap.managerDnUsername | string | `"CN=john,OU=Administrators,DC=TESTMYLDAP,DC=COM"` | |
| ldap.searchBase | string | `"DC=TESTMYLDAP,DC=COM"` | |
| ldap.searchFilter | string | `"(sAMAccountName={username})"` | |
| ldap.serverDomain | string | `"TESTMYLDAP.COM"` | |
| ldap.bindDN | string | `"{username}@TESTMYLDAP.com"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
Expand Down
6 changes: 4 additions & 2 deletions chart/another-ldap-auth/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ spec:
value: {{ .Values.ldap.httpsSupport }}
- name: LDAP_MANAGER_DN_USERNAME
value: {{ .Values.ldap.managerDnUsername }}
- name: LDAP_SERVER_DOMAIN
value: {{ .Values.ldap.serverDomain }}
- name: LDAP_BIND_DN
value: {{ .Values.ldap.bindDN }}
- name: LDAP_SEARCH_BASE
value: {{ .Values.ldap.searchBase }}
- name: LDAP_SEARCH_FILTER
value: {{ .Values.ldap.searchFilter }}
- name: LOG_LEVEL
value: {{ .Values.ldap.logLevel }}
- name: LOG_FORMAT
value: {{ .Values.ldap.logFormat }}
- name: LDAP_MANAGER_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
8 changes: 4 additions & 4 deletions chart/another-ldap-auth/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ replicaCount: 1
image:
repository: dignajar/another-ldap-auth
pullPolicy: IfNotPresent
tag: "1.9"
tag: "2.0.1"

imagePullSecrets: []
nameOverride: ""
Expand All @@ -12,17 +12,17 @@ fullnameOverride: ""
# AD config
ldap:
existingSecret:
logLevel: INFO
logLevel: "INFO"
logFormat: "TEXT"
cacheExpiration: 10
httpsSupport: "enabled"
endpoint: "ldaps://testmyldap.com:636"
managerDnUsername: "CN=john,OU=Administrators,DC=TESTMYLDAP,DC=COM"
managerDnPassword:
serverDomain: "TESTMYLDAP.COM"
bindDN: "{username}@TESTMYLDAP.com"
searchBase: "DC=TESTMYLDAP,DC=COM"
searchFilter: "(sAMAccountName={username})"


serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down
5 changes: 4 additions & 1 deletion files/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ def login(username, password):
matchingUsers = LDAP_ALLOWED_USERS.split(",") # Convert string to list
matchingUsers = list(map(cleanMatchingUsers, matchingUsers))
if username in matchingUsers:
logs.info({'message':'Username inside the matching users list.', 'username': username, 'matchingUsers': ','.join(matchingUsers)})
logs.info({'message':'Username inside the allowed users list.', 'username': username, 'matchingUsers': ','.join(matchingUsers)})
setRegister(username, [])
return True
elif not LDAP_ALLOWED_GROUPS:
logs.info({'message':'Username not found inside the allowed users list.', 'username': username, 'matchingUsers': ','.join(matchingUsers)})
return False

# Validate user via matching groups
matchedGroups = []
Expand Down

0 comments on commit 6b24bac

Please sign in to comment.