New Zope Dos Protection now available in cookiecutter-zope-instance

With Zope 5.8.4 and later, DOS protection is available.
cookiecutter-zope-instance now supports this settings for zope.conf new section <dos_protection>.
See also GitHub - plone/cookiecutter-zope-instance: It bakes configuration for Zope 5 (scroll down in this section).

5 Likes

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

Default: true

It is better to have it always enabled. For older, it does not change anything. For recent Zope versions, it is already set to a reasonable value (thinking to upgrades).

Probably it want start up with this section in.

[edit:]
and the default are very conservative set, if the section s missing

1 Like

I have an instance that originally started with:
cookiecutter gh:collective/cookiecutter-plone-starter
was created with Plone 6.0.6
Now when I try to do a make install-backend I get an error that is probably related to dos_protection.
What can I do to fix this error?

'
+ make create-site
make[1]: Entering directory '/home/system/plone6/ecmr2021'
+ dirname /home/system/plone6/ecmr2021/Makefile
+ make -C ./backend/ create-site
make[2]: Entering directory '/home/system/plone6/ecmr2021/backend'
+ which python3
+ python3 -c 'import sys; print((int(sys.version_info[0]), int(sys.version_info[1])) >= tuple(map(int, '\''3.8'\''.split('\''.'\''))))'
+ PYTHONWARNINGS=ignore
+ ./bin/zconsole run instance/etc/zope.conf ./scripts/create_site.py
Traceback (most recent call last):
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/info.py", line 332, in gettype
    return self._types[n]
KeyError: 'dos_protection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/cfgparser.py", line 102, in start_section
    newsect = self.context.startSection(section, type_, name)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/loader.py", line 407, in startSection
    t = self.schema.gettype(type_)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/info.py", line 334, in gettype
    raise ZConfig.SchemaError("unknown type name: " + repr(name))
ZConfig.SchemaError: unknown type name: 'dos_protection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/system/plone6/ecmr2021/backend/./bin/zconsole", line 8, in <module>
    sys.exit(main())
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/Zope2/utilities/zconsole.py", line 50, in main
    runscript(namespace.zopeconf, *namespace.scriptargs)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/Zope2/utilities/zconsole.py", line 13, in runscript
    make_wsgi_app({}, zopeconf)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/Zope2/Startup/run.py", line 51, in make_wsgi_app
    opts = ZopeWSGIOptions(configfile=zope_conf)()
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/Zope2/Startup/options.py", line 84, in __call__
    self.load_configfile()
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/Zope2/Startup/options.py", line 79, in load_configfile
    self.configroot, self.confighandlers = loader.loadURL(
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/loader.py", line 153, in loadURL
    return self.loadResource(r)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/loader.py", line 397, in loadResource
    self._parse_resource(sm, resource)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/loader.py", line 442, in _parse_resource
    parser.parse(matcher)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/cfgparser.py", line 75, in parse
    section = self.start_section(section, line[1:-1])
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/cfgparser.py", line 104, in start_section
    self.error(e.message)
  File "/home/system/plone6/ecmr2021/backend/lib/python3.9/site-packages/ZConfig/cfgparser.py", line 194, in error
    raise ZConfig.ConfigurationSyntaxError(message, self.url, self.lineno)
ZConfig.ConfigurationSyntaxError: unknown type name: 'dos_protection'
(line 18 in file:///home/system/plone6/ecmr2021/backend/instance/etc/zope.conf)
make[2]: *** [Makefile:155: create-site] Error 1
make[2]: Leaving directory '/home/system/plone6/ecmr2021/backend'
make[1]: *** [Makefile:53: create-site] Error 2
make[1]: Leaving directory '/home/system/plone6/ecmr2021'
make: *** [Makefile:44: install-backend] Error 2

The constraints seem to still contain Zope 5.8.3:
https://dist.plone.org/release/6.0.6/constraints.txt

And pinning Zope==5.8.4 in the constraints.txt also gives an error

You've to edit backend/instance.yaml and add dos_protection_available: false, I think.

2 Likes

Thank you very much, that worked perfectly

2 Likes