The Simplest Way to Make Gerrit and Tcp Proxies Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running gerrit and tcp proxies together routes Git traffic safely to your internal code servers. This setup lets developers push code changes over SSH without exposing the main server online. Teams use Gerrit to review code before it merges into the main branch. It runs its own internal SSH service to handle Git pushes and fetches. Putting a network layer in front of that service keeps the host hidden from outside threats. Developers keep their normal Git workflow while the network team control

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Running gerrit and tcp proxies together routes Git traffic safely to your internal code servers. This setup lets developers push code changes over SSH without exposing the main server online.

Teams use Gerrit to review code before it merges into the main branch. It runs its own internal SSH service to handle Git pushes and fetches. Putting a network layer in front of that service keeps the host hidden from outside threats. Developers keep their normal Git workflow while the network team controls the entry points.

How gerrit and tcp proxies handle traffic and keys

Gerrit handles two main types of network traffic during daily work. Developers use web browsers for code reviews and SSH for Git commands. A standard web load balancer handles the browser traffic well. Git traffic over SSH needs a raw TCP forwarder to pass packets straight through.

When a developer pushes code, the client connects to the outer network edge first. The TCP forwarder accepts this packet stream and sends it to the internal Gerrit port. The forwarder does not read the encrypted SSH traffic inside the stream. Instead, Gerrit checks the user public key against its own account database.

Once the key check passes, Gerrit checks the project rules for that specific user. The server checks if the developer can read the repo or push new commits. Data then flows back and forth through the open TCP pipe until the push finishes. This split design keeps network routing separate from code review rules.

Common failure modes and how to scope network paths

Several problems show up when teams link these two tools in production. First, the Gerrit server often sees the forwarder IP address instead of the developer IP. This makes security logs hard to read during a breach review. Teams fix this by turning on client IP forwarding rules on both tools.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Second, shared build bots often use one broad SSH key for many tasks. If that single key leaks, an attacker can pull or change many source repos. Teams should create one service account per build job with tight repo rules. Each bot should only read the single repo it needs to build.

Third, long Git clones can drop if the network layer closes idle links too fast. Big repos take time to pack objects before sending data over the wire. Network admins must set matching timeout limits on both the forwarder and the Git server. Keep internal firewall rules strict so Gerrit only accepts TCP traffic from the forwarder subnet.

Finally, raw TCP logs only show packet counts and IP addresses. They do not show which user ran a Git command or changed a branch. Teams must collect the internal Gerrit audit logs alongside the network logs. Combining both log streams gives security teams a clear view of every code change.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Why use a TCP forwarder instead of an HTTP load balancer for Gerrit SSH?

Git over SSH uses a custom binary stream rather than standard web requests. An HTTP load balancer cannot read or route raw SSH packets. A TCP forwarder passes the raw stream straight to the internal SSH port on Gerrit.

How does Gerrit see the real client IP address behind a forwarder?

Normally, the TCP layer hides the original sender IP and shows its own address. You must enable a client address header protocol on both the forwarder and Gerrit. This passes the real developer IP address inside the first network packet.

How should teams scope permissions for CI bots connecting through the network layer?

Never give a CI bot admin rights or access to all code repos. Give each pipeline its own account with read-only access to one project. Rotate the bot SSH keys on a set schedule to reduce risk.

The query runs. The emails stay hidden.