<div dir="ltr"><div>Hey,<br clear="all"></div><div><br></div><div>I have been wondering to what websites we can disable tls inspection automatically.</div><div>There are sites like banks which has EV certificates.<br>It's pretty easy to just allow these sites to not be bumped by squid or any other DPI systems.<br>In the past I had an issue with couple appliances which implement DPI and TLS inspection.<br>All of them automatically inspect banks and many other sites without any way other then<br>manually adding specific domains or ip addresses to the exceptions list.</div><div>I have the next example script in python:<br>```<br>import ssl<br>import socket<br>from cryptography import x509<br><br>def analyze_site_security(hostname):<br>    # 1. Define the standard EV OID<br>    EV_OID = "2.23.140.1.1"<br>    <br>    context = ssl.create_default_context()<br>    try:<br>        with socket.create_connection((hostname, 443), timeout=5) as sock:<br>            with context.wrap_socket(sock, server_hostname=hostname) as ssock:<br>                # Get the binary certificate<br>                bin_cert = ssock.getpeercert(binary_form=True)<br>                cert = x509.load_der_x509_certificate(bin_cert)<br>                <br>                # Extract Organization and Policy OIDs<br>                subject = cert.subject<br>                org_name = next((attr.value for attr in subject if attr.oid.dotted_string == "2.5.4.10"), "N/A")<br>                <br>                # Check for EV OIDs in extensions<br>                is_ev = False<br>                try:<br>                    policies = cert.extensions.get_extension_for_oid(x509.oid.ExtensionOID.CERTIFICATE_POLICIES)<br>                    for policy in policies.value:<br>                        if policy.policy_identifier.dotted_string == EV_OID:<br>                            is_ev = True<br>                except:<br>                    pass<br><br>                return {<br>                    "site": hostname,<br>                    "is_ev_certified": is_ev,<br>                    "organization": org_name,<br>                    "tls_version": ssock.version(),<br>                    "likely_pci_entity": is_ev and (ssock.version() in ['TLSv1.2', 'TLSv1.3'])<br>                }<br>    except Exception as e:<br>        return {"error": str(e)}<br><br># Testing it out<br>print(analyze_site_security("<a href="http://www.paypal.com">www.paypal.com</a>"))<br>print(analyze_site_security("<a href="http://www.google.com">www.google.com</a>"))<br>```<br><br>It can be converted and modify a bit to be an external_acl helper or external service that will get couple details on the connection like ip address+port+domain and will just trigger a tls inspection bypass for the relevant sites automatically.<br><br>I hope it helps anyone.<br><br>Eliezer</div><div><div dir="rtl" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="rtl" style="color:rgb(34,34,34)">----</div><div dir="rtl" style="color:rgb(34,34,34)">אליעזר קרויטורו</div><div dir="rtl" style="color:rgb(34,34,34)">תמיכה טכנית, משיב הרוח ומוריד הגשם</div><div dir="rtl" style="color:rgb(34,34,34)">נייד: 052-8704261</div><div dir="rtl" style="color:rgb(34,34,34)">מייל: <a href="mailto:ngtech1ltd@gmail.com" target="_blank">ngtech1ltd@gmail.com</a></div></div></div></div></div>