The tunnel works for everyone behind it, the gateway forwards their traffic, and yet the box itself cannot install a security update. This is the usual shape of the problem: forwarding permission was granted to clients, and the gateway's own outbound connections were never included in the plan. The package manager opens its own sockets, from the gateway, to a repository you probably have not named anywhere in the firewall policy.

Locking a gateway down is correct. Locking it down so thoroughly that it stops receiving patches is a different decision, and usually an accidental one.

Local output is not client forwarding

Forwarding rules govern packets that arrive from somewhere else and leave through the gateway. The gateway's own update traffic never matches them; it is generated locally and traverses the output path. That distinction explains a failure that looks impossible while client access works perfectly.

It also explains a policy gap that survives testing, because a quick check from a laptop behind the tunnel proves the forward chain works and says nothing about the host's own connections. Treat the gateway as two subjects: a router with a forward chain and a host with an output chain. Both need an opinion, and only one of them usually gets written down.

Name the stage that failed

Update errors name different boundaries, and reaching for a port rule before reading which one failed wastes an afternoon. A repository name that will not resolve is a resolver question, not a transport question.

getent hosts deb.debian.org
curl -sSI https://deb.debian.org/debian/dists/stable/Release | head -n 1
apt-get -o Debug::Acquire::https=true update

A timeout after a successful lookup moves the question to transport: which address, which port and which configured proxy the package manager actually tried. A TLS verification failure is a third thing entirely, and it means the connection worked well enough to negotiate. An archive authentication complaint is the fourth stage, and it concerns signed metadata rather than reachability. Four stages, four different repairs, and a ping only ever describes one protocol that no package manager uses.

Read the source list before adding a rule

List the actual source URIs and the effective proxy configuration instead of the ones you remember. A rule written for plain HTTP is useless when the source is HTTPS, and a proxy that the shell knows about may be invisible to a service started at boot with a different environment.

APT's HTTP transport documentation covers environment and APT-specific proxy settings, including per-host choices, and its HTTPS transport has verification settings of its own. The path a browser takes and the path the package manager takes are separate paths, even on the same machine.

Note which families the sources resolve to. A rule that permits IPv4 only will keep failing on a host whose sources prefer an AAAA record, and the error looks intermittent because it depends on which answer arrives first.

Pick one maintenance path and keep it

Three defensible options exist: maintenance traffic through the tunnel, through a managed update proxy, or through a narrow direct exception. Choose one deliberately and make the resolver agree with it, because a split where names resolve one way and connections go another produces failures nobody can explain.

Whatever you choose, it must not become an unrestricted fallback. If direct outbound traffic is forbidden when the tunnel is down, a maintenance exception that quietly permits everything is a policy change disguised as a fix. Keep the tunnel's own endpoint and bootstrap needs in a separate category from repository access, because they point at different destinations and fail in different ways, so one exemption cannot cover the other.

Verify without weakening the checks

Apply the scope through the firewall that already owns the policy rather than adding a second manager because one guide used it. Then run a metadata refresh and one real package transaction under the maintained policy, and read the output rather than the exit status alone.

Transport success is not permission to relax verification. Archive authentication and TLS server identity are separate guarantees, and disabling either to silence an error changes what you trust rather than what you can reach.

Finish by testing the tunnel-down case deliberately. Knowing how the gateway behaves without its tunnel is part of the design, and discovering it during an outage is not. Bring the tunnel down, run the metadata refresh, and confirm the host fails in the way you intended rather than silently falling back to an open path. Keep repository and proxy credentials out of shared diagnostics, and leave a note naming who owns the update path.

Pennadoù liammet