g0efilter

module
v0.7.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT

README

agent pulls dashboard pulls CI (Go) CI (UI) Tests codecov

[!NOTE] Portions of this project were developed with the assistance of AI tools.

[!WARNING] g0efilter is in active development and its configuration may change often.

g0efilter controls network traffic leaving your containers. It runs beside a workload and applies IP and domain rules without decrypting TLS traffic.

Features

  • Allow or block traffic by IP, CIDR, or domain.
  • Match exact domains, wildcards, or regular expressions.
  • Choose HTTPS inspection, DNS filtering, or strict DNS filtering.
  • Start with either a default-deny allowlist or a default-allow denylist.
  • Test and build policies with audit and learning modes.
  • Reload policies without restarting the container.
  • Use the optional dashboard, remote unblock, process details, and Gotify alerts.

Quick start

Create a policy directory:

mkdir -p policy

Add policy/policy.yaml:

allowlist:
  ips:
    - '1.1.1.1'
  domains:
    - 'github.com'
    - '*.alpinelinux.org'

Save this as docker-compose.yaml:

services:
  g0efilter:
    image: docker.io/g0lab/g0efilter:latest
    volumes:
      - ./policy/:/app/policy/
    cap_drop:
      - ALL
    cap_add:
      - NET_ADMIN
      - SETUID
      - SETGID
      - CHOWN
    security_opt:
      - no-new-privileges

  example-container:
    image: docker.io/alpine/curl:latest
    command: sh -c "sleep infinity"
    network_mode: "service:g0efilter"

Start the services:

docker compose up -d

See the examples for complete Compose files and policies. See runtime user configuration to change the container identity.

Filter modes

Attached containers share g0efilter's network connection. Allowed IPs and CIDRs pass through directly. Other traffic is handled by FILTER_MODE.

Mode Checks domains at Blocks hardcoded IPs? Best for
https Connection time, using TLS SNI or the HTTP Host header Yes Precise control of web traffic
dns DNS lookup time No Simple, broad filtering
dns-strict DNS lookup and connection time Yes Strict domain filtering on any port

See filter modes for details and limits.

Use dns-strict when a workload connects to allowed domains over protocols or ports other than HTTP and HTTPS. It allows IPs learned through approved DNS lookups while blocking direct-IP and alternate-DNS bypasses.

[!NOTE] Attached containers must not use g0efilter's internal HTTP, HTTPS, or DNS ports. The defaults are 65080, 65443, and 65053.

Policy

allowlist:
  ips:
    - '1.1.1.1'
    - '192.168.0.0/16'
  domains:
    - 'github.com'
    - '*.alpinelinux.org'
    - '/cache-[0-9]+\.example\.com/'

Mount the policy directory, not only the file. This keeps live reload working when an editor replaces the file during save.

Policies can also use a default-allow denylist, learning mode, or audit mode. See policy for patterns and policy modes. See environment variables for configuration.

GitHub Actions

The GitHub Action filters traffic from the runner. Add it before the steps you want to protect.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Filter egress
        uses: g0lab/g0efilter@v0
        with:
          egress-policy: block
          allowed-domains: |
            *.npmjs.org
            registry.npmjs.org

      - uses: actions/checkout@v7

See GitHub Actions for inputs, built-in allow rules, and security limits.

Dashboard

View the live demo

The optional dashboard shows live and saved traffic. Point g0efilter at it with DASHBOARD_HOST and DASHBOARD_API_KEY. The dashboard can also manage API keys, fleet policy, and remote unblock requests.

See the examples for a complete setup. See dashboard authentication, persistent logs, and remote unblock for its security requirements.

Documentation

Verify container signatures

Images use Cosign keyless signatures. Signatures are stored in g0lab/signatures:

COSIGN_REPOSITORY=docker.io/g0lab/signatures \
cosign verify g0lab/g0efilter:latest \
  --certificate-identity-regexp=https://github.com/g0lab/g0efilter \
  --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
  -o text

Use g0lab/g0efilter-dashboard:latest to verify the dashboard image.

License

MIT, see LICENSE.

Directories

Path Synopsis
Package main is the entrypoint for g0efilter.
Package main is the entrypoint for g0efilter.
alerting
Package alerting provides notification capabilities for security events.
Package alerting provides notification capabilities for security events.
filter
Package filter provides network filtering utilities.
Package filter provides network filtering utilities.
g0efilter
Package g0efilter contains the g0efilter application wiring and run loop.
Package g0efilter contains the g0efilter application wiring and run loop.
netutil
Package netutil provides the SO_MARK dialer that lets g0efilter's own outbound traffic (proxy upstreams, dashboard shipping, notifications) bypass its nftables rules.
Package netutil provides the SO_MARK dialer that lets g0efilter's own outbound traffic (proxy upstreams, dashboard shipping, notifications) bypass its nftables rules.
nftables
Package nftables provides nftables integration.
Package nftables provides nftables integration.
policy
Package policy parses and validates the allowlist policy file.
Package policy parses and validates the allowlist policy file.
procinfo
Package procinfo resolves the process that owns a local socket by walking /proc, for log enrichment.
Package procinfo resolves the process that owns a local socket by walking /proc, for log enrichment.
safeio
Package safeio provides helpers to safely drain and close readers.
Package safeio provides helpers to safely drain and close readers.
telemetry
Package telemetry ships filter decision events to the dashboard and raises alerts.
Package telemetry ships filter decision events to the dashboard and raises alerts.
Package main is the entrypoint for g0efilter-dashboard.
Package main is the entrypoint for g0efilter-dashboard.
demo
Package demo provides synthetic-traffic fixtures shared by development tools.
Package demo provides synthetic-traffic fixtures shared by development tools.
model
Package model holds the dashboard domain types shared by the HTTP layer and storage implementations.
Package model holds the dashboard domain types shared by the HTTP layer and storage implementations.
server
Package server provides the web UI and HTTP API server.
Package server provides the web UI and HTTP API server.
store
Package store provides SQLite-backed persistence for the dashboard, using an Ent client for queries and Atlas-generated versioned migrations.
Package store provides SQLite-backed persistence for the dashboard, using an Ent client for queries and Atlas-generated versioned migrations.
ui
Package ui embeds the built dashboard frontend so the server can serve it.
Package ui embeds the built dashboard frontend so the server can serve it.
scripts
dev-seed-dashboard command
Command dev-seed-dashboard replaces local dashboard logs with deterministic demo data.
Command dev-seed-dashboard replaces local dashboard logs with deterministic demo data.
dev-traffic-gen command
Command dev-traffic-gen posts canonical synthetic traffic to a local dashboard.
Command dev-traffic-gen posts canonical synthetic traffic to a local dashboard.
shared
actions
Package actions defines shared action and filter mode constants used across multiple internal packages without introducing import cycles.
Package actions defines shared action and filter mode constants used across multiple internal packages without introducing import cycles.
logging
Package logging provides a zerolog-backed slog logger with human-readable terminal output.
Package logging provides a zerolog-backed slog logger with human-readable terminal output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL