logfile_rotate 0
cache_log stdio:/dev/stdout
access_log stdio:/dev/stdout
cache_store_log stdio:/dev/stdout
Running squid in container is a bit tricky, since it is indeed an ancient piece of software, but I have managed to run it successfully before with squid configuration like this: max_filedescriptors 1048576
pid_filename /dev/shm/squid.pid
cache_effective_user squid
cache_effective_group squid
and deployment has these set, - UID 31 is squid user inside of container securityContext:
runAsUser: 31
runAsGroup: 31
fsGroup: 31
command: ["sh","-c","squid -z && sleep 3s; squid -N"]The controller then updates squid.conf and reloads squid. This allows pods/namespaces to define their own whitelists.
The great thing about using squid and disabling DNS is you can stop DNS and HTTP exfil, but still allow certain websites to be accessible.
Caddys "magic TLS" can be neat for this if you actually do want to dynamically intercept those https connections in an easy way. It's a use-case where Caddy really shines. You can go nuts trying to configure that cleanly in squid. The docs (perhaps intentionally) make you work for the hidden knowledge of these dark arts. You also get modernities like builtin http2, http3, etc.
Nobody else bothered by squids very lengthy restart time or have I just never configured it properly?
(Not to dunk on squid, it's otherwise mostly great. Especially for its caching features)
I am struggling to lock down a pod in my home cluster to allow local connections to it's web UI but force all other connections through a VPN client. I'm going to investigate if I could use squid for this.
My next approach is going to involve using a sidecar.
One heads up to the author, the text based charts didn't render well on FF mobile. Text is meant to reflow based on screen size, typeface etc. I feel this is a great case for using a drawing/image instead.
it's not perfect [3] but gets the job done for me
[1] not as much "control" as it is "logging", of sorts; "especially when you just need to answer “what is my cluster talking to?”"
[2] https://github.com/ClickHouse/kubenetmon / https://clickhouse.com/blog/kubenetmon-open-sourced
[3] if you have a lot of short-lived containers, you're likely to run into something like this: https://github.com/ClickHouse/kubenetmon/issues/24
edit: clarifying [1]