diff options
Diffstat (limited to 'doc/source/config.rst')
| -rw-r--r-- | doc/source/config.rst | 39 |
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 | ||
| 84 | log_media | ||
| 85 | ^^^^^^^^^ | ||
| 86 | |||
| 87 | This configuration variable allows to specify how logs should be written, | ||
| 88 | either via ``php`` or ``syslog``. | ||
| 89 | |||
| 90 | :: | ||
| 91 | |||
| 92 | sp.log_media("php"); | ||
| 93 | sp.log_media("syslog"); | ||
| 94 | |||
| 95 | The default value for ``sp.log_media`` is ``php``, to respect the `principle of | ||
| 96 | least astonishment | ||
| 97 | <https://en.wikipedia.org/wiki/Principle_of_least_astonishment>`__. But since | ||
| 98 | it's `possible to modify php's logging system via php | ||
| 99 | <https://www.php.net/manual/en/errorfunc.configuration.php>`__, it's | ||
| 100 | heavily recommended to use the ``syslog`` option instead. | ||
| 101 | |||
| 84 | 102 | ||
| 85 | Bugclass-killer features | 103 | Bugclass-killer features |
| 86 | ------------------------ | 104 | ------------------------ |
| @@ -181,8 +199,8 @@ argument and various information about it in the environment: | |||
| 181 | 199 | ||
| 182 | This feature can be used, for example, to check if an uploaded file contains php | 200 | This feature can be used, for example, to check if an uploaded file contains php |
| 183 | code, using `vld <https://derickrethans.nl/projects.html#vld>`_, | 201 | code, using `vld <https://derickrethans.nl/projects.html#vld>`_, |
| 184 | via `a python script <https://github.com/nbs-system/snuffleupagus/tree/master/scripts/upload_validation.py>`__, | 202 | via `a python script <https://github.com/jvoisin/snuffleupagus/tree/master/scripts/upload_validation.py>`__, |
| 185 | or `a php one <https://github.com/nbs-system/snuffleupagus/tree/master/scripts/upload_validation.php>`__. | 203 | or `a php one <https://github.com/jvoisin/snuffleupagus/tree/master/scripts/upload_validation.php>`__. |
| 186 | 204 | ||
| 187 | The upload will be **allowed** if the script returns the value ``0``. Every other | 205 | The upload will be **allowed** if the script returns the value ``0``. Every other |
| 188 | value will prevent the file from being uploaded. | 206 | value will prevent the file from being uploaded. |
| @@ -236,8 +254,11 @@ blacklisted, it'll be allowed. | |||
| 236 | Virtual-patching | 254 | Virtual-patching |
| 237 | ---------------- | 255 | ---------------- |
| 238 | 256 | ||
| 239 | Snuffleupagus provides virtual-patching via the ``disable_function`` directive, allowing you to stop or control dangerous behaviours. | 257 | Snuffleupagus provides virtual-patching via the ``disable_function`` directive, |
| 240 | In 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. | 258 | allowing you to stop or control dangerous behaviours. In the situation where |
| 259 | you have a call to ``system()`` that lacks proper user-input validation, this | ||
| 260 | could cause issues as it would lead to an **RCE**. The virtual-patching would | ||
| 261 | allow this to be prevented. | ||
| 241 | 262 | ||
| 242 | :: | 263 | :: |
| 243 | 264 | ||
| @@ -287,8 +308,14 @@ The ``type`` must be one of the following values: | |||
| 287 | Actions | 308 | Actions |
| 288 | ^^^^^^^ | 309 | ^^^^^^^ |
| 289 | 310 | ||
| 311 | Every 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 | |||
| 316 | Modifications | ||
| 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 | ||
| 326 | If you're paranoid, we're providing a `php script | 353 | If 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>`__ |
| 328 | to automatically generate hash of files containing dangerous functions, and | 355 | to automatically generate hash of files containing dangerous functions, and |
| 329 | blacklisting them everywhere else. | 356 | blacklisting 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. |
