Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
54b8ee70
Commit
54b8ee70
authored
Feb 07, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zopewsgi: disable XML-RPC and provide an option to enable
parent
152bbdfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
product/ERP5/bin/zopewsgi.py
product/ERP5/bin/zopewsgi.py
+17
-0
No files found.
product/ERP5/bin/zopewsgi.py
View file @
54b8ee70
...
@@ -18,6 +18,10 @@ from waitress.server import create_server
...
@@ -18,6 +18,10 @@ from waitress.server import create_server
import
ZConfig
import
ZConfig
import
Zope2
import
Zope2
from
Zope2.Startup.run
import
make_wsgi_app
from
Zope2.Startup.run
import
make_wsgi_app
from
App.config
import
getConfiguration
from
zope.component
import
getGlobalSiteManager
import
zope.interface
import
ZPublisher.interfaces
try
:
try
:
from
ZPublisher.WSGIPublisher
import
_MODULES
from
ZPublisher.WSGIPublisher
import
_MODULES
...
@@ -86,6 +90,12 @@ class TransLogger(object):
...
@@ -86,6 +90,12 @@ class TransLogger(object):
self
.
logger
.
info
(
message
)
self
.
logger
.
info
(
message
)
@
zope
.
interface
.
implementer
(
ZPublisher
.
interfaces
.
IXmlrpcChecker
)
class
XMLRPCDisabler
:
def
__call__
(
self
,
request
):
return
False
def
app_wrapper
(
large_file_threshold
,
webdav_ports
):
def
app_wrapper
(
large_file_threshold
,
webdav_ports
):
try
:
try
:
from
Products.DeadlockDebugger.dumper
import
dump_threads
,
dump_url
from
Products.DeadlockDebugger.dumper
import
dump_threads
,
dump_url
...
@@ -186,6 +196,7 @@ def runwsgi():
...
@@ -186,6 +196,7 @@ def runwsgi():
'--with-max-rlimit-nofile'
,
'--with-max-rlimit-nofile'
,
help
=
'Set soft limit of file descriptors erp5 can open to hard limit'
,
help
=
'Set soft limit of file descriptors erp5 can open to hard limit'
,
action
=
"store_true"
)
action
=
"store_true"
)
parser
.
add_argument
(
'--enable-xml-rpc'
,
help
=
'Enable XML-RPC interface'
,
action
=
'store_true'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
not
sys
.
warnoptions
:
if
not
sys
.
warnoptions
:
...
@@ -239,6 +250,12 @@ def runwsgi():
...
@@ -239,6 +250,12 @@ def runwsgi():
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'zopeschema.xml'
))
schema
=
ZConfig
.
loadSchema
(
os
.
path
.
join
(
startup
,
'zopeschema.xml'
))
conf
,
_
=
ZConfig
.
loadConfig
(
schema
,
args
.
zope_conf
)
conf
,
_
=
ZConfig
.
loadConfig
(
schema
,
args
.
zope_conf
)
if
not
args
.
enable_xml_rpc
:
getGlobalSiteManager
().
registerUtility
(
XMLRPCDisabler
(),
ZPublisher
.
interfaces
.
IXmlrpcChecker
,
)
if
conf
.
debug_mode
:
if
conf
.
debug_mode
:
console_handler
=
logging
.
StreamHandler
(
sys
.
stderr
)
console_handler
=
logging
.
StreamHandler
(
sys
.
stderr
)
console_handler
.
setFormatter
(
logging
.
Formatter
(
console_handler
.
setFormatter
(
logging
.
Formatter
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment