• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

build/H22-Apr-2020-266248

docs/H22-Apr-2020-75

src/H22-Apr-2020-1,209838

t/H22-Apr-2020-165103

tests/H22-Apr-2020-8,0547,488

.gitignoreH A D22-Apr-202060 87

.travis.ymlH A D22-Apr-20201.4 KiB6556

AUTHORSH A D22-Apr-2020155 43

CHANGESH A D22-Apr-2020591 2115

LICENSEH A D22-Apr-202011.1 KiB202169

Makefile.amH A D22-Apr-2020863 5038

README.mdH A D22-Apr-20208.9 KiB195124

autogen.shH A D22-Apr-2020276 124

configure.acH A D22-Apr-20203 KiB9176

release.shH A D22-Apr-2020403 2112

README.md

1
2<img src="https://github.com/SpiderLabs/ModSecurity/raw/v3/master/others/modsec.png" width="50%">
3
4[![Build Status](https://travis-ci.org/SpiderLabs/ModSecurity-apache.svg?branch=master)](https://travis-ci.org/SpiderLabs/ModSecurity-apache)
5[![](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.com)
6
7
8The ModSecurity-apache connector is the connection point between Apache and libmodsecurity (ModSecurity v3). Said another way, this project provides a communication channel between Apache and libmodsecurity. This connector is required to use LibModSecurity with Apache.
9
10The ModSecurity-apache connector takes the form of an Apache module. The module simply serves as a layer of communication between Apache and ModSecurity.
11
12Notice that this project depends on libmodsecurity rather than ModSecurity (version 2.9 or less).
13
14
15### What is the difference between this project and the old ModSecurity module for Apache?
16
17The old version of ModSecurity was origionally designed for and contained within an Apache module. This current version abstracts out some of the details allowing ModSecurity to more easily support multiple platforms and features outside beyond the scope of what Apache internals currently support. As a result using the new libmodsecurity engine is no longer reliant on the use of Apache and can be used to power multiple different connectors. As a result of this the current version is more flexible, has wider support, and allows for the support of new functionality that was not previously possible.
18
19
20# Compilation
21
22Before compile this software make sure that you have libmodsecurity installed.
23You can download it from the ModSecurity git repository. For information pertaining to the compilation and installation of libmodsecurity please consult the documentation provided along with it.
24
25With libmodsecurity installed, you can proceed with the installation of the ModSecurity-apache connector. Run the following commands:
26
27```
28$ ./autogen.sh
29$ ./configure
30$ make
31$ sudo make install
32```
33
34# Usage
35
36libModSecurity for Apache extends your configuration directives. In order to load the module into Apache add the following directive to your Apache configuration:
37
38```
39LoadModule security3_module modules/mod_security3.so
40```
41
42The module adds new directives to Apache and some them are documented below:
43
44modsecurity
45-----------
46**syntax:** *modsecurity on | off*
47
48**context:** *http, server, location*
49
50**default:** *off*
51
52Turns on or off ModSecurity functionality.
53Note that this configuration directive is no longer related to the SecRule state.
54Instead, it now serves solely as an Apache flag to enable or disable the module.
55
56modsecurity_rules_file
57----------------------
58**syntax:** *modsecurity_rules_file &lt;path to rules file&gt;*
59
60**context:** *http, server, location*
61
62**default:** *no*
63
64Specifies the location of the ModSecurity configuration file, e.g.:
65
66```
67modsecurity on
68modsecurity_rules_file /etc/my_modsecurity_rules.conf;
69```
70
71modsecurity_rules_remote
72------------------------
73**syntax:** *modsecurity_rules_remote &lt;key&gt; &lt;URL to rules&gt;*
74
75**context:** *http, server, location*
76
77**default:** *no*
78
79Specifies from where (on the internet) a modsecurity configuration file will be downloaded.
80It also specifies the key that will be used to authenticate to that server:
81
82```
83modsecurity on
84modsecurity_rules_remote my-server-key https://my-own-server/rules/download;
85```
86
87modsecurity_rules
88-----------------
89**syntax:** *modsecurity_rules &lt;modsecurity rule&gt;*
90
91**context:** *http, server, location*
92
93**default:** *no*
94
95Allows for the direct inclusion of a ModSecurity rule into the Apache configuration.
96The following example is loading rules from a file and injecting specific configurations per directory/alias:
97
98```
99TODO
100```
101
102modsecurity_transaction_id
103--------------------------
104**syntax:** *modsecurity_transaction_id string*
105
106**context:** *http, server, location*
107
108**default:** *no*
109
110Allows to pass transaction ID from Apache instead of generating it in the library.
111This can be useful for tracing purposes, e.g. consider this configuration:
112
113```
114TODO
115```
116
117# Contributing
118
119As an open source project we invite (and encourage) anyone from the community to contribute to our project. This may take the form of: new
120functionality, bug fixes, bug reports, beginners user support, and anything else that you
121are willing to help with. Thank you.
122
123## Providing Patches
124
125We prefer to have your patch within the GtiHub infrastructure to facilitate our
126review work, and our QA integration. GitHub provides an excellent
127documentation on how to perform “Pull Requests”. More information available
128here: https://help.github.com/articles/using-pull-requests/
129
130Please respect the coding style. Pull requests can include various commits, so provide one fix or one piece of functionality per commit. Please do not change anything outside the scope of your target work (e.g. coding style in a function that you have passed by). For further information about the coding style used in this project, please check: https://www.chromium.org/blink/coding-style
131
132Please respect the coding style in use. Pull requests can include various commits, so
133provide one fix or one functionality per commit. Do not change anything outside
134the scope of your target work (e.g. coding style in a function that you have
135passed by).
136
137### Don’t know where to start?
138
139Within our code there are various items marked as TODO or FIXME that may need
140your attention. Check the list of items by performing a grep:
141
142```
143$ cd /path/to/modsecurity-apache
144$ egrep -Rin "TODO|FIXME" -R *
145```
146
147You may also take a look at recent bug reports and open issues to get an idea of what kind of help we are looking for.
148
149### Testing your patch
150
151Along with the manual testing, we strongly recommend that you to use the Apache test
152utility to make sure that you patch does not adversly affect the behavior or performance of Apache.
153
154The Apache testing tools are available on: http://httpd.apache.org/test/
155
156To use those tests ....
157 #TODO#
158
159If you are facing problems getting your added functionality to pass all the  Apache tests, feel free to contact us or the Apache mailing list at: http://httpd.apache.org/lists.html
160
161### Debugging
162Because the ModSecurity Apache Connector runs as part of Apache, one needs to debug the Apache process. Debugging may require several steps. In general debugging can be enabled by compiling the Apache connector with debugging as follows:
163```CFLAGS="-g -O0" ./configure ...normal configure parameters...)```
164
165It is recommended that one keeps the debugging process as simple as possible, to do so, the elimination of features such as multi-threading by the HTTP server is recommended. A special "--with-debug" option can also be used during the compilation of the Apache Connector that will enable the connector's debug messages.
166
167Apache webservers accept a special command line parameter: "-X", that starts the server in debug mode and doesn't detach it from the console. This flag should be passed straight to the apache2 or httpd binary, along with any other options, such as the configuration file that should be used. The parameter should not be passed to the apachectl script, instead, the http/apache2 file should be used directly. If you are using Ubuntu your Apache will probably be at: /usr/sbin/apache2. If you are using Fedora this will probably be at: /usr/sbin/httpd.
168
169This setup may affect the behavior of the HTTP server in a way that makes impossible or more difficult to reproduce a given bug, if this is the case, you may wish to ask for help in our mailing list and check out Apache's debugging instructions at: https://httpd.apache.org/dev/debugging.html.
170
171## Reporting Issues
172
173If you are facing a configuration issue or if something is not working as you
174expect it to be, please use ModSecurity user’s mailing list. Issues on GitHub
175are also welcome, but we prefer to have users question on the mailing list first,
176where you can reach an entire community. Also don’t forget to look for an
177existing issue before opening a new one.
178
179Lastly, If you are planning to open an issue on GitHub, please don’t forget to tell us the
180version of your libmodsecurity and the version of the Apache connector you are running.
181
182### Security issue
183
184Please do not publicly report any security issue. Instead, contact us at:
185security@modsecurity.org to report the issue. Once the problem is fixed we will provide you with credit for the discovery.
186
187## Feature Request
188
189We 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. Alternativly, 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 functionalityt.
190
191## Packing
192
193Having our packages in distros on time is something we highly desire. Let us know if
194there is anything we can do to facilitate your work as a packager.
195