Bridge containers have no outbound TCP/UDP when host FORWARD policy is DROP (no accept or MASQUERADE rules for kiri0)

Open
#247 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
linux, rust

Research direction

Start by tracing how Kiri sets up its default bridge and host networking, then inspect the networking code and tests that configure forwarding and NAT; the issue does not name specific files. Reproduce with FORWARD policy set to DROP and compare bridge traffic with --network host. Done means the bridge can reach external TCP and DNS destinations, or setup and documentation clearly explain the required forwarding and masquerade rules.

Written by the indexing model from the issue text.

Description

Environment

  • Kiri engine 0.2.0, Ubuntu with ufw active (iptables-nft)
  • The real Docker engine is also installed and was running
  • FORWARD policy is DROP

What happens

  • A container on the default bridge (172.20.0.0/16 on kiri0) can ping 1.1.1.1. TCP to 1.1.1.1:443 and DNS to 8.8.8.8 and 1.1.1.1 time out.
  • The same lookup with --network host works.
  • Builds fail with lookup registry-1.docker.io: i/o timeout.
  • iptables -S FORWARD and nft list ruleset show no rule that accepts traffic on kiri0.
  • iptables -t nat -S POSTROUTING shows MASQUERADE only for the Docker, libvirt and Tailscale subnets, none for 172.20.0.0/16.

Workaround

  • A ufw route allow rule in and out on kiri0.
  • A MASQUERADE rule for 172.20.0.0/16 in /etc/ufw/before.rules.

Expected: one of these:

  • Kiri installs its own forward-accept and NAT rules (for example in its own nft table), or
  • kiri setup detects a DROP forward policy and prints the needed rules, or
  • The docs list this requirement.

Repro

  1. Use a host with iptables -P FORWARD DROP (ufw or Docker installed).
  2. Start kiri.
  3. Run docker run --rm alpine nc -z -w4 1.1.1.1 443. It fails.
  4. Run docker run --rm --network host alpine nc -z -w4 1.1.1.1 443. It works.
Dominant language
Rust
Stars
7.5k
Forks
329
Avg merge
7h 48m
Merged PRs (30d)
105

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libracoder/kiri

All issues in libracoder/kiri

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.