Join our Newsletter — 33% off our NHI Course
Home› Guides› Squid Proxy Hardening Guide: Closing Open Proxies, Locking…
Guide Network Security

Squid Proxy Hardening Guide: Closing Open Proxies, Locking Down ACLs and Bumping TLS Safely

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 19 November 2026 16 min read
On this page

A Squid forward proxy is only as safe as its http_access rules, so hardening starts with a default-deny access policy and only then moves on to authentication, TLS interception, header handling and logging. Squid has been the default open-source forward proxy for decades, and the same misconfiguration keeps turning up: a proxy that answers requests from anyone, or that lets clients tunnel to any port with CONNECT. This guide works through the directives that matter, using the descriptions in Squid's own configuration reference (cf.data.pre, the source of the shipped squid.conf documentation).

The guide is written for platform, network and security engineers who run Squid as an egress control point for servers, build agents, containers and AI workloads. Those clients are mostly non-human identities, so the proxy is often the one place where outbound access by machines can be seen, authorised and logged. For the wider design questions about forward, reverse and transparent proxies, read the Proxies and Forward vs Reverse Proxy Security Guide first; this page stays with Squid itself.

This is an independent guide from NHI Mgmt Group, based on the Squid project's public configuration reference as of November 2026. It is not sponsored or reviewed by the Squid project. Directive names and defaults change between releases, so confirm settings against the documentation for the version you run.

Key takeaways

  • Squid's documented behaviour is to deny when no http_access lines are present, and the shipped rules end with "deny all other access to this proxy". Keep that final deny and never add a broad allow above it.
  • The shipped rules deny CONNECT to anything other than the ports in SSL_ports (443 by default). Widening that list is how a forward proxy becomes a generic tunnel.
  • The default configuration permits only localhost; the example localnet allow rule is commented out. Enable it only with source ranges you actually own.
  • Authenticate clients with auth_param where you can, so every log line names a user or workload identity rather than just an IP address.
  • SSL Bump is a deliberate man-in-the-middle. The documented fallback when no rule matches is splice, and the default for certificate errors is to terminate the transaction. Keep both.
  • Strip identifying metadata: the forwarded_for default is on, which appends client IP addresses to outbound requests, and httpd_suppress_version_string defaults to off.
  • Restrict the cache manager to localhost and disable actions you do not need with cachemgr_passwd.

Why open Squid proxies keep appearing

A forward proxy that answers anyone on the internet becomes an anonymiser for other people's traffic. Attackers use open proxies to hide the source of scanning, credential stuffing and command and control traffic, which MITRE ATT&CK tracks as Proxy (T1090). If the proxy also permits CONNECT to arbitrary ports, it becomes a tunnel into whatever the proxy host can reach, including internal services on the same network.

Squid's own reference explains why the defaults are tight. Its shipped rules allow only localhost, and the reference warns that "a more permissive Squid installation could introduce new attack vectors" into the network, because a proxy sitting inside the perimeter can reach services that are not protected against local requests. Most open proxies are therefore not caused by Squid's defaults but by later edits: an http_access allow all added during troubleshooting, a localnet ACL that was widened to 0.0.0.0/0, or a port opened on a public interface when it was meant for an internal one.

Three questions catch most of these mistakes:

  • Which interfaces and ports does http_port listen on, and which of them are reachable from untrusted networks?
  • Does any http_access allow rule match a source range wider than your own clients?
  • Can a client CONNECT to ports other than 443?

Building a default-deny http_access policy

Squid evaluates http_access lines in order and acts on the first match. The reference states that "if there are no access lines present, the default is to deny", and the shipped configuration ends with an explicit deny for everything that did not match earlier. Write your policy with that model in mind: specific denies first, narrow allows next, and a final http_access deny all.

The shipped rule set gives a good skeleton:

  • acl SSL_ports port 443 defines the only port CONNECT may reach.
  • acl Safe_ports lists the ports plain HTTP requests may use, including 1025-65535 for unregistered ports. Consider removing that high range if your clients do not need it, because it lets HTTP requests target almost any service port.
  • A rule that denies requests to ports not in Safe_ports.
  • A rule that denies CONNECT to anything other than SSL_ports, commented in the reference as "Deny CONNECT to other than secure SSL ports".
  • Rules that allow the cache manager only from localhost.
  • Your own allow rules for known client ranges or authenticated users.
  • The final deny all.

Keep client source ACLs narrow. The example localnet ACL in the shipped configuration covers private address ranges, and the matching allow rule is commented out by default. Rather than uncommenting it as is, define ACLs for the subnets that really need egress: build runners, application tiers, a management network. Where workloads have different needs, give each its own ACL and its own destination list instead of one shared allow.

Destination allow lists for machine clients

Servers and pipelines rarely need the whole web. Pair each source ACL with a destination ACL (by domain or by address) so that a build runner can reach its package mirrors and source control host but nothing else. This turns the proxy into an egress allow list for non-human identities and makes stolen credentials or a compromised dependency much less useful, because the attacker cannot simply call out to an arbitrary host. Use deny_info to return a clear error page for requests that fail http_access, so developers can tell a policy block from a network fault.

Response-side controls

http_reply_access lets you act on responses as well as requests. The reference notes, for example, that HTTP 101 Switching Protocols responses can be restricted further with http_reply_access, which matters if you do not want clients upgrading connections to protocols the proxy cannot inspect.

Listening ports and the proxy host

Bind http_port to the internal interface clients use, not to every address on the host. A proxy that listens on all interfaces is one firewall change away from being open. Put a host or network firewall in front of the port as a second layer, so that only client subnets can reach it; the Linux Firewall Guide covers that layer.

Run Squid as an unprivileged account. The reference explains that if Squid is started as root, it changes its effective and real UID and GID to the user set in cache_effective_user. Make sure that account owns only the cache, log and certificate database directories Squid needs, and nothing else.

Set sensible limits on request size. request_header_max_size limits the header size of a received HTTP request, and client_request_buffer_max_size sets the maximum buffer size of a client request. Leave the defaults unless you have a reason to change them, and avoid raising them to work around a single misbehaving client. max_filedescriptors caps descriptors up to the operating system hard limit, which helps the proxy fail predictably under load rather than exhausting the host.

Point Squid at resolvers you control with dns_nameservers if the host's default resolvers are not the ones your security monitoring watches. DNS answers decide where every proxied request goes.

Authenticating clients with auth_param

IP-based ACLs tell you which subnet a request came from; authentication tells you which user or workload made it. Squid supports several schemes through auth_param: Basic, Digest, NTLM and Negotiate. The realm behaviour differs by scheme: Basic has the default realm "Squid proxy-caching web server", Digest has no default and the realm is mandatory, and the realm is ignored for NTLM and Negotiate.

Practical guidance for each client type:

  • Staff workstations: Negotiate against the corporate directory gives single sign-on without users typing passwords into the proxy prompt.
  • Servers and pipelines: give each workload its own proxy credential rather than one shared account, store it in a secrets manager, and rotate it. A single shared proxy password embedded in every build image is a long-lived secret that is hard to revoke.
  • Basic authentication: treat Basic as a password sent with every request; protect the client to proxy leg with TLS or restrict Basic to trusted network segments, and prefer Negotiate or Digest where clients support them.

Once authentication is in place, write ACLs that use the authenticated identity, so that the policy says "the deploy service account may reach the registry" rather than "this subnet may reach the registry". That ties egress decisions to named non-human identities and makes the access log far more useful in an investigation.

SSL Bump: decrypting traffic deliberately

SSL Bump lets Squid decrypt HTTPS for CONNECT requests that the ssl_bump rules allow. The reference describes this plainly as man-in-the-middle behaviour, and the ssl-bump option on http_port is required to enable it. Treat it as a privacy and trust decision first and a configuration task second; the TLS Inspection Guide covers the policy side.

Steps and actions

Squid processes a bumped connection in three steps, which the at_step ACL recognises: SslBump1 after TCP-level and HTTP CONNECT information, SslBump2 after the TLS Client Hello, and SslBump3 after the Server Hello. At each step a rule can choose an action:

ActionWhat the reference says it does
spliceBecome a TCP tunnel without decrypting proxied traffic. It is also the action used when no rule matches.
peekReceive the client or server certificate while keeping the option to splice.
stareReceive the certificate while keeping the option to bump. Staring at the server certificate at step 2 usually prevents splicing at step 3.
bumpDecrypt the connection. At step 1 Squid secures the client connection first, then connects to the server.
terminateClose client and server connections.

A safe pattern is to peek at step 1 to read the server name, splice categories you have decided never to decrypt (for example health, banking or certificate-pinned services), bump only what policy requires, and terminate destinations you block outright. Because splice is the fallback, a gap in your rules leads to traffic passing undecrypted rather than to unexpected interception.

The signing CA

With generate-host-certificates, which is enabled by default when ssl-bump is used, Squid creates server certificates on the fly. The first tls-cert= file on the port must then be a CA certificate able to sign them. That CA private key is one of the most sensitive secrets in the environment: anyone holding it can impersonate any site to every client that trusts it. Generate a dedicated intermediate for the proxy, keep its key readable only by the Squid account, prefer a hardware-backed key where available, set a short validity, and record it in your certificate inventory. Never reuse a general-purpose enterprise CA.

The certificate helper defined by sslcrtd_program keeps generated certificates in a database. The reference notes that without its -s and -M parameters, the program generates a new certificate on every request, so keep the database configured and protect its directory like the key.

Upstream validation

Once Squid bumps a connection, it is the client to the origin server, so its own TLS settings decide whether that leg is safe. The default for sslproxy_cert_error is that server certificate errors terminate the transaction, and the reference warns that bypassing validation errors is dangerous because an error usually means the server cannot be trusted. Do not add blanket exceptions. Set tls_outgoing_options with a modern minimum version: the documented default is min-version=1.0, and supported values run from 1.0 to 1.3, so raise it to 1.2 in line with NIST SP 800-52 Rev. 2, and point cafile= at the trust store you intend.

Header handling and information leakage

A forward proxy adds and passes headers that can disclose internal detail to every site clients visit.

  • forwarded_for: the default is on, which appends the client's IP address to outbound requests. Other values are off, transparent (do not alter the header), delete (remove the header entirely) and truncate (remove existing entries). For an egress proxy, delete or off keeps internal addressing private.
  • via: Squid includes a Via header by default, as HTTP requires. Leave it on unless you have a specific reason, and pair it with a neutral visible_hostname, which sets the hostname shown in error messages.
  • httpd_suppress_version_string: the default is off. Turning it on stops Squid sending its version string in HTTP metadata and generated content, which removes an easy fingerprint.
  • request_header_access and reply_header_access: these let you remove specific headers. The reference warns that doing so violates the HTTP standard, so strip only headers you understand, such as internal debugging headers, and test the effect on applications.

Be careful with credentials in headers. Machine clients often send API keys and bearer tokens through the proxy. Without SSL Bump these stay inside the TLS tunnel; with bumping, they become visible to Squid and anything it logs or sends to an ICAP service. Make sure your log format does not record authorisation headers.

Cache manager and administrative access

The cache manager exposes statistics and control actions. The default manager ACL matches the internal /squid-internal-mgr/ path, and the shipped rules only allow cache manager access from localhost. Keep that restriction. If monitoring needs remote access, front it with a separate authenticated channel rather than widening the ACL.

Use cachemgr_passwd to set passwords for cache manager operations, and set the password to disable for actions you never use. Treat those passwords as secrets: they do not belong in a configuration file committed to a shared repository.

Content adaptation and rewriting

Squid can hand requests to external services. icap_service defines an ICAP service in the form icap_service id vectoring_point uri [option ...], commonly used for malware scanning or data loss prevention. With SSL Bump, those services receive decrypted content, so they inherit the same sensitivity as the proxy: restrict which traffic is sent to them, run them on trusted hosts, and protect the channel between Squid and the service.

Any helper program Squid runs, including authentication helpers and the certificate helper, executes with Squid's privileges. Keep helpers patched, owned by root and not writable by the Squid account, and review them in the same change process as squid.conf.

Logging and monitoring

access_log configures whether and how Squid logs HTTP and ICP transactions, using the form access_log <module>:<place> [option ...] [acl acl ...], and by default logs through the daemon module in the native squid format. Ship logs to your central platform rather than leaving them only on the proxy host.

Useful detections, all illustrative and to be tuned for your environment:

  • Requests from source addresses outside your defined client ranges, which point to an exposed port.
  • CONNECT attempts to ports other than 443, which usually mean tunnelling attempts or misconfigured tools.
  • A service account reaching destinations it has never used before.
  • Spikes in denied requests from a single workload, often a sign of a compromised host or a broken deployment.
  • Cache manager requests from anywhere other than localhost.

Map these to ATT&CK techniques such as Proxy (T1090) and Application Layer Protocol (T1071), and to mitigations such as Filter Network Traffic (M1037) and M1020 SSL/TLS Inspection.

Common failure patterns

  • Allow all during troubleshooting. An http_access allow all added to fix a ticket and never removed turns the proxy into an open relay.
  • Widened localnet. The example ACL is edited to cover everything rather than replaced with specific client ranges.
  • Extra SSL_ports. Ports such as 22 or database ports are added to SSL_ports for one team, letting every client tunnel to those services anywhere.
  • Listening everywhere. http_port bound to all interfaces on a dual-homed host, exposing the proxy on its public side.
  • Shared proxy credentials. One account used by every pipeline, baked into images and never rotated.
  • Exposed bump CA. The signing key copied to configuration management, readable by other accounts, or reused across environments.
  • Certificate errors ignored. sslproxy_cert_error allowed for all traffic to silence a few broken sites, removing upstream validation entirely.
  • Tokens in logs. A custom log format that records request headers after bumping, putting bearer tokens in the log platform.

Practitioner checklist

  • Confirm the last http_access line is deny all and that no allow rule matches untrusted sources.
  • Restrict SSL_ports to 443 and review Safe_ports, removing ranges your clients do not need.
  • Bind http_port to internal interfaces only and firewall the port to client subnets.
  • Replace the example localnet ACL with named ACLs per workload, each with a destination allow list.
  • Enable auth_param authentication and issue one rotated proxy credential per workload.
  • If you use SSL Bump, peek first, splice by policy, keep splice as the fallback and keep certificate errors terminating.
  • Protect the bump CA key as a tier-zero secret and set tls_outgoing_options to a minimum of TLS 1.2.
  • Set forwarded_for to delete or off and turn on httpd_suppress_version_string.
  • Keep the cache manager localhost-only and disable unused actions with cachemgr_passwd.
  • Run Squid as an unprivileged cache_effective_user and send access_log output to central logging without authorisation headers.

Standards and references

Related NHI Mgmt Group resources: Proxies and Forward vs Reverse Proxy Security Guide · TLS Inspection Guide · TLS Inspection vs Encrypted Traffic Analysis · Linux Server Hardening Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.