Commit 54b8ee70 authored by Jérome Perrin's avatar Jérome Perrin

zopewsgi: disable XML-RPC and provide an option to enable

parent 152bbdfb
......@@ -18,6 +18,10 @@ from waitress.server import create_server
import ZConfig
import Zope2
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:
from ZPublisher.WSGIPublisher import _MODULES
......@@ -86,6 +90,12 @@ class TransLogger(object):
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):
try:
from Products.DeadlockDebugger.dumper import dump_threads, dump_url
......@@ -186,6 +196,7 @@ def runwsgi():
'--with-max-rlimit-nofile',
help='Set soft limit of file descriptors erp5 can open to hard limit',
action="store_true")
parser.add_argument('--enable-xml-rpc', help='Enable XML-RPC interface', action='store_true')
args = parser.parse_args()
if not sys.warnoptions:
......@@ -239,6 +250,12 @@ def runwsgi():
schema = ZConfig.loadSchema(os.path.join(startup, 'zopeschema.xml'))
conf, _ = ZConfig.loadConfig(schema, args.zope_conf)
if not args.enable_xml_rpc:
getGlobalSiteManager().registerUtility(
XMLRPCDisabler(),
ZPublisher.interfaces.IXmlrpcChecker,
)
if conf.debug_mode:
console_handler = logging.StreamHandler(sys.stderr)
console_handler.setFormatter(logging.Formatter(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment