[bitnami/nginx] feat: Improve LDAP documentation (#5165)

* feat: Improve LDAP documentation

Signed-off-by: joancafom <jcarmona@vmware.com>

* Update README.md with feedback
This commit is contained in:
Jose Antonio Carmona
2021-01-26 10:22:59 +01:00
committed by GitHub
parent 28e401cafa
commit 457c7302ed
3 changed files with 81 additions and 7 deletions
+1 -1
View File
@@ -25,4 +25,4 @@ name: nginx
sources:
- https://github.com/bitnami/bitnami-docker-nginx
- http://www.nginx.org
version: 8.4.0
version: 8.4.1
+76 -2
View File
@@ -295,11 +295,85 @@ In addition, you can also set an external ConfigMap with the configuration file.
In some scenarios, you may require users to authenticate in order to gain access to protected resources. By enabling LDAP, NGINX will make use of an Authorization Daemon to proxy those identification requests against a given LDAP Server.
```
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ NGINX │ -----> │ NGINX │ -----> │ LDAP │
│ server │ <----- | ldap daemon │ <----- | server │
└────────────────┘ └────────────────┘ └────────────────┘
```
In order to enable LDAP authentication you can set the `ldapDaemon.enabled` property and follow these steps:
1. Use the `ldapDaemon.nginxServerBlock` property to provide with an additional server block that will make NGINX such a proxy (see `values.yaml`). Alternatively, you can provide this configuration using an external Secret and the property `ldapDaemon.existingNginxServerBlockSecret`.
1. NGINX server needs to be configured to be self-aware of the proxy. In order to do so, use the `ldapDaemon.nginxServerBlock` property to provide with an additional server block, that will instruct NGINX to use it (see `values.yaml`). Alternatively, you can specify this server block configuration using an external Secret using the property `ldapDaemon.existingNginxServerBlockSecret`.
2. Complete the aforementioned server block by specifying your LDAP Server connection details (see `values.yaml`). Alternatively, you can declare them using the property `ldapDaemon.ldapConfig`.
2. Supply your LDAP Server connection details either in the aforementioned server block (setting request headers) or specifying them in `ldapDaemon.ldapConfig`. e.g. The following two approaches are equivalent:
_Approach A) Specify connection details using the `ldapDaemon.ldapConfig` property_
```yaml
ldapDaemon:
enabled: true
ldapConfig:
uri: "ldap://YOUR_LDAP_SERVER_IP:YOUR_LDAP_SERVER_PORT"
baseDN: "dc=example,dc=org"
bindDN: "cn=admin,dc=example,dc=org"
bindPassword: "adminpassword"
nginxServerBlock: |-
server {
listen 0.0.0.0:{{ .Values.containerPorts.http }};
# You can provide a special subPath or the root
location = / {
auth_request /auth-proxy;
}
location = /auth-proxy {
internal;
proxy_pass http://127.0.0.1:{{ .Values.ldapDaemon.port }};
}
}
```
_Approach B) Specify connection details directly in the server block_
```yaml
ldapDaemon:
enabled: true
nginxServerBlock: |-
server {
listen 0.0.0.0:{{ .Values.containerPorts.http }};
# You can provide a special subPath or the root
location = / {
auth_request /auth-proxy;
}
location = /auth-proxy {
internal;
proxy_pass http://127.0.0.1:{{ .Values.ldapDaemon.port }};
###############################################################
# YOU SHOULD CHANGE THE FOLLOWING TO YOUR LDAP CONFIGURATION #
###############################################################
# URL and port for connecting to the LDAP server
proxy_set_header X-Ldap-URL "ldap://YOUR_LDAP_SERVER_IP:YOUR_LDAP_SERVER_PORT";
# Base DN
proxy_set_header X-Ldap-BaseDN "dc=example,dc=org";
# Bind DN
proxy_set_header X-Ldap-BindDN "cn=admin,dc=example,dc=org";
# Bind password
proxy_set_header X-Ldap-BindPass "adminpassword";
}
}
```
### Adding extra environment variables
+4 -4
View File
@@ -434,16 +434,16 @@ ldapDaemon:
###############################################################
# URL and port for connecting to the LDAP server
proxy_set_header X-Ldap-URL "ldap://YOUR_LDAP_SERVER_IP:YOUR_LDAP_SERVER_PORT";
# proxy_set_header X-Ldap-URL "ldap://YOUR_LDAP_SERVER_IP:YOUR_LDAP_SERVER_PORT";
# Base DN
proxy_set_header X-Ldap-BaseDN "dc=example,dc=org";
# proxy_set_header X-Ldap-BaseDN "dc=example,dc=org";
# Bind DN
proxy_set_header X-Ldap-BindDN "cn=admin,dc=example,dc=org";
# proxy_set_header X-Ldap-BindDN "cn=admin,dc=example,dc=org";
# Bind password
proxy_set_header X-Ldap-BindPass "adminpassword";
# proxy_set_header X-Ldap-BindPass "adminpassword";
}
}