Skip to content

Commit 6fad4f3

Browse files
authored
Merge pull request #64 from nikolaev-rd/patch-1
Formating fixed and optimized
2 parents 3704dc2 + 8da8eef commit 6fad4f3

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

README.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ To install and configure the reference implementation, perform the following ste
2828

2929
1. If an LDAP authentication server is not already running, install and configure one. By default the ldap-auth daemon communicates with OpenLDAP, but can be configured to work with Active Directory.
3030

31-
If you are using the LDAP server only to test the reference implementation, you can use the [OpenLDAP server Docker image](https://github.com/osixia/docker-openldap) that is available on GitHub, or you can set up a server in a virtual environment using instructions such as [How To Install and Configure a Basic LDAP Server on an Ubuntu 12.04 VPS](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-a-basic-ldap-server-on-an-ubuntu-12-04-vps).
31+
If you are using the LDAP server only to test the reference implementation, you can use the [OpenLDAP server Docker image](https://github.com/osixia/docker-openldap) that is available on GitHub, or you can set up a server in a virtual environment using instructions such as [How To Install and Configure a Basic LDAP Server on an Ubuntu 12.04 VPS](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-a-basic-ldap-server-on-an-ubuntu-12-04-vps).
3232

3333
1. On the host where the ldap-auth daemon is to run, install the following additional software. We recommend using the versions that are distributed with the operating system, instead of downloading the software from an open source repository.
3434

@@ -38,15 +38,15 @@ To install and configure the reference implementation, perform the following ste
3838
1. Copy the following files from your repository clone to the indicated hosts:
3939
- **nginx-ldap-auth.conf** – NGINX Plus configuration file, which contains the minimal set of directives for testing the reference implementation. Install on the NGINX Plus host (in the **/etc/nginx/conf.d** directory if using the conventional configuration scheme). To avoid configuration conflicts, remember to move or rename any default configuration files installed with NGINX Plus.
4040
- **nginx-ldap-auth-daemon.py** – Python code for the ldap-auth daemon. Install on the host of your choice.
41-
41+
4242
Alternatively, use provided Dockerfile to build Docker image:
43-
4443
```
4544
docker build -t nginx-ldap-auth-daemon .
4645
docker run nginx-ldap-auth-daemon
47-
```
48-
46+
```
47+
4948
- **nginx-ldap-auth-daemon-ctl.sh** – Sample shell script for starting and stopping the daemon. Install on the same host as the ldap-auth daemon.
49+
5050
- **backend-sample-app.py** – Python code for the daemon that during testing stands in for a real back-end application server. Install on the host of your choice.
5151
5252
1. Modify the NGINX Plus configuration file as described in [Required Modifications to the NGINX Plus Configuration File](#required-mods) below. For information about customizing your deployment, see [Customization](#customization) below. We recommend running the `nginx -t` command after making your changes to verify that the file is syntactically valid.
@@ -55,21 +55,25 @@ To install and configure the reference implementation, perform the following ste
5555
<pre>root# <strong>nginx -s reload</strong></pre>
5656
5757
1. Run the following commands to start the ldap-auth daemon and the back-end daemon.
58-
<pre>root# <strong>nginx-ldap-auth-daemon-ctl.sh start</strong>
59-
root# <strong>python backend-sample-app.py</strong></pre>
58+
<pre>
59+
root# <strong>nginx-ldap-auth-daemon-ctl.sh start</strong>
60+
root# <strong>python backend-sample-app.py</strong>
61+
</pre>
6062
6163
1. To test the reference implementation, use a web browser to access **http://*nginx-server-address*:8081**. Verify that the browser presents a login form. After you fill out the form and submit it, verify that the server returns the expected response to valid credentials. The sample back-end daemon returns this:
62-
<pre>Hello, world! Requested URL: <em>URL</em></pre>
64+
<pre>
65+
Hello, world! Requested URL: <em>URL</em>
66+
</pre>
6367
64-
<a name="required-mods">
68+
<a name="required-mods"></a>
6569
### Required Modifications to the NGINX Plus Configuration File
66-
</a>
6770
6871
Modify the **nginx-ldap-auth.conf** file, by changing values as appropriate for your deployment for the terms shown in bold font in the following configuration.
6972
7073
For detailed instructions, see [Configuring the Reference Implementation](https://nginx.com/blog/nginx-plus-authenticate-users#ldap-auth-configure) in the [NGINX Plus and NGINX Can Authenticate Application Users](https://nginx.com/blog/nginx-plus-authenticate-users) blog post. The **nginx-ldap-auth.conf** file includes detailed instructions (in comments not shown here) for setting the `proxy-set-header` directives; for information about other directives, see the [NGINX reference documentation](http://nginx.org/en/docs/).
7174
72-
<pre>http {
75+
<pre>
76+
http {
7377
...
7478
proxy_cache_path <strong>cache/</strong> keys_zone=<strong>auth_cache</strong>:<strong>10m</strong>;
7579
@@ -101,10 +105,10 @@ For detailed instructions, see [Configuring the Reference Implementation](https:
101105
proxy_set_header X-Ldap-BindPass "<strong>secret</strong>";
102106
}
103107
}
104-
}</pre>
108+
}
109+
</pre>
105110
106111
If the authentication server runs Active Directory rather than OpenLDAP, uncomment the following directive as shown:
107-
108112
```
109113
proxy_set_header X-Ldap-Template "(sAMAccountName=%(username)s)";
110114
```
@@ -113,22 +117,25 @@ In addition, the **X-Ldap-Template** header can be used to create complex LDAP s
113117
114118
Suppose, your web resource should only be available for users from `group1` group.
115119
In such a case you can define `X-Ldap-Template` template as follows:
116-
120+
```
117121
proxy_set_header X-Ldap-Template "(&(cn=%(username)s)(memberOf=cn=group1,cn=Users,dc=example,dc=com))";
122+
```
118123
119124
The search filters can be combined from less complex filters using boolean operations and can be rather complex.
120125
121126
The reference implementation uses cookie-based authentication. If you are using HTTP basic authentication instead, comment out the following directives as shown:
122127
123-
<pre><strong>#</strong>proxy_set_header X-CookieName "nginxauth";
124-
<strong>#</strong>proxy_set_header Cookie nginxauth=$cookie_nginxauth;</pre>
128+
<pre>
129+
<strong>#</strong>proxy_set_header X-CookieName "nginxauth";
130+
<strong>#</strong>proxy_set_header Cookie nginxauth=$cookie_nginxauth;
131+
</pre>
125132
126133
## Customization
127134
### Caching
128135
129136
The **nginx-ldap-auth.conf** file enables caching of both data and credentials. To disable caching, comment out the four `proxy_cache*` directives as shown:
130-
131-
<pre>http {
137+
<pre>
138+
http {
132139
...
133140
<strong>#</strong>proxy_cache_path cache/ keys_zone=auth_cache:10m;
134141
...
@@ -141,17 +148,20 @@ The **nginx-ldap-auth.conf** file enables caching of both data and credentials.
141148
<strong>#</strong>proxy_cache_valid 200 10m;
142149
}
143150
}
144-
}</pre>
151+
}
152+
</pre>
145153
146154
### Optional LDAP Parameters
147155
148156
If you want to change the value for the `template` parameter that the ldap-auth daemon passes to the OpenLDAP server by default, uncomment the following directive as shown, and change the value:
149-
150-
<pre>proxy_set_header X-Ldap-Template "<strong>(cn=%(username)s)</strong>";</pre>
157+
<pre>
158+
proxy_set_header X-Ldap-Template "<strong>(cn=%(username)s)</strong>";
159+
</pre>
151160
152161
If you want to change the realm name from the default value (**Restricted**), uncomment and change the following directive:
153-
154-
<pre>proxy_set_header X-Ldap-Realm "<strong>Restricted</strong>";</pre>
162+
<pre>
163+
proxy_set_header X-Ldap-Realm "<strong>Restricted</strong>";
164+
</pre>
155165
156166
### Authentication Server
157167
@@ -160,7 +170,6 @@ To modify the ldap-auth daemon to communicate with a different (non-LDAP) type o
160170
## Compatibility
161171
162172
The auth daemon was tested against default configurations of the following LDAP servers:
163-
164173
* [OpenLDAP](http://www.openldap.org/)</li>
165174
* Microsoft Windows Server Active Directory 2003</li>
166175
* Microsoft Windows Server Active Directory 2012</li>

0 commit comments

Comments
 (0)