From 8e6327d127de7bfbbc2863bc4f566d28eca2aae5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 12 Mar 2022 11:44:07 +0000 Subject: [PATCH] More mitm headers --- daemon.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/daemon.py b/daemon.py index 140a14c71..1ab471da6 100644 --- a/daemon.py +++ b/daemon.py @@ -437,6 +437,16 @@ class PubServer(BaseHTTPRequestHandler): if self.headers.get(header_name): if interloper in self.headers[header_name]: return True + # The presence if these headers on their own indicates a MiTM + mitm_headers = ( + 'CF-Connecting-IP', 'CF-RAY', 'CF-IPCountry', 'CF-Visitor', + 'CDN-Loop', 'CF-Worker' + ) + for header_name in mitm_headers: + if self.headers.get(header_name): + return True + if self.headers.get(header_name.lower()): + return True return False def _get_instance_url(self, calling_domain: str) -> str: