Linux: published ports unreachable from remote hosts — SYN arrives, LISTEN socket held by kiri, no SYN-ACK (loopback works)

Aperta
#649 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, linux, rust
Ambito
networking

Direzione di ricerca

Start by reproducing on one Linux host: publish a port through the Docker API on /run/kiri/docker.sock, then compare ss -ltnp and tcpdump output for a loopback versus a remote connect. The report says the kiri process already holds the LISTEN socket in the init netns, so read the port-publishing and netns/iptables setup paths and check what the process does with accepted connections versus the kernel handshake. Also reproduce the restart and leaked-listener cases, and treat kiri diag report plus the manual MASQUERADE/FORWARD rules as the baseline for what done looks like.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

On Linux, containers with published ports are reachable from the host itself (loopback and the host's LAN IP), but not from any remote machine. The SYN arrives on the host's interface, kiri holds a LISTEN socket on 0.0.0.0:<port>, yet no SYN-ACK is ever sent and the client times out. Kernel sockets (sshd, docker-proxy) on the same hosts accept remote connections normally — only sockets held by the kiri process are affected.

This made kiri 0.2.2 unusable as a dockerd replacement on our servers; we rolled the fleet back to dockerd. Reporting with full diagnostics in case it helps.

Environment

  • kiri 0.2.2 (kiri-lite deb) on multiple hosts:
    • Debian 13, kernel 6.12.117+deb13-cloud-amd64 (VM)
    • Debian 13, kernel 6.12.107+deb13-cloud-amd64 (VM)
    • Proxmox host, kernel 7.0.14-14-pve, Debian 13 trixie
    • Arch Linux (rolling), Hyprland laptop
  • Docker CE installed but disabled during testing (systemctl disable --now docker.socket docker.service); its iptables rules flushed where present (iptables -t nat -F DOCKER) to rule out stale DNAT.
  • Firewalls checked: iptables INPUT policy ACCEPT, no drops on the test ports; nftables (single inet backend) shows only tailscale chains and our own test rules; no XDP/eBPF attached to interfaces; conntrack clean.

Reproduction

  1. Install kiri-lite on a Linux host with no other engine running.
  2. Run any container with a published port, e.g. the equivalent of docker run -d -p 8888:80 nginx (via the Docker API on /run/kiri/docker.sock).
  3. From the host itself: curl http://127.0.0.1:8888/ → 200 OK. curl http://<host-LAN-IP>:8888/ from the host also works.
  4. From another machine on the same LAN: curl http://<host-LAN-IP>:8888/ → connection times out.

Evidence

tcpdump on the receiving interface during a remote attempt (three curls from 192.168.1.188 to 192.168.1.55:8888):

21:34:44.167713 eth0  In  IP 192.168.1.188.57454 > 192.168.1.55.8888: Flags [S], seq 2847638399, win 64240, options [mss 1460,sackOK,TS ...], length 0
21:34:45.199470 eth0  In  IP 192.168.1.188.57454 > 192.168.1.55.8888: Flags [S], ...   (retransmits, 4 total)

Only SYNs in, zero replies of any kind out.

At the same moment, the socket state on the host:

LISTEN 0  1024  0.0.0.0:8888  0.0.0.0:*  users:(("kiri",pid=3128755,fd=84))
LISTEN 0  1024  [::]:8888     [::]:*     users:(("kiri",pid=3128755,fd=85))

The kiri process (pid=3128755) is in the init network namespace (verified: /proc/1/ns/net and /proc/<pid>/ns/net both net:[4026531840]). So the kernel should complete the handshake for any matching LISTEN socket. It does not.

Outbound NAT is also absent: kiri installs no MASQUERADE/FORWARD rules for its bridge subnets, so containers have no outbound connectivity at all until rules are added manually:

iptables -t nat -A POSTROUTING -s <kiri-subnet> ! -o <kiri-bridge> -j MASQUERADE
iptables -A FORWARD -i <kiri-bridge> -j ACCEPT
iptables -A FORWARD -o <kiri-bridge> -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

Secondary issues found in the same rollout

  1. Restarting a container wedges its published ports. docker restart <container> leaves the host ports dead afterwards (forwarding entry appears stale). Only compose up -d --force-recreate restores them.
  2. Leaked listeners. After a container publishing 127.0.0.1:443 was removed, kiri kept holding 127.0.0.1:443 and [::1]:443 listeners until the daemon was stopped — which then blocked other engines from binding those ports.

Status

Rolled back to dockerd everywhere; kiri 0.2.2 installed but disabled. Happy to re-enable kiri on a test host and run any diagnostics you need (kiri diag report, packet captures, experimental builds).

Lingua principale
Rust
Stelle
7.5k
Fork
329
Merge medio
14h 18m
PR unite (30g)
204

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libracoder/kiri

Tutte le issue di libracoder/kiri

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.