pymodsecurity requires Python 3.3 or greater and the following packages:
- cffi
- setuptools
- libmodsecurity (C library)
And optionally for the documentation:
- sphinx
- sphinx_rtd_theme
Note:
- make sure that
libmodsecurityversion is 3.0.0 or greater.- all
libmodsecurity.sofiles must be visible in standard library path, it can be done by using symlinks like so:
$ ln -s /current/path/to/libmodsecurity.so /standard/path/to/lib/libmodsecurity.sopymodsecurity uses setuptools, so you can install it using:
$ python3 setup.py build
$ python3 setup.py installlibmodsecurity is not yet stable, and you may want to install it locally
rather than on the system. Once libmodsecurity is installed (for instance
in /opt/libmodsecurity), you can use it by doing:
$ OPT=/opt/libmodsecurity
$ LIBRARY_PATH=$OPT/lib LD_LIBRARY_PATH=$OPT/lib C_INCLUDE_PATH=$OPT/include python setup.py installand later, invoke your python script using libmodsecurity with:
$ LD_LIBRARY_PATH=$OPT/lib python my_program.pyIf sphinx is installed, build the documentation:
$ cd ./doc
$ make htmlBrowse it from http://localhost:8000/ with:
$ cd doc/_build/html && python -m http.serverYou can run unit tests by doing:
$ python3 setup.py testIt will look for tests name based directories and perform all tests in them.