Skip to content

Commit 6b24bac

Browse files
authored
Merge pull request #18 from dignajar/refactor/helm-chart-and-minor-bugs-fixes
Bug Fix for "Allowed users" and Helm chart updates
2 parents 88a8a31 + 7f4b3a2 commit 6b24bac

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

chart/another-ldap-auth/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: another-ldap-auth
33
description: A Helm chart using another-ldap-auth to enable AD or LDAP based basic-authentication for ingress resources
44
type: application
5-
version: 0.1.0
6-
appVersion: 1.9.0
5+
version: 0.2.0
6+
appVersion: 2.0.1
77
keywords:
88
- ingress
99
- nginx

chart/another-ldap-auth/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# another-ldap-auth
22

3-
![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)
3+
![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)
44

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

@@ -32,7 +32,7 @@ A Helm chart using another-ldap-auth to enable AD or LDAP based basic-authentica
3232
| ldap.managerDnUsername | string | `"CN=john,OU=Administrators,DC=TESTMYLDAP,DC=COM"` | |
3333
| ldap.searchBase | string | `"DC=TESTMYLDAP,DC=COM"` | |
3434
| ldap.searchFilter | string | `"(sAMAccountName={username})"` | |
35-
| ldap.serverDomain | string | `"TESTMYLDAP.COM"` | |
35+
| ldap.bindDN | string | `"{username}@TESTMYLDAP.com"` | |
3636
| nameOverride | string | `""` | |
3737
| nodeSelector | object | `{}` | |
3838
| podAnnotations | object | `{}` | |

chart/another-ldap-auth/templates/deployment.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ spec:
4242
value: {{ .Values.ldap.httpsSupport }}
4343
- name: LDAP_MANAGER_DN_USERNAME
4444
value: {{ .Values.ldap.managerDnUsername }}
45-
- name: LDAP_SERVER_DOMAIN
46-
value: {{ .Values.ldap.serverDomain }}
45+
- name: LDAP_BIND_DN
46+
value: {{ .Values.ldap.bindDN }}
4747
- name: LDAP_SEARCH_BASE
4848
value: {{ .Values.ldap.searchBase }}
4949
- name: LDAP_SEARCH_FILTER
5050
value: {{ .Values.ldap.searchFilter }}
5151
- name: LOG_LEVEL
5252
value: {{ .Values.ldap.logLevel }}
53+
- name: LOG_FORMAT
54+
value: {{ .Values.ldap.logFormat }}
5355
- name: LDAP_MANAGER_PASSWORD
5456
valueFrom:
5557
secretKeyRef:

chart/another-ldap-auth/values.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ replicaCount: 1
33
image:
44
repository: dignajar/another-ldap-auth
55
pullPolicy: IfNotPresent
6-
tag: "1.9"
6+
tag: "2.0.1"
77

88
imagePullSecrets: []
99
nameOverride: ""
@@ -12,17 +12,17 @@ fullnameOverride: ""
1212
# AD config
1313
ldap:
1414
existingSecret:
15-
logLevel: INFO
15+
logLevel: "INFO"
16+
logFormat: "TEXT"
1617
cacheExpiration: 10
1718
httpsSupport: "enabled"
1819
endpoint: "ldaps://testmyldap.com:636"
1920
managerDnUsername: "CN=john,OU=Administrators,DC=TESTMYLDAP,DC=COM"
2021
managerDnPassword:
21-
serverDomain: "TESTMYLDAP.COM"
22+
bindDN: "{username}@TESTMYLDAP.com"
2223
searchBase: "DC=TESTMYLDAP,DC=COM"
2324
searchFilter: "(sAMAccountName={username})"
2425

25-
2626
serviceAccount:
2727
# Specifies whether a service account should be created
2828
create: true

files/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ def login(username, password):
148148
matchingUsers = LDAP_ALLOWED_USERS.split(",") # Convert string to list
149149
matchingUsers = list(map(cleanMatchingUsers, matchingUsers))
150150
if username in matchingUsers:
151-
logs.info({'message':'Username inside the matching users list.', 'username': username, 'matchingUsers': ','.join(matchingUsers)})
151+
logs.info({'message':'Username inside the allowed users list.', 'username': username, 'matchingUsers': ','.join(matchingUsers)})
152152
setRegister(username, [])
153153
return True
154+
elif not LDAP_ALLOWED_GROUPS:
155+
logs.info({'message':'Username not found inside the allowed users list.', 'username': username, 'matchingUsers': ','.join(matchingUsers)})
156+
return False
154157

155158
# Validate user via matching groups
156159
matchedGroups = []

0 commit comments

Comments
 (0)