Connect a web proxy
BETAChain your company's web proxy, such as Zscaler or Squid, to a Bytesafe proxy so package installs are checked by your firewalls without changing developer machines.
Connect your company web proxy to Bytesafe to route registry requests from developer machines, AI agents, and build environments that use the proxy. Their package managers can keep their existing registry settings.
For example, npm install asks for registry.npmjs.org. Your web proxy forwards the request to Bytesafe, and the attached npm firewall checks it against its rules. For container images, configure the client directly.
Proxies are in beta
Contact support@bytesafe.dev to get access.
How the chain works, and why the web proxy trusts a Bytesafe certificate: Web proxy chaining.
Before you start
- Your web proxy already decrypts developers' TLS traffic to the package registries.
- You hold
ns:updatein the namespace. Proxies belong to the namespace: creating, editing, rotating, and deleting them, and reading Connections, needsns:update. Viewing the other tabs only needsns:access. See Permissions.
Create a proxy
In the dashboard, open Proxies and click New proxy:
- Name and optional Description
- Firewalls: the firewalls whose registries this proxy routes. Each registry host can be covered by only one of them, so two npm firewalls cannot share a proxy. Container (OCI) firewalls cannot be attached
- Certificate, when your deployment offers a shared root: Shared Bytesafe root or This proxy's own CA (below)
- User identity: whether log entries show the user your web proxy reports (see Show users on log entries)
After you create it, the sheet shows the Proxy credential (prx-...) once, with a Download CA certificate button. Copy the credential now: it is never shown again. If you lose it, rotate it on the proxy's Overview tab.
To create proxies from the API instead, see the Proxies API.
Choose the certificate
Skip this if the form has no Certificate choice: your deployment has no shared root, and every proxy uses its own CA.
Your web proxy checks the certificate Bytesafe presents for each registry, so it has to trust the CA that signed it. Pick the one that matches how your web proxy can send the credential:
| Choice | Your web proxy trusts | It can send the credential |
|---|---|---|
| This proxy's own CA | A CA that belongs to this proxy only | As Proxy-Authorization when it opens the tunnel |
| Shared Bytesafe root | One root for every proxy in the deployment | As Proxy-Authorization, or as the X-Bytesafe-Proxy-Token header on each request |
If your web proxy can only add a header, choose Shared Bytesafe root. Bytesafe answers the TLS handshake before the first request arrives, so it can use a proxy's own CA only when the credential came with the tunnel. Which CA answers has the detail.
Proxy-Authorization can be Basic, with the credential as the password (or as the user name when there is no password), or Bearer.
Configure the web proxy
The proxy's Setup tab walks through this with your values filled in:
- Fill in your details. The endpoint address and the proxy credential. They only fill in the snippets on the page and are not saved.
- Install the certificate. Download certificate gives the proxy's own CA or the shared root, whichever the proxy uses. Install it where your web proxy reads trusted CAs.
- Forward these hosts to Bytesafe. The hosts this proxy routes, each with a copy button, and Copy for the whole list. It includes the Bytesafe API host, because the package downloads the firewall hands out point there. The list changes when you attach or detach firewalls.
- Configure your web proxy. Snippets for Squid and a checklist for Zscaler.
Squid
Pick the tab that matches your certificate. Proxy-Authorization works with either one. Header and TLS to Bytesafe need the Shared Bytesafe root.
Squid opens a tunnel to Bytesafe for each registry and adds the credential to every request in it. Add this to squid.conf next to your existing SSL bump rules, with one acl pair per host from Setup step 3:
# Registry traffic goes to Bytesafe; everything else is untouched.
cache_peer <endpoint-host> parent <endpoint-port> 0 no-query no-digest default name=bytesafe
request_header_add X-Bytesafe-Proxy-Token "<proxy-credential>" bytesafe_registries
acl bytesafe_registries dstdomain registry.npmjs.org
acl bytesafe_registries_tls ssl::server_name registry.npmjs.org
ssl_bump bump bytesafe_registries_tls
never_direct allow bytesafe_registries
cache_peer_access bytesafe allow bytesafe_registries
cache_peer_access bytesafe deny all
# Trust the certificates Bytesafe presents for these registries.
tls_outgoing_options cafile=/etc/squid/bytesafe-proxy-ca.pemSquid connects to Bytesafe over TLS as if it were the registry, without a tunnel, and adds the credential to every request. Use this when your proxy cannot open tunnels to another proxy:
# Registry traffic goes to Bytesafe; everything else is untouched.
cache_peer <endpoint-host> parent <endpoint-port> 0 no-query no-digest default tls name=bytesafe
request_header_add X-Bytesafe-Proxy-Token "<proxy-credential>" bytesafe_registries
acl bytesafe_registries dstdomain registry.npmjs.org
acl bytesafe_registries_tls ssl::server_name registry.npmjs.org
ssl_bump bump bytesafe_registries_tls
never_direct allow bytesafe_registries
cache_peer_access bytesafe allow bytesafe_registries
cache_peer_access bytesafe deny all
tls_outgoing_options cafile=/etc/squid/bytesafe-proxy-ca.pemZscaler
In the Zscaler admin portal:
- Forward the registries. Add a forwarding rule that sends the hosts from Setup step 3 to the endpoint address, as a proxy chaining gateway.
- Trust the certificate. Upload the certificate from Setup step 2 as a proxy chaining root certificate.
- Send the credential. Add the header
X-Bytesafe-Proxy-Tokenwith the credential. If you cannot add headers, use the credential as the gateway's proxy password, which works with either certificate.
Verify the chain
From a machine behind the web proxy, with no registry configuration, install a package that one of the attached firewalls covers. The install should succeed, and the decision should appear in the firewall's logs like any other request. Then install a version a rule blocks: the package manager should get the block.
The proxy's Connections tab shows what reached Bytesafe for this proxy, newest first. Each row shows whether the web proxy opened a tunnel or connected over TLS, the host it asked for, where the credential was found and whether it matched, the user and client address, and the result. Turn on Refresh automatically while you test.
Header names are listed, but not their values, except for the user header and X-Forwarded-For. Field details: Connection events.
Show users on log entries
Requests through a proxy are made by the proxy, so log entries name the proxy instead of a user. If your web proxy sends the signed-in user in a header (Zscaler and Prisma Access use X-Authenticated-User), set the proxy's User identity:
- Ignore: the header is not read
- Plain text: the header holds the user name
- Base64: the header holds the user name, base64-encoded
For Plain text and Base64, Header name sets which header to read, X-Authenticated-User by default. The value is shown in the log's User column and found by the User filter, and stored as proxyUser on the entry. The values Unknown and values that do not decode are ignored.
The value is whatever the web proxy reports, not a Bytesafe user, and it does not affect permissions or rules. Turn it on only for a web proxy you control.
Rotate the credential
On the Overview tab, the Credential card has Rotate. The current credential stops working at once and the new one is shown once. Update the web proxy right after rotating: installs through it fail until it sends the new credential.
Troubleshooting
Your web proxy does not trust the certificate Bytesafe presented. Check that the certificate from Setup step 2 is installed, and that it is the right one: Shared Bytesafe root needs the shared root, This proxy's own CA needs that CA.
A proxy using its own CA that sends the credential only in a header also lands here. Bytesafe cannot pick that CA before the credential arrives. Send Proxy-Authorization instead, or switch the proxy to the shared root.
The credential on the tunnel matches no proxy: it was mistyped, or it was rotated. Copy the current credential into the web proxy, or rotate to get a new one.
The Connections row's detail and credential columns show which case it is:
- The host is not routed by this proxy. It is missing from Setup step 3, or two attached firewalls cover it.
- The request carries no credential, or one that matches no proxy.
- The credential belongs to a different proxy than the one the connection was opened for.
The web proxy is not forwarding that host. Compare its forwarding rule with the host list on the Setup tab, which changes when firewalls are attached or detached.
Lockfiles written before the web proxy forwarded to Bytesafe can also point at hosts that are not in the list: a uv or pdm lockfile can name files.pythonhosted.org, and composer.lock can name a package's source host. Those downloads go around the firewall. Create the lockfile again through the web proxy: new lockfiles record the firewall's URLs. npm lockfiles that point at registry.npmjs.org are routed like any other request.
Nothing reached Bytesafe for this proxy, or Bytesafe could not tell which proxy it was. A request with a wrong credential, or a handshake that failed before any credential arrived, cannot be attributed to a proxy. Check the web proxy's own logs for connections to the endpoint address.
Related
- Concept: Web proxy chaining
- Reference: Proxies, Logs, Permissions
- How-to: Enforce firewall use, View logs, Integrate with repository managers
Use the firewall as an Artifactory upstream
Configure JFrog Artifactory remote repositories to fetch through the firewall, per ecosystem, including the settings that differ from Artifactory's defaults.
View logs
Read firewall logs in the dashboard and stream them live from the terminal with the bsfw CLI.