4 Commits

Author SHA1 Message Date
gyurix
d5757e623a Refactor iptables chain detection to centralize and default to DOCKER-USER
continuous-integration/drone/push Build is passing
Move chain detection logic from firewall to iptables manager for better encapsulation. The manager now auto-detects both the iptables binary and chain (DOCKER-USER or FORWARD) based on the presence of the Docker-managed chain, but always defaults to DOCKER-USER for consistency. This simplifies firewall code and ensures proper Docker integration regardless of iptables version.
2026-06-16 12:46:25 +02:00
gyurix
246346f8b1 feat(docker, firewall): Add stateful network connection check and optimize NAT rules
continuous-integration/drone/push Build is passing
This adds an IsConnected method to verify if a container is already connected to a network with the expected IP, preventing redundant operations. In reconcileIPs, it skips reconnections if the state is correct. In applyNATRule, MASQUERADE is now applied in the same namespace as DNAT (container or host) for consistent and accurate rule application.
2026-06-15 23:39:58 +02:00
gyurix
aac9b83576 feat(network-go): add fuzzy container name resolution for firewall connections
continuous-integration/drone/push Build is passing
Implement FindContainerName method on DockerAPI that attempts exact match
first, then falls back to prefix-based matching (e.g., extracting prefix
before dash like "service-" in "service-abc") to replicate the old shell
script's `grep $D"-"` behavior. Update firewall orchestrator to use this
resolution before connecting containers to networks, improving robustness
when container names vary from configured selectors.
2026-06-15 14:58:29 +02:00
gyurix
fcda599ec7 added test go implementation
continuous-integration/drone/push Build encountered an error
2026-06-08 17:02:13 +02:00