| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- from typing import TypedDict
- class ACLTypeInfo(TypedDict):
- category: str
- slow: bool
- desc: str
- ACL_TYPES_INFO: dict[str, ACLTypeInfo] = {
- # Network ACLs
- "src": {
- "category": "network",
- "slow": False,
- "desc": "Source IP address",
- },
- "dst": {
- "category": "network",
- "slow": True,
- "desc": "Destination IP address",
- },
- "localip": {
- "category": "network",
- "slow": False,
- "desc": "Local IP client connected to",
- },
- "arp": {
- "category": "network",
- "slow": False,
- "desc": "MAC address (EUI-48)",
- },
- "eui64": {
- "category": "network",
- "slow": False,
- "desc": "EUI-64 address",
- },
- "client_connection_mark": {
- "category": "network",
- "slow": False,
- "desc": "CONNMARK of connection",
- },
- # Domain ACLs
- "srcdomain": {
- "category": "domain",
- "slow": True,
- "desc": "Reverse DNS lookup of client IP",
- },
- "dstdomain": {
- "category": "domain",
- "slow": False,
- "desc": "Destination domain from URL",
- },
- "srcdom_regex": {
- "category": "domain",
- "slow": True,
- "desc": "Regex match on client name",
- },
- "dstdom_regex": {
- "category": "domain",
- "slow": False,
- "desc": "Regex match on server domain",
- },
- # AS Number ACLs
- "src_as": {
- "category": "network",
- "slow": False,
- "desc": "Source Autonomous System number",
- },
- "dst_as": {
- "category": "network",
- "slow": False,
- "desc": "Destination AS number",
- },
- # Time ACLs
- "time": {
- "category": "time",
- "slow": False,
- "desc": "Time of day and day of week",
- },
- # URL ACLs
- "url_regex": {
- "category": "url",
- "slow": False,
- "desc": "Regex match on full URL",
- },
- "urllogin": {
- "category": "url",
- "slow": False,
- "desc": "Regex match on URL login field",
- },
- "urlpath_regex": {
- "category": "url",
- "slow": False,
- "desc": "Regex match on URL path",
- },
- # Port ACLs
- "port": {
- "category": "port",
- "slow": False,
- "desc": "Destination TCP port",
- },
- "localport": {
- "category": "port",
- "slow": False,
- "desc": "TCP port client connected to",
- },
- "myportname": {
- "category": "port",
- "slow": False,
- "desc": "Port name from *_port directive",
- },
- # Protocol & Method ACLs
- "proto": {
- "category": "protocol",
- "slow": False,
- "desc": "Request protocol (HTTP, FTP, etc)",
- },
- "method": {
- "category": "protocol",
- "slow": False,
- "desc": "HTTP request method",
- },
- "http_status": {
- "category": "protocol",
- "slow": False,
- "desc": "HTTP status code in reply",
- },
- # Header ACLs
- "browser": {
- "category": "content",
- "slow": False,
- "desc": "User-Agent header pattern",
- },
- "referer_regex": {
- "category": "content",
- "slow": False,
- "desc": "Referer header pattern",
- },
- "req_header": {
- "category": "content",
- "slow": False,
- "desc": "Request header pattern",
- },
- "rep_header": {
- "category": "content",
- "slow": False,
- "desc": "Reply header pattern",
- },
- # Authentication ACLs
- "proxy_auth": {
- "category": "auth",
- "slow": True,
- "desc": "Proxy authentication username",
- },
- "proxy_auth_regex": {
- "category": "auth",
- "slow": True,
- "desc": "Proxy auth username regex",
- },
- "ext_user": {
- "category": "auth",
- "slow": True,
- "desc": "External ACL helper username",
- },
- "ext_user_regex": {
- "category": "auth",
- "slow": True,
- "desc": "External ACL helper username regex",
- },
- # MIME Type ACLs
- "req_mime_type": {
- "category": "content",
- "slow": False,
- "desc": "Request MIME type",
- },
- "rep_mime_type": {
- "category": "content",
- "slow": False,
- "desc": "Reply MIME type",
- },
- # Connection ACLs
- "maxconn": {
- "category": "connection",
- "slow": False,
- "desc": "Max TCP connections from IP",
- },
- "max_user_ip": {
- "category": "connection",
- "slow": False,
- "desc": "Max IPs per user",
- },
- # SSL/TLS ACLs
- "ssl_error": {
- "category": "ssl",
- "slow": False,
- "desc": "SSL certificate validation error",
- },
- "server_cert_fingerprint": {
- "category": "ssl",
- "slow": False,
- "desc": "Server cert fingerprint",
- },
- "ssl::server_name": {
- "category": "ssl",
- "slow": False,
- "desc": "TLS SNI server name",
- },
- "ssl::server_name_regex": {
- "category": "ssl",
- "slow": False,
- "desc": "TLS SNI regex match",
- },
- "connections_encrypted": {
- "category": "ssl",
- "slow": False,
- "desc": "All connections over TLS",
- },
- # Advanced ACLs
- "external": {
- "category": "advanced",
- "slow": True,
- "desc": "External ACL helper lookup",
- },
- "random": {
- "category": "advanced",
- "slow": False,
- "desc": "Random probability match",
- },
- "note": {
- "category": "advanced",
- "slow": False,
- "desc": "Transaction annotation",
- },
- "annotate_transaction": {
- "category": "advanced",
- "slow": False,
- "desc": "Add transaction annotation",
- },
- "annotate_client": {
- "category": "advanced",
- "slow": False,
- "desc": "Add client annotation",
- },
- "peername": {
- "category": "advanced",
- "slow": False,
- "desc": "Cache peer name",
- },
- "peername_regex": {
- "category": "advanced",
- "slow": False,
- "desc": "Cache peer name regex",
- },
- "hier_code": {
- "category": "advanced",
- "slow": False,
- "desc": "Squid hierarchy code",
- },
- # Group ACLs
- "any-of": {
- "category": "group",
- "slow": False,
- "desc": "Match any of the ACLs",
- },
- "all-of": {
- "category": "group",
- "slow": False,
- "desc": "Match all of the ACLs",
- },
- }
- PREDEFINED_ACLS: list[str] = [
- "all",
- "manager",
- "localhost",
- "to_localhost",
- "to_linklocal",
- "CONNECT",
- ]
|