Skip to content

Commit 4cde86b

Browse files
authored
Merge pull request #102 from defanator/readme_update
A number of improvements in README
2 parents 6d5f759 + c7c0676 commit 4cde86b

File tree

1 file changed

+85
-55
lines changed

1 file changed

+85
-55
lines changed

Diff for: README.md

+85-55
Original file line numberDiff line numberDiff line change
@@ -5,103 +5,131 @@
55
[![](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.com)
66

77

8+
The ModSecurity-nginx connector is the connection point between nginx and libmodsecurity (ModSecurity v3). Said another way, this project provides a communication channel between nginx and libmodsecurity. This connector is required to use LibModSecurity with nginx.
89

9-
The ModSecurity-nginx connector is the connection point between Nginx and libmodsecurity (ModSecurity v3). Said another way, this project provides a communication channel between Nginx and libmodsecurity. This connector is required to use LibModSecurity with Nginx.
10-
11-
The ModSecurity-nginx connector takes the form of an Nginx module. The module simply serves as a layer of communication between Nginx and ModSecurity.
10+
The ModSecurity-nginx connector takes the form of an nginx module. The module simply serves as a layer of communication between nginx and ModSecurity.
1211

1312
Notice that this project depends on libmodsecurity rather than ModSecurity (version 2.9 or less).
14-
libmodsecurity has not reached a stable release candidate, thus, use this project with caution.
1513

1614
### What is the difference between this project and the old ModSecurity add-on for nginx?
1715

1816
The old version uses ModSecurity standalone, which is a wrapper for
1917
Apache internals to link ModSecurity to nginx. This current version is closer
2018
to nginx, consuming the new libmodsecurity which is no longer dependent on
21-
Apache. As a result, This current version has less dependencies, fewer bugs, and is faster. In addition, Some new functionality is also provided - such as the possibility of use of global rules configuration with per directory/location customizations (e.g. SecRuleRemoveById).
19+
Apache. As a result, this current version has less dependencies, fewer bugs, and is faster. In addition, some new functionality is also provided - such as the possibility of use of global rules configuration with per directory/location customizations (e.g. SecRuleRemoveById).
2220

2321

2422
# Compilation
2523

2624
Before compile this software make sure that you have libmodsecurity installed.
2725
You can download it from the [ModSecurity git repository](https://github.com/SpiderLabs/ModSecurity). For information pertaining to the compilation and installation of libmodsecurity please consult the documentation provided along with it.
2826

29-
With libmodsecurity installed, you can proceed with the installation of the ModSecurity-nginx connector, which follow the Nginx 3rd party module installation procedure:
27+
With libmodsecurity installed, you can proceed with the installation of the ModSecurity-nginx connector, which follow the nginx 3rd party module installation procedure:
3028

3129
```
32-
./configure --add-module=/path/your/modsecurity-for-nginx
30+
./configure --add-module=/path/to/ModSecurity-nginx
3331
```
3432

3533
Further information about nginx 3rd party add-ons support are available here:
3634
http://wiki.nginx.org/3rdPartyModules
3735

36+
3837
# Usage
3938

40-
ModSecurity for Nginx extends your Nginx configuration directives. It adds four
41-
new directives and they are:
39+
ModSecurity for nginx extends your nginx configuration directives.
40+
It adds four new directives and they are:
4241

43-
modsecurity [On|Off] - This directive turns on or off ModSecurity functionality. Note that
44-
this configuration directive is no longer related to the SecRule state. Instead, it now serves solely as an Nginx flag to enable or disable the module.
42+
modsecurity
43+
-----------
44+
**syntax:** *modsecurity on | off*
4545

46-
modsecurity_rules_file [<path to rules file>] - This directive indicates the location of the modsecurity configuration file.
46+
**context:** *http, server, location*
4747

48-
modsecurity_rules_remote [server-key] [<url to rules>] - This directive is used to indicate from where (on the internet) a modsecurity configuration file will be downloaded. It also specifies the key that will be used to authenticate to that server.
48+
**default:** *off*
4949

50-
modsecurity_rules [<modsecurity rule>] - This directive allows for the direct inclusion of a ModSecurity rule into the Nginx configuration.
50+
Turns on or off ModSecurity functionality.
51+
Note that this configuration directive is no longer related to the SecRule state.
52+
Instead, it now serves solely as an nginx flag to enable or disable the module.
5153

54+
modsecurity_rules_file
55+
----------------------
56+
**syntax:** *modsecurity_rules_file &lt;path to rules file&gt;*
5257

53-
### Usage example: injecting rules within nginx configuration
54-
```
55-
...
56-
modsecurity on;
57-
location / {
58-
modsecurity_rules '
59-
SecRuleEngine On
60-
SecDebugLog /tmp/modsec_debug.log
61-
SecDebugLogLevel 9
62-
SecRule ARGS "@contains test" "id:1,phase:2,t:trim,block"
63-
';
58+
**context:** *http, server, location*
59+
60+
**default:** *no*
61+
62+
Specifies the location of the modsecurity configuration file, e.g.:
63+
64+
```nginx
65+
server {
66+
modsecurity on;
67+
location / {
68+
root /var/www/html;
69+
modsecurity_rules_file /etc/my_modsecurity_rules.conf;
70+
}
6471
}
65-
...
6672
```
6773

68-
### Usage example: loading rules from a file and injecting specific configurations per directory/alias
69-
```
70-
...
71-
modsecurity on;
72-
location / {
73-
root /var/www/html;
74-
modsecurity_rules_file /etc/my_modsecurity_rules.conf;
75-
}
76-
location /ops {
77-
root /var/www/html/opts;
78-
modsecurity_rules '
79-
SecRuleEngine On
80-
SecDebugLog /tmp/modsec_debug.log
81-
SecDebugLogLevel 9
82-
SecRuleRemoveById 10
83-
';
74+
modsecurity_rules_remote
75+
------------------------
76+
**syntax:** *modsecurity_rules_remote &lt;key&gt; &lt;URL to rules&gt;*
77+
78+
**context:** *http, server, location*
79+
80+
**default:** *no*
81+
82+
Specifies from where (on the internet) a modsecurity configuration file will be downloaded.
83+
It also specifies the key that will be used to authenticate to that server:
84+
85+
```nginx
86+
server {
87+
modsecurity on;
88+
location / {
89+
root /var/www/html;
90+
modsecurity_rules_remote my-server-key https://my-own-server/rules/download;
91+
}
8492
}
85-
...
8693
```
8794

88-
### Usage example: loading rules from a remote server
89-
```
90-
...
91-
modsecurity on;
92-
location / {
93-
root /var/www/html;
94-
modsecurity_rules_remote my-server-key https://my-own-server/rules/download;
95+
modsecurity_rules
96+
-----------------
97+
**syntax:** *modsecurity_rules &lt;modsecurity rule&gt;*
98+
99+
**context:** *http, server, location*
100+
101+
**default:** *no*
102+
103+
Allows for the direct inclusion of a ModSecurity rule into the nginx configuration.
104+
The following example is loading rules from a file and injecting specific configurations per directory/alias:
105+
106+
```nginx
107+
server {
108+
modsecurity on;
109+
location / {
110+
root /var/www/html;
111+
modsecurity_rules_file /etc/my_modsecurity_rules.conf;
112+
}
113+
location /ops {
114+
root /var/www/html/opts;
115+
modsecurity_rules '
116+
SecRuleEngine On
117+
SecDebugLog /tmp/modsec_debug.log
118+
SecDebugLogLevel 9
119+
SecRuleRemoveById 10
120+
';
121+
}
95122
}
96-
...
97123
```
98124

125+
99126
# Contributing
100127

101128
As an open source project we invite (and encourage) anyone from the community to contribute to our project. This may take the form of: new
102129
functionality, bug fixes, bug reports, beginners user support, and anything else that you
103130
are willing to help with. Thank you.
104131

132+
105133
## Providing Patches
106134

107135
We prefer to have your patch within the GitHub infrastructure to facilitate our
@@ -129,7 +157,7 @@ You may also take a look at recent bug reports and open issues to get an idea of
129157
### Testing your patch
130158

131159
Along with the manual testing, we strongly recommend that you to use the nginx test
132-
utility to make sure that you patch does not adversely affect the behavior or performance of Nginx.
160+
utility to make sure that you patch does not adversely affect the behavior or performance of nginx.
133161

134162
The nginx tests are available on: http://hg.nginx.org/nginx-tests/
135163

@@ -142,14 +170,14 @@ $ cd /path/to/nginx/test/repository
142170
$ TEST_NGINX_BINARY=/path/to/your/nginx prove .
143171
```
144172

145-
If you are facing problems getting your added functionality to pass all the Nginx tests, feel free to contact us or the nginx mailing list at: http://nginx.org/en/support.html
173+
If you are facing problems getting your added functionality to pass all the nginx tests, feel free to contact us or the nginx mailing list at: http://nginx.org/en/support.html
146174

147175
### Debugging
148176

149177
We respect the nginx debugging schema. By using the configuration option
150-
--with-debugduring the nginx configuration you will also be enabling the
178+
"--with-debug" during the nginx configuration you will also be enabling the
151179
connector's debug messages. Core dumps and crashes are expected to be debugged
152-
in the same fashion that is used to debug Nginx. For further information,
180+
in the same fashion that is used to debug nginx. For further information,
153181
please check the nginx debugging information: http://wiki.nginx.org/Debugging
154182

155183

@@ -169,11 +197,13 @@ version of your libmodsecurity and the version of the nginx connector you are ru
169197
Please do not publicly report any security issue. Instead, contact us at:
170198
[email protected] to report the issue. Once the problem is fixed we will provide you with credit for the discovery.
171199

200+
172201
## Feature Request
173202

174203
We would love to discuss any ideas that you may have for a new feature. Please keep in mind this is a community driven project so be sure to contact the community via the mailing list to get feedback first. Alternatively,
175204
feel free to open GitHub issues requesting for new features. Before opening a new issue, please check if there is an existing feature request for the desired functionality.
176205

206+
177207
## Packing
178208

179209
Having our packages in distros on time is something we highly desire. Let us know if

0 commit comments

Comments
 (0)