mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-18 21:11:08 +02:00
net-firewall/iptables: Apply the Flatcar patches
Signed-off-by: Sayan Chowdhury <sayan@kinvolk.io>
This commit is contained in:
parent
24c71442ab
commit
a00cc42b6b
@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Store and restore ip6tables firewall rules
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
Also=ip6tables-store.service
|
||||||
|
Also=ip6tables-restore.service
|
@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Store and restore iptables firewall rules
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
Also=iptables-store.service
|
||||||
|
Also=iptables-restore.service
|
@ -40,11 +40,10 @@ BDEPEND="${BUILD_DEPEND}
|
|||||||
virtual/yacc
|
virtual/yacc
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
|
# Flatcar: Drop BUILD_DEPEND, as we would not like to ship
|
||||||
|
# eselect in the final image
|
||||||
RDEPEND="${COMMON_DEPEND}
|
RDEPEND="${COMMON_DEPEND}
|
||||||
${BUILD_DEPEND}
|
|
||||||
nftables? ( net-misc/ethertypes )
|
nftables? ( net-misc/ethertypes )
|
||||||
!<net-firewall/ebtables-2.0.11-r1
|
|
||||||
!<net-firewall/arptables-0.0.5-r1
|
|
||||||
"
|
"
|
||||||
|
|
||||||
PATCHES=(
|
PATCHES=(
|
||||||
@ -120,12 +119,16 @@ src_install() {
|
|||||||
rm "${ED}"/etc/ethertypes || die
|
rm "${ED}"/etc/ethertypes || die
|
||||||
|
|
||||||
# Bugs 660886 and 669894
|
# Bugs 660886 and 669894
|
||||||
rm "${ED}"/sbin/{arptables,ebtables}{,-{save,restore}} || die
|
# Flatcar: We don't provide arptables* binaries.
|
||||||
|
# Flatcar: Keeping the ebtables binaries
|
||||||
|
rm "${ED}"/sbin/arptables{{,-{save,restore}},-nft{,-{save,restore}}} || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemd_dounit "${FILESDIR}"/systemd/iptables-{re,}store.service
|
# Flatcar: Gentoo upstream dropped the iptables & ip6tables services
|
||||||
|
# but we continue to ship them
|
||||||
|
systemd_dounit "${FILESDIR}"/systemd/iptables{,-{re,}store}.service
|
||||||
if use ipv6 ; then
|
if use ipv6 ; then
|
||||||
systemd_dounit "${FILESDIR}"/systemd/ip6tables-{re,}store.service
|
systemd_dounit "${FILESDIR}"/systemd/ip6tables{,-{re,}store}.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Move important libs to /lib #332175
|
# Move important libs to /lib #332175
|
||||||
@ -135,18 +138,20 @@ src_install() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkg_postinst() {
|
pkg_postinst() {
|
||||||
local default_iptables="xtables-legacy-multi"
|
# Flatcar: Use xtables-nft-multi to use the nft backend instead of legacy backend
|
||||||
|
local default_iptables="xtables-nft-multi"
|
||||||
if ! eselect iptables show &>/dev/null; then
|
if ! eselect iptables show &>/dev/null; then
|
||||||
elog "Current iptables implementation is unset, setting to ${default_iptables}"
|
elog "Current iptables implementation is unset, setting to ${default_iptables}"
|
||||||
eselect iptables set "${default_iptables}"
|
eselect iptables set "${default_iptables}"
|
||||||
fi
|
fi
|
||||||
|
# Flatcar: Drop the arptables, but retain the `for` structure in favor of lesser diff
|
||||||
|
# to upstream
|
||||||
if use nftables; then
|
if use nftables; then
|
||||||
local tables
|
local tables
|
||||||
for tables in {arp,eb}tables; do
|
for tables in ebtables; do
|
||||||
if ! eselect ${tables} show &>/dev/null; then
|
if ! eselect ${tables} show &>/dev/null; then
|
||||||
elog "Current ${tables} implementation is unset, setting to ${default_iptables}"
|
elog "Current ${tables} implementation is unset, setting to ${default_iptables}"
|
||||||
eselect ${tables} set xtables-nft-multi
|
eselect ${tables} set "${default_iptables}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -161,17 +166,6 @@ pkg_prerm() {
|
|||||||
if ! has_version 'net-firewall/ebtables'; then
|
if ! has_version 'net-firewall/ebtables'; then
|
||||||
elog "Unsetting ebtables symlinks before removal"
|
elog "Unsetting ebtables symlinks before removal"
|
||||||
eselect ebtables unset
|
eselect ebtables unset
|
||||||
elif [[ -z ${REPLACED_BY_VERSION} ]]; then
|
|
||||||
elog "Resetting ebtables symlinks to ebtables-legacy"
|
|
||||||
eselect ebtables set ebtables-legacy
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! has_version 'net-firewall/arptables'; then
|
|
||||||
elog "Unsetting arptables symlinks before removal"
|
|
||||||
eselect arptables unset
|
|
||||||
elif [[ -z ${REPLACED_BY_VERSION} ]]; then
|
|
||||||
elog "Resetting arptables symlinks to arptables-legacy"
|
|
||||||
eselect arptables set arptables-legacy
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# the eselect module failing should not be fatal
|
# the eselect module failing should not be fatal
|
||||||
|
@ -138,3 +138,6 @@ net-fs/samba -regedit
|
|||||||
|
|
||||||
# Drop extra dependencies
|
# Drop extra dependencies
|
||||||
sys-libs/ldb -lmdb -python
|
sys-libs/ldb -lmdb -python
|
||||||
|
|
||||||
|
# Enable nftables backend for the iptables instead of legacy backend
|
||||||
|
net-firewall/iptables nftables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user