Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add settings for dos protection #12

Merged
merged 2 commits into from Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
@@ -1,6 +1,9 @@
Changelog
=========

- Add `dos_protection_*` settings for feature introduced in https://github.com/zopefoundation/Zope/pull/1142
[jensens, 2023-10-25]

- Fix loading of `overrides.zcml`` and `meta.zcml`.
[jensens, 2022-02-07]

Expand Down
21 changes: 21 additions & 0 deletions README.rst
Expand Up @@ -119,6 +119,27 @@ TODO: support https://docs.pylonsproject.org/projects/waitress/en/latest/argumen
"CHAMELEON_CACHE": "{{ cookiecutter.location_clienthome }}/cache"
}

``dos_protection_available``
In Zope 5.8.4 and later, DOS protection is available.
For older versions of Zope set this to ``false``.

Default: ``true``

``dos_protection_file_memory_limit``
The maximum size for each part in a multipart post request, for the complete body in an urlencoded post request and for the complete request body when accessed as bytes (rather than a file).

default: "1MB",

``dos_protection_file_disk_limit``
The maximum size of a POST request body.

default: "1GB",

``dos_protection_memfile_disk_limit``
The value of form variables of type file with larger size are stored on disk rather than in memory.

default: "4KB",

Initial user
------------

Expand Down
5 changes: 5 additions & 0 deletions cookiecutter.json
Expand Up @@ -27,6 +27,11 @@
"resources_directory_location": ""
},

"dos_protection_available": true,
"dos_protection_file_memory_limit": "1MB",
"dos_protection_file_disk_limit": "1GB",
"dos_protection_memfile_disk_limit": "4KB",

"db_storage": ["direct", "relstorage", "zeo"],
"db_cache_size": "30000",
"db_cache_size_bytes": "",
Expand Down
9 changes: 9 additions & 0 deletions {{ cookiecutter.target }}/etc/zope.conf
Expand Up @@ -19,6 +19,15 @@ default-zpublisher-encoding utf-8

</environment>
{%- endif %}

{%- if cookiecutter.dos_protection_available %}
<dos_protection>
form-memory-limit {{ cookiecutter.dos_protection_form_memory_limit }}
form-disk-limit {{ cookiecutter.dos_protection_form_disk_limit }}
form-memfile-limit {{ cookiecutter.dos_protection_form_memfile_limit }}
<dos_protection>
{%- endif %}

# Database
<zodb_db main>
mount-point /
Expand Down