Commit Graph

115 Commits

Author SHA1 Message Date
gyurix
27607d1a2e feat: add logging to Docker and iptables operations, fix iptables path
continuous-integration/drone/push Build is passing
- Create /var/log/network-go directory in Dockerfile for log storage
- Add comprehensive logging to Docker client creation, network management, and container operations
- Add logging to iptables rule management (list, delete, etc.)
- Fix iptables executable path resolution in deleteMatchingLinesInContainer to use configured binary path
2026-06-15 17:05:53 +02:00
gyurix
3172023254 fix: update iptables binary paths to use /usr/sbin instead of /sbin
continuous-integration/drone/push Build is passing
Standardize iptables paths across firewall scripts and Go code to ensure compatibility with systems where iptables is located in /usr/sbin. This affects both legacy and non-legacy iptables binaries.
2026-06-15 16:34:24 +02:00
gyurix
2d6e22b9e6 fix(network-go): handle reconnection gracefully and fix DNAT rule issues
continuous-integration/drone/push Build is passing
- Ignore "endpoint already exists" error in ConnectContainer on re-reconciliation
- Improve iptables comment generation to avoid trailing dashes
- Enhance DNAT rule logic: try multiple selectors and fall back to host rules
- Add missing "-t nat" flag in InsertPreroutingRuleOnInterface
2026-06-15 16:12:08 +02:00
gyurix
6c19e22deb refactor(docker): switch container lookup to use filtered ContainerList
continuous-integration/drone/push Build is passing
Replace ContainerInspect with ContainerList and name filters for exact and prefix matching. This improves efficiency and correctness by leveraging Docker's filtering capabilities, matching the old shell script's grep behavior more accurately. Add regexp import to properly escape container names in filters.
2026-06-15 15:25:38 +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
c6ae1748cf fix: warn instead of error when IP forwarding fails in containers
continuous-integration/drone/push Build is passing
Downgrade the IP forwarding failure from an error to a warning,
as this is expected in containers with a read-only filesystem.
IP forwarding should be set at the host level, not inside a container.
Update comments to reflect this expectation and improve log clarity.
2026-06-15 12:21:12 +02:00
gyurix
e5e19835f9 fix: use prefix matching instead of dash stripping for container resolution
continuous-integration/drone/push Build is passing
The previous logic stripped dashes from both the lookup name and container/selector names, performing an exact match after removal. This failed for cases like "wireguardproxy-client" matching "wireguardproxyclient" or "app-1"/"app-2" matching "app-x", because the dash removal produced different strings.

Change to extract the prefix before the first dash in the lookup name, then match it against the beginning of container/selector names. This preserves the intended relationship while allowing matching of dashed variants with prefix-based patterns.
2026-06-15 12:00:26 +02:00
gyurix
f9513cd98a fix(resolver): strip all dashes when matching container names
continuous-integration/drone/push Build is failing
Instead of prefix matching on the part before the first dash, now strip
all dashes from both the lookup name and the stored container/selector
names and compare exactly. This improves matching accuracy for names
containing multiple dashes or dashes in varying positions.
2026-06-15 11:55:00 +02:00
gyurix
dea2fca7fb removed nsenter from Dockerfile install
continuous-integration/drone/push Build is passing
2026-06-12 09:18:53 +02:00
gyurix
ca29a9cce0 updated go related dockerfile
continuous-integration/drone/push Build is failing
2026-06-12 09:15:10 +02:00
gyurix
a483e5bb5f changed workspace path
continuous-integration/drone/push Build is failing
2026-06-12 09:11:56 +02:00
gyurix
7c6009bfa5 updated drone file node selector
continuous-integration/drone/push Build is failing
2026-06-12 09:09:17 +02:00
gyurix
e990ecfeb4 updated drone steps
continuous-integration/drone/push Build was killed
2026-06-12 09:07:00 +02:00
gyurix
154de77259 added network go cicd pipeline
continuous-integration/drone/push Build was killed
2026-06-12 09:04:46 +02:00
gyurix
fcda599ec7 added test go implementation
continuous-integration/drone/push Build encountered an error
2026-06-08 17:02:13 +02:00
gyurix
a555cce680 reconfigured the network stack and modified readme file
continuous-integration/drone/push Build encountered an error
2026-06-08 16:37:44 +02:00
gyurix
c3de398f35 added network-go project
continuous-integration/drone/push Build encountered an error
2026-06-08 15:34:01 +02:00
gyurix
9271f63dd9 remove nftables installation from Dockerfile and clean up firewall-add script
continuous-integration/drone/push Build is passing
2025-11-18 23:21:31 +01:00
gyurix
e21011bec1 update node selector in Drone configuration and add nftables to Dockerfile
continuous-integration/drone/push Build is passing
2025-11-18 12:50:45 +01:00
gyurix
4631bccf6c refactor iptables handling for improved compatibility across operating systems
continuous-integration/drone/push Build is passing
2025-03-05 18:26:14 +01:00
7753178b07 update to multiarch
continuous-integration/drone/push Build is passing
2025-03-05 15:03:33 +01:00
d4f2a46b71 update to multiarch 2025-03-05 15:00:14 +01:00
8fb4b17fda update to multiarch 2025-03-05 14:59:15 +01:00
f9022cbdff checked iptables variant for multiple operating systems 2024-08-19 16:04:30 +02:00
6570137e42 IP check correction 2023-10-16 02:35:06 +00:00
a2301e7172 added double quote character for awk parsing first colums 2023-10-16 02:02:48 +00:00
Gyorgy Berenyi
de23694368 Update 'firewall/firewall-add'
Added debug lines into files
2023-08-23 08:31:35 +00:00
Gyorgy Berenyi
12ce6a9fa3 Update 'firewall/firewall-add'
Correcting OPERATION value prcessing
2023-08-20 12:46:15 +00:00
05e30e8bf3 Added delete firewall rule option 2023-08-20 07:56:32 +00:00
e0fc5e22b2 -n was added 2023-06-05 13:09:32 +00:00
92f34fb9e2 syntax fix 2023-05-15 07:04:11 +00:00
18c275bf73 ports in pair 2023-05-15 06:50:22 +00:00
46fde8a19f Check TARGET IP and TARGET PORT exist 2023-04-27 12:05:27 +00:00
c57549e032 Introduced SOURCE_IFACE variable 2023-04-27 11:59:15 +00:00
fa8de49a28 Introduced SOURCE_IFACE variable 2023-04-27 10:44:43 +00:00
5825811547 Remove uneccessary lines 2023-03-12 11:47:47 +00:00
2ad946f90b Commented IP set when them not exist 2023-03-12 11:42:09 +00:00
83e1291943 Replace iptables to iptables-legacy when NSENTER presents 2023-03-12 11:15:07 +00:00
9bb484b9bb Filter when not all the variables exist for prerouting rulesx 2023-03-12 11:04:12 +00:00
191638456e Changing IPTABLES variable to correct iptables bin 2023-03-12 10:49:27 +00:00
7cce2b5394 Complete firewall in case of network defined in rules 2023-03-08 20:53:13 +00:00
05aacbba3c Check how many APP_IP presents when examine IP addresses 2023-02-13 11:28:59 +00:00
041f9ea00e revert firewall base to 1.8.7 2023-02-03 11:49:57 +00:00
a56032cbc4 fix 2023-02-03 11:21:24 +00:00
6c4f16d95f fix 2023-02-03 11:17:24 +00:00
f09f06764a remove all matching selectors and all selctors followed by "-" 2023-02-03 11:09:04 +00:00
dac7a093b5 Added selector based firewall rules creating 2023-01-25 08:57:27 +00:00
8386c2aa65 Added exit line when running processes numbers are less then expected 2022-12-27 09:08:34 +00:00
4ad3a0e7e5 Added exit line when running processes numbers are less then expected 2022-12-27 09:03:40 +00:00
Gyorgy Berenyi
ec2f7480b3 Update 'Dockerfile'
Copy the whole directory content
2022-12-27 08:43:14 +00:00