From ae99584a7bde2dc5594e392d9f3db258878cb2b4 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 9 Sep 2018 07:28:36 +0200 Subject: [PATCH] Modify OpenSSL's RNG after fork https://docs.python.org/3.7/library/ssl.html#multi-processing --- radicale/server.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/radicale/server.py b/radicale/server.py index 4c11c15..2ec3f94 100644 --- a/radicale/server.py +++ b/radicale/server.py @@ -121,6 +121,14 @@ class ParallelHTTPServer(ParallelizationMixIn, socket_.settimeout(self.client_timeout) return socket_, address + def process_request(self, request, client_address): + try: + return super().process_request(request, client_address) + finally: + # Modify OpenSSL's RNG state, in case process forked + # See https://docs.python.org/3.7/library/ssl.html#multi-processing + ssl.RAND_add(os.urandom(8), 0.0) + def finish_request_locked(self, request, client_address): return super().finish_request(request, client_address)