Skip to content

Commit af7b9d5

Browse files
G4614claude
andcommitted
fix(config): trim container kernel config to what dockerd actually uses
Drop the duplicate CONFIG_NETFILTER_XT_MATCH_IPVS line, the legacy IP_NF_*/IP6_NF_TARGET_MASQUERADE/MANGLE netfilter backend, IP_VS, NF_CONNTRACK_PROCFS, NF_LOG_SYSLOG, and the unused XT_MATCH_MULTIPORT/ PHYSDEV/STATE matches. Verified against a running dockerd + docker compose (bridge network, published port, embedded DNS): every rule dockerd installs lands in the nftables backend via NFT_COMPAT, the raw table stays empty, and none of the removed matches/legacy tables ever register. IP6_NF_IPTABLES/FILTER/NAT stay, since dockerd's default ip6tables scaffolding does write real rules there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 0538bd4 commit af7b9d5

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
diff --git a/config-libkrunfw-container_x86_64 b/config-libkrunfw-container_x86_64
22
--- a/config-libkrunfw-container_x86_64
33
+++ b/config-libkrunfw-container_x86_64
4-
@@ -2409,1 +2409,56 @@
4+
@@ -2409,1 +2409,55 @@
55
# end of Kernel hacking
66
+
77
+# Container runtime support on top of the lean profile. Everything is built in
88
+# (=y) because the guest has no /lib/modules and cannot load modules at runtime.
9+
+#
10+
+# Only the nftables backend is enabled. Docker/Podman on Alpine and Debian both
11+
+# default to iptables-nft (xtables-nft-multi), and dockerd's own entrypoint
12+
+# probe only falls back to the legacy ip_tables/ip6_tables backend when it
13+
+# finds pre-existing legacy rules or nft fails outright. Verified empirically
14+
+# against a running dockerd + docker compose (bridge network, published port,
15+
+# embedded DNS): every rule dockerd installs lands in the nftables ip/ip6
16+
+# tables via CONFIG_NFT_COMPAT (visible as "xt match"/"xt target" in `nft -a
17+
+# list ruleset`), and the legacy CONFIG_IP_NF_*/CONFIG_IP6_NF_* backend never
18+
+# registers a single table (/proc/net/ip_tables_names stays empty). Keeping
19+
+# both backends compiled in is dead weight at best; at worst it makes the
20+
+# backend dockerd picks depend on incidental kernel config (any legacy table
21+
+# ever registering flips dockerd to legacy, silently disabling everything
22+
+# below), and nf_tables is one of the most-exploited local-privesc surfaces in
23+
+# recent kernels. Everything below was cross-checked against the same running
24+
+# setup for actual use.
925
+CONFIG_BRIDGE=y
1026
+CONFIG_BRIDGE_NETFILTER=y
1127
+CONFIG_LLC=y
1228
+CONFIG_STP=y
1329
+CONFIG_NETFILTER=y
1430
+CONFIG_NETFILTER_ADVANCED=y
1531
+CONFIG_NF_CONNTRACK=y
16-
+CONFIG_NF_CONNTRACK_PROCFS=y
17-
+CONFIG_NF_LOG_SYSLOG=y
1832
+CONFIG_NETFILTER_XTABLES=y
1933
+CONFIG_NETFILTER_XT_MARK=y
2034
+CONFIG_NETFILTER_XT_CONNMARK=y
@@ -23,22 +37,12 @@ diff --git a/config-libkrunfw-container_x86_64 b/config-libkrunfw-container_x86_
2337
+CONFIG_NETFILTER_XT_NAT=y
2438
+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
2539
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
26-
+CONFIG_NETFILTER_XT_MATCH_IPVS=y
27-
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
28-
+CONFIG_NETFILTER_XT_MATCH_PHYSDEV=y
2940
+CONFIG_NF_NAT=y
3041
+CONFIG_NF_NAT_REDIRECT=y
3142
+CONFIG_NF_NAT_MASQUERADE=y
32-
+CONFIG_IP_NF_IPTABLES=y
33-
+CONFIG_IP_NF_FILTER=y
34-
+CONFIG_IP_NF_NAT=y
35-
+CONFIG_IP_NF_TARGET_MASQUERADE=y
36-
+CONFIG_IP_NF_MANGLE=y
3743
+CONFIG_IP6_NF_IPTABLES=y
3844
+CONFIG_IP6_NF_FILTER=y
3945
+CONFIG_IP6_NF_NAT=y
40-
+CONFIG_IP6_NF_TARGET_MASQUERADE=y
41-
+CONFIG_IP6_NF_MANGLE=y
4246
+CONFIG_NF_TABLES=y
4347
+CONFIG_NF_TABLES_INET=y
4448
+CONFIG_NF_TABLES_IPV4=y
@@ -50,14 +54,6 @@ diff --git a/config-libkrunfw-container_x86_64 b/config-libkrunfw-container_x86_
5054
+CONFIG_NFT_REJECT=y
5155
+CONFIG_NFT_CHAIN_NAT=y
5256
+CONFIG_NFT_COMPAT=y
53-
+CONFIG_IP_NF_TARGET_REJECT=y
54-
+CONFIG_IP6_NF_TARGET_REJECT=y
55-
+CONFIG_NETFILTER_XT_MATCH_STATE=y
5657
+CONFIG_NET_NS=y
5758
+CONFIG_POSIX_MQUEUE=y
58-
+# Docker's contrib/check-config.sh also lists these as necessary.
59-
+CONFIG_IP_NF_RAW=y
60-
+CONFIG_IP6_NF_RAW=y
61-
+CONFIG_IP_VS=y
62-
+CONFIG_NETFILTER_XT_MATCH_IPVS=y
6359
+CONFIG_EXT4_FS_POSIX_ACL=y

0 commit comments

Comments
 (0)