ModSecurity for Java - Help Page |
ModSecurity is an open source intrusion detection and prevention engine for web applications. It can also be called an web application firewall. It operates embedded into the web server, acting as a powerful umbrella, shielding applications from attacks. ModSecurity for Java is designed as a Java Filter which makes use of ModSecurity's native code using the JNI technology. InstallationFirst you need to choose whether to download and compile ModSecurity from the project's version control web-site: github.com/SpiderLabs/ModSecurity or using pre-compiled binaries from modsecurity.org. The native libraries (.so, .dll, etc.) needed for ModSecurity for Java are:
These native libraries are used by the ModSecurityFilter. Compile ModSecurity native libraryInstall required packages for compilation. For example, on Debian/Ubuntu like systems: sudo apt-get install g++ make automake autoconf libtool Install required dependent packages: sudo apt-get install libxml2 libxml2-dev libxml2-utils libaprutil1 libaprutil1-dev apache2-prefork-dev Download mod_security source code from GitHub, compile and install: cd mod_security/ ./autogen.sh ./configure --enable-standalone-module --enable-java-module make Copy compiled library in a convenient folder: sudo cp ./java/.libs/libModSecurityJNI.so /usr/lib/ Java Web Applications with ModSecurity FilterModSecurity for Java uses Java Filters in order to intercept Http requests and responses. ModsecurityTestApp is an example of Java EE Web application using the ModSecurity Filter. To use ModSecurity Filter in your Web application, copy the source files from mod_security/java/ModSecurityTestApp/src/ in your application and add the following entry for the filter tag in your web.xml file:
The ModSecurity Filter makes use of the native libraries written in C/C++ using the JNI technology. There are two ways of loading native libraries by Java Web Applications:
|