#!/usr/bin/env python3import syswhile True: line = sys.stdin.readline().strip() if not line: break parts = line.split() header_value = parts[2] target_value = "target-value" # Check if the target header value is present if header_value == target_value: sys.stdout.write("OK\n") else: sys.stdout.write("ERR\n") sys.stdout.flush()
<hr><div id="footer"><p>Generated Mon, 24 Jun 2024 04:12:05 GMT by sven-u (squid/5.7)</p><!-- ERR_ACCESS_DENIED --></div></body></html>
2024-06-23 23:56:06,750 Client IP: 172.17.2.200, Method: CONNECT, URL: -, Header: -2024-06-23 23:56:06,750 Header did not match: -
# External ACL for intermediate certificate fetchingacl intermediate_fetching transaction_initiator certificate-fetchinghttp_access allow intermediate_fetching# SSL certificate generator programsslcrtd_program /usr/lib/squid/security_file_certgen -s /var/lib/squid/ssl_db -M 20MB# Handle SSL certificate errorssslproxy_cert_error allow all# Define SSL bumping stepsacl step1 at_step SslBump1acl step2 at_step SslBump2acl step3 at_step SslBump3# Bumping stepsssl_bump peek step1ssl_bump bump step2ssl_bump bump step3# Define SSL portsacl SSL_ports port 443# SSL bump configurationhttp_port 3128 tcpkeepalive=60,30,3 ssl-bump generate-host-certificates=on dynamic_cert_mem_cache_size=20MB tls-cert=/etc/squid/bump.crt tls-key=/etc/squid/bump.key cipher=HIGH:MEDIUM:!LOW:!RC4:!SEED:!IDEA:!3DES:!MD5:!EXP:!PSK:!DSS options=NO_TLSv1,NO_SSLv3,SINGLE_DH_USE,SINGLE_ECDH_USE tls-dh=prime256v1:/etc/squid/bump_dhparam.pem# Custom log format to include X-My-Headerlogformat custom_log %{%Y-%m-%d %H:%M:%S}tl %>a:%>p %Ss/%03>Hs "%rm %ru HTTP/%rv" %>Hs %<st %tr "%{User-Agent}>h" "%{Referer}>h" "%{X-My-Header}>h"access_log /var/log/squid/access.log custom_log# External ACL configuration for header checksexternal_acl_type check_headers_helper %SRC %METHOD %<h{X-My-Header} /etc/squid/COOKIE_AUTH/token_auth.pyacl check_headers external check_headers_helper# Allow access only if headers contain the specific valuehttp_access allow check_headers# Deny all other accesshttp_access deny all# Handle SSL certificate errorsacl BadSite ssl_error SQUID_X509_V_ERR_DOMAIN_MISMATCHsslproxy_cert_error allow BadSitesslproxy_cert_error deny all# Squid normally listens to port 3128http_port 3128 intercept# PID file configurationpid_filename none# Header and logging configurationvia offreply_header_access X-Cache deny allreply_header_access X-Cache-Lookup deny allfollow_x_forwarded_for allow localhostfollow_x_forwarded_for deny allrequest_header_access X-Forwarded-For deny all# Disk cache directorycache_dir ufs /var/spool/squid 100 16 256# Leave coredumps in the first cache dircoredump_dir /var/spool/squid# Add any of your own refresh_pattern entries above theserefresh_pattern ^ftp: 1440 20% 10080refresh_pattern -i (/cgi-bin/|\?) 0 0% 0refresh_pattern . 0 20% 4320