Skip to content

Commit e1b55c3

Browse files
committed
Remove iptables support
Code and documentation changes to remove the support of iptables as a firewall driver. Signed-off-by: Mario Loriedo <[email protected]>
1 parent 2d4a788 commit e1b55c3

File tree

20 files changed

+18
-2156
lines changed

20 files changed

+18
-2156
lines changed

Cargo.lock

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ anyhow = "1.0.93"
3737
clap = { version = "~4.5.51", features = ["derive", "env"] }
3838
env_logger = "0.11.8"
3939
ipnet = { version = "2.11.0", features = ["serde"] }
40-
iptables = "0.6.0"
4140
libc = "0.2.157"
4241
log = "0.4.28"
4342
serde = { version = "1.0.228", features = ["derive"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Netavark is a tool for configuring networking for Linux containers. Its features
1010
* Configuration of container networks via JSON configuration file
1111
* Creation and management of required network interfaces, including MACVLAN networks
1212
* All required firewall configuration to perform NAT and port forwarding as required for containers
13-
* Support for iptables, firewalld and nftables
13+
* Support for firewalld and nftables
1414
* Support for rootless containers
1515
* Support for IPv4 and IPv6
1616
* Support for container DNS resolution via the [aardvark-dns](https://github.com/containers/aardvark-dns) project

build.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,16 @@ fn main() {
6464
println!("cargo:rustc-env=GIT_COMMIT={commit}");
6565

6666
// Handle default firewall driver.
67-
// Allowed values "nftables" and "iptables".
67+
// Allowed values "nftables" and "none".
6868
let fwdriver = match env::var("NETAVARK_DEFAULT_FW")
69-
.unwrap_or("iptables".to_string())
69+
.unwrap_or("nftables".to_string())
7070
.as_str()
7171
{
7272
"nftables" => "nftables",
73-
"iptables" => "iptables",
7473
"none" => "none",
7574
inv => panic!("Invalid default firewall driver {inv}"),
7675
};
77-
println!("cargo:rustc-check-cfg=cfg(default_fw, values(\"nftables\", \"iptables\", \"none\"))");
76+
println!("cargo:rustc-check-cfg=cfg(default_fw, values(\"nftables\", \"none\"))");
7877
println!("cargo:rustc-cfg=default_fw=\"{fwdriver}\"");
7978
println!("cargo:rustc-env=DEFAULT_FW={fwdriver}");
8079
}

docs/netavark-firewalld.7.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ netavark-firewalld - description of the interaction of Netavark and firewalld
99
## Description
1010

1111
Netavark can be used on systems with firewalld enabled without issue.
12-
When using the default `nftables` or `iptables` firewall drivers, on systems where firewalld is running, firewalld will automatically be configured to allow connectivity to Podman containers.
12+
When using the default `nftables` firewall driver, on systems where firewalld is running, firewalld will automatically be configured to allow connectivity to Podman containers.
1313
All subnets of Podman-managed networks will be automatically added to the `trusted` zone to allow this access.
1414

1515
### Firewalld Driver

rpm/netavark.spec

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@
1414
# Minimum X.Y dep for aardvark-dns
1515
%define major_minor %((v=%{version}; echo ${v%.*}))
1616

17-
# Set default firewall to nftables on CentOS Stream 10+, RHEL 10+, Fedora 41+
18-
# and default to iptables on all other environments
19-
# The `rhel` macro is defined on CentOS Stream, RHEL as well as Fedora ELN.
20-
%if (%{defined rhel} && 0%{?rhel} >= 10) || (%{defined fedora} && 0%{?fedora} >= 41)
21-
%define default_fw nftables
22-
%else
23-
%define default_fw iptables
24-
%endif
25-
2617
Name: netavark
2718
# Set a different Epoch for copr builds
2819
%if %{defined copr_username}
@@ -49,11 +40,7 @@ BuildRequires: %{_bindir}/go-md2man
4940
# aardvark-dns and %%{name} are usually released in sync
5041
Requires: aardvark-dns >= %{epoch}:%{major_minor}
5142
Provides: container-network-stack = 2
52-
%if "%{default_fw}" == "nftables"
5343
Requires: nftables
54-
%else
55-
Requires: iptables
56-
%endif
5744
BuildRequires: make
5845
BuildRequires: protobuf-c
5946
BuildRequires: protobuf-compiler
@@ -82,7 +69,7 @@ Its features include:
8269
including MACVLAN networks
8370
* All required firewall configuration to perform NAT and port
8471
forwarding as required for containers
85-
* Support for iptables, firewalld and nftables
72+
* Support for firewalld and nftables
8673
* Support for rootless containers
8774
* Support for IPv4 and IPv6
8875
* Support for container DNS resolution via aardvark-dns.

src/firewall/fwnone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::network::internal_types::{
44
PortForwardConfig, SetupNetwork, TearDownNetwork, TeardownPortForward,
55
};
66

7-
// Iptables driver - uses direct iptables commands via the iptables crate.
7+
// Fwnone driver - No-op firewall implementation.
88
pub struct Fwnone {}
99

1010
pub fn new() -> NetavarkResult<Box<dyn firewall::FirewallDriver>> {

src/firewall/iptables.rs

Lines changed: 0 additions & 218 deletions
This file was deleted.

0 commit comments

Comments
 (0)