Forum

Notifications
Clear all

Is blocking GitHub API calls a step too far for self-hosters?

6 Posts
6 Users
0 Reactions
12 Views
(@first_time_selfhost)
Eminent Member
Joined: 2 months ago
Posts: 28
Topic starter   [#1137]

After reviewing the documentation on egress filtering best practices, I'm planning my firewall rules for a small, self-hosted OpenClaw deployment. The principle of least privilege suggests we should block all egress by default, then open only what's necessary.

My list of required outbound destinations is straightforward:
* The specific cloud storage bucket for my agent's assigned tasks and results.
* A local logging server.
* The internal NTP server.

However, I'm uncertain about handling traffic to common development platforms. Specifically, I'm considering a rule to block all egress to `api.github.com` and `raw.githubusercontent.com`. My reasoning is twofold:

1. **Compliance & Control:** The agent's purpose is defined and should not require pulling arbitrary code or manifests from external repositories at runtime. Allowing this could introduce an unapproved software supply chain vector.
2. **Data Privacy:** Even metadata from API calls (e.g., checking for updates) could leak information about my deployment's activity patterns.

The counterargument is that some community-maintained agents or future official features might legitimately use these endpoints for dynamic content. My proposed middle ground is to implement the block but log the denied connections for review.

Here is the basic `nftables` rule I'm considering:

```bash
define github_net = { 140.82.112.0/20, 185.199.108.0/22, 192.30.252.0/22 }
table inet filter {
chain agent_egress {
ip daddr $github_net counter log prefix "Github-API-Denied: " drop
}
}
```

My question to the group: Is this overly restrictive for a self-hosted, non-enterprise context? Have others implemented similar blocks and encountered breaking functionality, or found it to be a sound security practice? I'm particularly interested in experiences with the long-term maintenance burden of such a rule.



   
Quote
(@yuki_policy)
Eminent Member
Joined: 2 months ago
Posts: 36
 

You're correctly applying the principle of least privilege, but the real issue here is a policy versus mechanism confusion. Blocking at the firewall is a blunt mechanism; you should first define a precise policy for what constitutes a legitimate external fetch.

Your stated goal is to prevent "pulling arbitrary code or manifests." A firewall rule blocking the entire GitHub API domain is overkill and brittle. It will break any future agent that needs to fetch a verified, signed manifest from a known, official repository.

Instead, model this in your policy-as-code layer. For example, in your agent authorization policy (Rego), you could have a rule that permits an agent action `fetch_external` only if the `source_uri` matches an allowed, pre-defined pattern from an allow list in the policy itself. The enforcement point can then deny the network call if the policy decision was `false`. This gives you control over the *what* and *why*, not just the *where*. The firewall becomes a final enforcement layer for a decision you've already made logically.


policy first


   
ReplyQuote
(@moderator_mike_dev)
Eminent Member
Joined: 2 months ago
Posts: 23
 

You're right to be cautious. The compliance angle is especially valid for certain regulated environments where you need to lock down the software supply chain entirely.

Where I'd slightly push back is on the completeness of your "required outbound destinations" list. Have you accounted for all telemetry or update-checking endpoints the core OpenClaw services might use? Even if your agents don't call out, the main coordination services sometimes do for version compatibility checks. A blanket block could cause silent failures there.

Maybe split the difference? Start with the block, but monitor the firewall logs closely for a week in a staging environment. You might find a handful of specific, legitimate subdomains or paths you need to allow, rather than the whole api.github.com wildcard.


Stay secure, stay skeptical.


   
ReplyQuote
(@supplychain_cop)
Eminent Member
Joined: 2 months ago
Posts: 17
 

The silent failure risk on core services is a real operational headache. I've seen coordination nodes hang on startup because they couldn't fetch a schema from a versioned GitHub raw URL, and the error logs were buried.

Your staging test plan is the correct approach, but you need to instrument more than just firewall logs. You should also monitor process exit codes and health check endpoints for the orchestrator and task queue services. A block won't always show as a TCP RST in the firewall log if the connection times out internally.

A more precise alternative is to use a DNS proxy or a local DNS override for those specific domains in your staging env. Point `api.github.com` to a minimal HTTP server that logs all request paths. That way you can build an exact allow list of endpoints, like `/repos/openclaw/agent-schema/contents/spec/v1.json`, instead of guessing subdomains.


-Yuki


   
ReplyQuote
(@openclaw_newb)
Eminent Member
Joined: 2 months ago
Posts: 23
 

That's a great point about telemetry. I hadn't thought about the core services needing checks.

The "monitor in staging" idea seems smart. But as someone still getting my head around docker networking, how do you actually monitor the logs? Are you just using `docker logs` on the service containers, or is there a better way to tie a failed connection back to a firewall block?

I guess the silent failure is what worries me most. I could block it and never know something's broken until later.



   
ReplyQuote
(@trustno1_sec)
Eminent Member
Joined: 2 months ago
Posts: 21
 

Monitoring the docker logs alone won't connect the dots to a firewall block. The connection attempt often just times out internally, giving you a generic error.

You need to correlate across sources. Set up a central log collector (like Loki or even just syslog) for both your firewall drop logs and your container stdout. Use a shared request ID or a timestamp with seconds precision to match events. If you see a `curl` error in a container log at 14:05:03, check the firewall logs for a dropped SYN packet to GitHub's IP at 14:05:03.

Better yet, run a packet capture on the host network interface for a short period. `tcpdump -i any host ` will show you the exact SYN packets that never get a reply. It's old-school, but it doesn't lie.


~Omar


   
ReplyQuote