Configure registry: dev
Point a developer machine's package managers at the firewall. One command per ecosystem.
Each package manager gets one setting: use the firewall instead of the public registry. Do this per machine, or push the same files with MDM.
Before you start: sfw.example.com resolves to the firewall (DNS record, or /etc/hosts for testing).
Trust the certificate
Skip this if the firewall uses a certificate from a CA your machines already trust. Otherwise copy ssl/fullchain.pem from the firewall host to the developer machine as sfw-ca.pem.
# macOS system trust (curl, pip with recent versions)
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain sfw-ca.pem
# Linux system trust
sudo cp sfw-ca.pem /usr/local/share/ca-certificates/sfw-ca.crt && sudo update-ca-certificatesnpm ships its own CA list and does not read the system store by default, so point it at the file directly:
npm config set cafile /path/to/sfw-ca.pemnpm
npm config set registry https://sfw.example.com/npm/Writes registry=https://sfw.example.com/npm/ to ~/.npmrc. pnpm and Yarn 1 read the same .npmrc. Yarn 2+ uses npmRegistryServer in .yarnrc.yml instead.
pip
pip config set global.index-url https://sfw.example.com/pypi/simple/
pip config set global.cert /path/to/sfw-ca.pem # only if the CA isn't trusted system-widePoetry
poetry source add --priority=primary socket-fw https://sfw.example.com/pypi/simple/
poetry config certificates.socket-fw.cert /path/to/sfw-ca.pem # only if the CA isn't publicly trusted
Poetry ignores the system store andpip.confWithout the
certificatessetting, a self-signed certificate makes Poetry reportthe hostname cannot be resolved by your DNS. The real cause shows with-vvvasCERTIFICATE_VERIFY_FAILED.
Other ecosystems
Add the routes you need under path_routing.routes in socket.yml, then docker compose up -d --force-recreate:
- path: /maven
upstream: https://repo1.maven.org/maven2
registry: maven
- path: /nuget
upstream: https://api.nuget.org
registry: nuget
- path: /go
upstream: https://proxy.golang.org
registry: go| Ecosystem | Client setting |
|---|---|
| Maven | ~/.m2/settings.xml mirror: url = https://sfw.example.com/maven, mirrorOf = * |
| NuGet | nuget.config package source: https://sfw.example.com/nuget/v3/index.json |
| Go | export GOPROXY=https://sfw.example.com/go |
Maven runs on the JVM, which has its own truststore. Without the CA there, Maven fails with a misleading No plugin found for prefix error. On Debian/Ubuntu, update-ca-certificates (from Trust the certificate) already adds the CA to the JVM store, so skip this. Elsewhere:
sudo keytool -importcert -noprompt -alias sfw -file sfw-ca.pem -cacerts -storepass changeit # JDK 9+Go still fetches checksums from sum.golang.org directly. On networks with locked-down egress, allow that host or set GOSUMDB / GONOSUMDB.
Verify
npm config get registry
npm cache clean --force
npm install lodash # succeeds
npm install lodahs # 403, blocked# Current Debian/Ubuntu block system-wide pip installs (PEP 668), so use a venv
# On a stock Debian/Ubuntu host, first: sudo apt install python3-venv
python3 -m venv .venv && . .venv/bin/activate
pip install --no-cache-dir requests # succeeds- Clean installs succeed through the firewall
-
npm install lodahsfails with E403 -
docker compose logs socket-firewall | grep SOCKET_DECISIONon the firewall host shows the requests (needsSOCKET_IGNORE_LOG_LEVEL=warn, set in Block installs with Firewall)
Troubleshooting
| Symptom | Fix |
|---|---|
UNABLE_TO_VERIFY_LEAF_SIGNATURE or SELF_SIGNED_CERT_IN_CHAIN | Set npm's cafile, or use a certificate from a trusted CA |
| 404 on everything | You're reaching the firewall by IP or another hostname. Use sfw.example.com |
| Poetry: "hostname cannot be resolved" | Certificate not trusted. Set poetry config certificates.socket-fw.cert |
pip: externally-managed-environment | Use a venv |
| Installs still go to the public registry | Clear caches (npm cache clean --force, pip --no-cache-dir), and check for a project-level .npmrc or pip.conf overriding yours |
Want zero client config?See DNS override.
Updated 8 days ago