summaryrefslogtreecommitdiff
path: root/doc/source/config.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/config.rst')
-rw-r--r--doc/source/config.rst39
1 files changed, 33 insertions, 6 deletions
diff --git a/doc/source/config.rst b/doc/source/config.rst
index 89e063f..91e085c 100644
--- a/doc/source/config.rst
+++ b/doc/source/config.rst
@@ -81,6 +81,24 @@ This configuration variable contains parameters that are used by multiple featur
81- ``cookie_env_var``: A environment variable used as part of cookies encryption. 81- ``cookie_env_var``: A environment variable used as part of cookies encryption.
82 See the :ref:`relevant documentation <config_cookie-encryption>` 82 See the :ref:`relevant documentation <config_cookie-encryption>`
83 83
84log_media
85^^^^^^^^^
86
87This configuration variable allows to specify how logs should be written,
88either via ``php`` or ``syslog``.
89
90::
91
92 sp.log_media("php");
93 sp.log_media("syslog");
94
95The default value for ``sp.log_media`` is ``php``, to respect the `principle of
96least astonishment
97<https://en.wikipedia.org/wiki/Principle_of_least_astonishment>`__. But since
98it's `possible to modify php's logging system via php
99<https://www.php.net/manual/en/errorfunc.configuration.php>`__, it's
100heavily recommended to use the ``syslog`` option instead.
101
84 102
85Bugclass-killer features 103Bugclass-killer features
86------------------------ 104------------------------
@@ -181,8 +199,8 @@ argument and various information about it in the environment:
181 199
182This feature can be used, for example, to check if an uploaded file contains php 200This feature can be used, for example, to check if an uploaded file contains php
183code, using `vld <https://derickrethans.nl/projects.html#vld>`_, 201code, using `vld <https://derickrethans.nl/projects.html#vld>`_,
184via `a python script <https://github.com/nbs-system/snuffleupagus/tree/master/scripts/upload_validation.py>`__, 202via `a python script <https://github.com/jvoisin/snuffleupagus/tree/master/scripts/upload_validation.py>`__,
185or `a php one <https://github.com/nbs-system/snuffleupagus/tree/master/scripts/upload_validation.php>`__. 203or `a php one <https://github.com/jvoisin/snuffleupagus/tree/master/scripts/upload_validation.php>`__.
186 204
187The upload will be **allowed** if the script returns the value ``0``. Every other 205The upload will be **allowed** if the script returns the value ``0``. Every other
188value will prevent the file from being uploaded. 206value will prevent the file from being uploaded.
@@ -236,8 +254,11 @@ blacklisted, it'll be allowed.
236Virtual-patching 254Virtual-patching
237---------------- 255----------------
238 256
239Snuffleupagus provides virtual-patching via the ``disable_function`` directive, allowing you to stop or control dangerous behaviours. 257Snuffleupagus provides virtual-patching via the ``disable_function`` directive,
240In the situation where you have a call to ``system()`` that lacks proper user-input validation, this could cause issues as it would lead to an **RCE**. The virtual-patching would allow this to be prevented. 258allowing you to stop or control dangerous behaviours. In the situation where
259you have a call to ``system()`` that lacks proper user-input validation, this
260could cause issues as it would lead to an **RCE**. The virtual-patching would
261allow this to be prevented.
241 262
242:: 263::
243 264
@@ -287,8 +308,14 @@ The ``type`` must be one of the following values:
287Actions 308Actions
288^^^^^^^ 309^^^^^^^
289 310
311Every rule *must* have one action.
312
290- ``allow()``: **allow** the request if the rule matches 313- ``allow()``: **allow** the request if the rule matches
291- ``drop()``: **drop** the request if the rule matches 314- ``drop()``: **drop** the request if the rule matches
315
316Modifications
317^^^^^^^^^^^^^
318
292- ``dump(directory)``: dump the request in the ``directory`` if it matches the rule 319- ``dump(directory)``: dump the request in the ``directory`` if it matches the rule
293- ``simulation()``: enabled the simulation mode 320- ``simulation()``: enabled the simulation mode
294 321
@@ -324,7 +351,7 @@ For clarity, the presence of the ``allow`` or ``drop`` action is **mandatory**.
324 because it'll match the deny first. 351 because it'll match the deny first.
325 352
326If you're paranoid, we're providing a `php script 353If you're paranoid, we're providing a `php script
327<https://github.com/nbs-system/snuffleupagus/blob/master/scripts/generate_rules.php>`__ 354<https://github.com/jvoisin/snuffleupagus/blob/master/scripts/generate_rules.php>`__
328to automatically generate hash of files containing dangerous functions, and 355to automatically generate hash of files containing dangerous functions, and
329blacklisting them everywhere else. 356blacklisting them everywhere else.
330 357
@@ -340,7 +367,7 @@ It's currently not possible to:
340 things like this, odds are that you're doing something wrong anyway. 367 things like this, odds are that you're doing something wrong anyway.
341- Hooks on ``echo`` and on ``print`` are equivalent: there is no way to hook one 368- Hooks on ``echo`` and on ``print`` are equivalent: there is no way to hook one
342 without hooking the other, at least 369 without hooking the other, at least
343 `for now <https://github.com/nbs-system/snuffleupagus/issues/190>`__). 370 `for now <https://github.com/jvoisin/snuffleupagus/issues/190>`__).
344 This is why hooked ``print`` will be displayed as ``echo`` in the logs. 371 This is why hooked ``print`` will be displayed as ``echo`` in the logs.
345- Hook `strlen`, since in latest PHP versions, this function is usually 372- Hook `strlen`, since in latest PHP versions, this function is usually
346 optimized away by the compiled. 373 optimized away by the compiled.