diff options
Diffstat (limited to 'net-firewall')
-rw-r--r-- | net-firewall/Manifest.gz | bin | 4236 -> 4235 bytes | |||
-rw-r--r-- | net-firewall/nftables/Manifest | 5 | ||||
-rw-r--r-- | net-firewall/nftables/nftables-1.1.2.ebuild | 236 | ||||
-rw-r--r-- | net-firewall/nftables/nftables-9999.ebuild | 7 |
4 files changed, 245 insertions, 3 deletions
diff --git a/net-firewall/Manifest.gz b/net-firewall/Manifest.gz Binary files differindex af0b2c741c3a..5e9fa62f2490 100644 --- a/net-firewall/Manifest.gz +++ b/net-firewall/Manifest.gz diff --git a/net-firewall/nftables/Manifest b/net-firewall/nftables/Manifest index 506784f10fe5..b7b0bc4cddb6 100644 --- a/net-firewall/nftables/Manifest +++ b/net-firewall/nftables/Manifest @@ -10,7 +10,10 @@ AUX systemd/nftables-restore.service 394 BLAKE2B 1c1f358eb2eff789e68c051098c971f AUX systemd/nftables-store.service 234 BLAKE2B bc28a2495df40258ee7d665b3b64ba425b4d9780812896a47b216bbb63651b06aaa8aa26b0b9c8b55c39e8dd3aa15e5f1b19eed62d028fb5be3de28b9dbee75c SHA512 329e89e287700c945ac6a6cfd1232f0d411709cab9730e3dac3eb5dc6f4b19c736276e88837e7cb3866391d6bc2ca88092d910ac911b1195a78824360d615f77 DIST nftables-1.1.1.tar.xz 989700 BLAKE2B f273c78369ba755049c6afa63eba195cf29f926fa8fc9bf344022904c00a8c6c4259cc5093e23993a55fd25790af575305df79a7c28624fa7082661b2eed70d0 SHA512 676413d4adadffb15d52c1f8f6432636cab83a7bcda1a18d9f0e6b58819a2c027a49922588c02bd9ad386de930eaa697bfe74c0938b595bf1ee485bfa7cf2e50 DIST nftables-1.1.1.tar.xz.sig 566 BLAKE2B b7debda3373972f69af9b4b23e1b66a8fd156440187aafba605bb7342c267207e5aa628256e96432ebd4583a6a9436e1969a33636111d2bd8d57185a01e2d502 SHA512 fc23034c512f686167203e827ff2a8f7cb64530211ce92a28793bd49577ce3bf519ffbe910b0071cb21925898497cb5cbf70121c68bfcdbfa4460c63a14203ac +DIST nftables-1.1.2.tar.xz 1035116 BLAKE2B caa8e8fecb7a832a316ee3cbcf6726dd9774a28bf92f24ac3b331a4ce4d3222a038a5688396c12bc2d63f9a96f9961b6f5b1f476488480d09174b7ba3325527a SHA512 b43f1a7773bf8a14d6599f479bab7fc8763bf9c011b487f98b8f52f10d4b84cfe9ebc1a5fcc3dfa84ac891582bbdc761cb294c0b90181cc2ba5d9e98b058c436 +DIST nftables-1.1.2.tar.xz.sig 566 BLAKE2B 79892fc481a1bc7b3adea25c86140221225f8cd615cea5c90c445f3e60d30f32cf5ed54ae45e8fe8228d1cde71daabb9632bb71e55703b7e205f66fe37cedc34 SHA512 578017e2dc1288c6c705e5554c200e5c9e234529609063ffc8ef125a3342488dae61ff30b0361f81e135a396e05c553c4a7d1f5ee8beb7bff3016b09b920a6f9 EBUILD nftables-1.1.1-r1.ebuild 6642 BLAKE2B c7e2678d081aeeba12636cf582b781567e1bec29214a485b5178b710da2d71c64aea7c29fe8dd7e2b77fbf3f4afac87ad135894fe6d9ff9739b61b5297f97d10 SHA512 08c9b366ff6dbf9a219ee13398cd3d123fb611e362291398d550d0876e75e95ce0dbb498be19e1e49d884ca9b57260277c414e440d2c12a5d97aa6f26def3bad EBUILD nftables-1.1.1.ebuild 6474 BLAKE2B 0dd1ea43c50c38c9058874298f465e8773332c5e929b161d25edc166a0e00efc46b499e807885e837308fcbeddb4994282907f668f80fb4dcea696d4e54d10e7 SHA512 14e2a76d0e435b497ad20ed8d0316c4efb9e6711b77fa58a5bae172b0c9ef0e96e23735ad48662befb99f64916bdc18282e257edde4e4a70237c3cd520f231e2 -EBUILD nftables-9999.ebuild 6642 BLAKE2B c7e2678d081aeeba12636cf582b781567e1bec29214a485b5178b710da2d71c64aea7c29fe8dd7e2b77fbf3f4afac87ad135894fe6d9ff9739b61b5297f97d10 SHA512 08c9b366ff6dbf9a219ee13398cd3d123fb611e362291398d550d0876e75e95ce0dbb498be19e1e49d884ca9b57260277c414e440d2c12a5d97aa6f26def3bad +EBUILD nftables-1.1.2.ebuild 6690 BLAKE2B bf5759f484a1dcda3083847dd832d94eb87162dae045627342daabcee2b8727f7573cf7c8a4f0276e33d55fd27104bb56b2bf6a3378f79db7bf417b1f9841580 SHA512 f105aad8b4fe3cd1df569cb9889d4f402692d933f3f8954e157f58367018a4ed4e9c134c799be1af8cfba1be688eb92fa8104b9c771ffb8677bc3331eecc00dd +EBUILD nftables-9999.ebuild 6690 BLAKE2B bf5759f484a1dcda3083847dd832d94eb87162dae045627342daabcee2b8727f7573cf7c8a4f0276e33d55fd27104bb56b2bf6a3378f79db7bf417b1f9841580 SHA512 f105aad8b4fe3cd1df569cb9889d4f402692d933f3f8954e157f58367018a4ed4e9c134c799be1af8cfba1be688eb92fa8104b9c771ffb8677bc3331eecc00dd MISC metadata.xml 684 BLAKE2B 96044107a07596178b59f3d4bed0433e06eb74693fafcc1a8c20468e02626814ba1544bba54c64367e43a126463b0f3b33e340476aff15db934467e8b9d46bf7 SHA512 fa4c9cadddccda4217837a892fbec3e1b984fb18a4d11d5536f22724d2455724eb59c5cc06da5830fb28bb48cb2d01374fdc56e216296c695c678af28390392a diff --git a/net-firewall/nftables/nftables-1.1.2.ebuild b/net-firewall/nftables/nftables-1.1.2.ebuild new file mode 100644 index 000000000000..8e90c611107c --- /dev/null +++ b/net-firewall/nftables/nftables-1.1.2.ebuild @@ -0,0 +1,236 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_OPTIONAL=1 +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..13} ) +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/netfilter.org.asc +inherit eapi9-ver edo linux-info distutils-r1 systemd verify-sig + +DESCRIPTION="Linux kernel firewall, NAT and packet mangling tools" +HOMEPAGE="https://netfilter.org/projects/nftables/" + +if [[ ${PV} =~ ^[9]{4,}$ ]]; then + inherit autotools git-r3 + EGIT_REPO_URI="https://git.netfilter.org/${PN}" + BDEPEND="app-alternatives/yacc" +else + inherit libtool + SRC_URI=" + https://netfilter.org/projects/nftables/files/${P}.tar.xz + verify-sig? ( https://netfilter.org/projects/nftables/files/${P}.tar.xz.sig ) + " + KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" + BDEPEND="verify-sig? ( >=sec-keys/openpgp-keys-netfilter-20240415 )" +fi + +# See COPYING: new code is GPL-2+, existing code is GPL-2 +LICENSE="GPL-2 GPL-2+" +SLOT="0/1" +IUSE="debug doc +gmp json libedit python +readline static-libs test xtables" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=net-libs/libmnl-1.0.4:= + >=net-libs/libnftnl-1.2.9:= + gmp? ( dev-libs/gmp:= ) + json? ( dev-libs/jansson:= ) + python? ( ${PYTHON_DEPS} ) + readline? ( sys-libs/readline:= ) + xtables? ( >=net-firewall/iptables-1.6.1:= ) +" +DEPEND="${RDEPEND}" +BDEPEND+=" + app-alternatives/lex + virtual/pkgconfig + doc? ( + app-text/asciidoc + >=app-text/docbook2X-0.8.8-r4 + ) + python? ( ${DISTUTILS_DEPS} ) +" + +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + libedit? ( !readline ) +" + +src_prepare() { + default + + if [[ ${PV} =~ ^[9]{4,}$ ]] ; then + eautoreconf + else + elibtoolize + fi + + if use python; then + pushd py >/dev/null || die + distutils-r1_src_prepare + popd >/dev/null || die + fi +} + +src_configure() { + local myeconfargs=( + --sbindir="${EPREFIX}"/sbin + $(use_enable debug) + $(use_enable doc man-doc) + $(use_with !gmp mini_gmp) + $(use_with json) + $(use_with libedit cli editline) + $(use_with readline cli readline) + $(use_enable static-libs static) + $(use_with xtables) + ) + + econf "${myeconfargs[@]}" + + if use python; then + pushd py >/dev/null || die + distutils-r1_src_configure + popd >/dev/null || die + fi +} + +src_compile() { + default + + if use python; then + pushd py >/dev/null || die + distutils-r1_src_compile + popd >/dev/null || die + fi +} + +src_test() { + emake check + + if [[ ${EUID} == 0 ]]; then + edo tests/shell/run-tests.sh -v + else + ewarn "Skipping shell tests (requires root)" + fi + + if use python; then + pushd tests/py >/dev/null || die + distutils-r1_src_test + popd >/dev/null || die + fi +} + +python_test() { + if [[ ${EUID} == 0 ]]; then + edo "${EPYTHON}" nft-test.py + else + ewarn "Skipping Python tests (requires root)" + fi +} + +src_install() { + default + + if ! use doc && [[ ! ${PV} =~ ^[9]{4,}$ ]]; then + pushd doc >/dev/null || die + doman *.? + popd >/dev/null || die + fi + + # Do it here instead of in src_prepare to avoid eautoreconf + # rmdir lets us catch if more files end up installed in /etc/nftables + dodir /usr/share/doc/${PF}/skels/ + mv "${ED}"/etc/nftables/osf "${ED}"/usr/share/doc/${PF}/skels/osf || die + rmdir "${ED}"/etc/nftables || die + + exeinto /usr/libexec/${PN} + newexe "${FILESDIR}"/libexec/${PN}-mk.sh ${PN}.sh + newconfd "${FILESDIR}"/${PN}-mk.confd ${PN} + newinitd "${FILESDIR}"/${PN}-mk.init-r1 ${PN} + keepdir /var/lib/nftables + + systemd_dounit "${FILESDIR}"/systemd/${PN}-load.service + systemd_dounit "${FILESDIR}"/systemd/${PN}-store.service + + if use python ; then + pushd py >/dev/null || die + distutils-r1_src_install + popd >/dev/null || die + fi + + find "${ED}" -type f -name "*.la" -delete || die +} + +pkg_preinst() { + local stderr + + # There's a history of regressions with nftables upgrades. Perform a + # safety check to help us spot them earlier. For the check to pass, the + # currently loaded ruleset, if any, must be successfully evaluated by + # the newly built instance of nft(8). + if [[ -n ${ROOT} ]] || [[ ! -d /sys/module/nftables ]] || [[ ! -x /sbin/nft ]]; then + # Either nftables isn't yet in use or nft(8) cannot be executed. + return + elif ! stderr=$(umask 177; /sbin/nft -t list ruleset 2>&1 >"${T}"/ruleset.nft); then + # Report errors induced by trying to list the ruleset but don't + # treat them as being fatal. + printf '%s\n' "${stderr}" >&2 + elif [[ ${stderr} == *"is managed by iptables-nft"* ]]; then + # Rulesets generated by iptables-nft are special in nature and + # will not always be printed in a way that constitutes a valid + # syntax for ntf(8). Ignore them. + return + elif set -- "${ED}"/usr/lib*/libnftables.so; + ! LD_LIBRARY_PATH=${1%/*} "${ED}"/sbin/nft -c -f -- "${T}"/ruleset.nft + then + eerror "Your currently loaded ruleset cannot be parsed by the newly built instance of" + eerror "nft. This probably means that there is a regression introduced by v${PV}." + eerror "(To make the ebuild fail instead of warning, set NFTABLES_ABORT_ON_RELOAD_FAILURE=1.)" + if [[ -n ${NFTABLES_ABORT_ON_RELOAD_FAILURE} ]] ; then + die "Aborting because of failed nft reload!" + fi + fi +} + +pkg_postinst() { + local save_file + save_file="${EROOT}"/var/lib/nftables/rules-save + + # In order for the nftables-load systemd service to start + # the save_file must exist. + if [[ ! -f "${save_file}" ]]; then + ( umask 177; touch "${save_file}" ) + elif [[ $(( "$( stat --printf '%05a' "${save_file}" )" & 07177 )) -ne 0 ]]; then + ewarn "Your system has dangerous permissions for ${save_file}" + ewarn "It is probably affected by bug #691326." + ewarn "You may need to fix the permissions of the file. To do so," + ewarn "you can run the command in the line below as root." + ewarn " 'chmod 600 \"${save_file}\"'" + fi + + if has_version 'sys-apps/systemd'; then + if ver_replacing -lt "1.1.1-r1"; then + elog "Starting with ${PN}-1.1.1-r1, the ${PN}-restore.service has" + elog "been split into ${PN}-load.service and ${PN}-store.service." + elog + fi + elog "If you wish to enable the firewall rules on boot (on systemd) you" + elog "will need to enable the nftables-load service." + elog " 'systemctl enable ${PN}-load.service'" + elog + elog "Enable nftables-store.service if you want firewall rules to be" + elog "saved at shutdown." + fi + + if has_version 'sys-apps/openrc'; then + elog "If you wish to enable the firewall rules on boot (on openrc) you" + elog "will need to enable the nftables service." + elog " 'rc-update add ${PN} default'" + elog + elog "If you are creating or updating the firewall rules and wish to save" + elog "them to be loaded on the next restart, use the \"save\" functionality" + elog "in the init script." + elog " 'rc-service ${PN} save'" + fi +} diff --git a/net-firewall/nftables/nftables-9999.ebuild b/net-firewall/nftables/nftables-9999.ebuild index 14a775b021a2..8e90c611107c 100644 --- a/net-firewall/nftables/nftables-9999.ebuild +++ b/net-firewall/nftables/nftables-9999.ebuild @@ -17,12 +17,13 @@ if [[ ${PV} =~ ^[9]{4,}$ ]]; then EGIT_REPO_URI="https://git.netfilter.org/${PN}" BDEPEND="app-alternatives/yacc" else + inherit libtool SRC_URI=" https://netfilter.org/projects/nftables/files/${P}.tar.xz verify-sig? ( https://netfilter.org/projects/nftables/files/${P}.tar.xz.sig ) " KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86" - BDEPEND="verify-sig? ( sec-keys/openpgp-keys-netfilter )" + BDEPEND="verify-sig? ( >=sec-keys/openpgp-keys-netfilter-20240415 )" fi # See COPYING: new code is GPL-2+, existing code is GPL-2 @@ -33,7 +34,7 @@ RESTRICT="!test? ( test )" RDEPEND=" >=net-libs/libmnl-1.0.4:= - >=net-libs/libnftnl-1.2.8:= + >=net-libs/libnftnl-1.2.9:= gmp? ( dev-libs/gmp:= ) json? ( dev-libs/jansson:= ) python? ( ${PYTHON_DEPS} ) @@ -61,6 +62,8 @@ src_prepare() { if [[ ${PV} =~ ^[9]{4,}$ ]] ; then eautoreconf + else + elibtoolize fi if use python; then |