You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
3.6 KiB
139 lines
3.6 KiB
7 years ago
|
# Copyright 1999-2017 Gentoo Foundation
|
||
9 years ago
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
|
||
8 years ago
|
EAPI=6
|
||
9 years ago
|
|
||
8 years ago
|
# Python extension supports only Python 2.
|
||
9 years ago
|
# See https://github.com/mrash/fwknop/issues/167
|
||
9 years ago
|
PYTHON_COMPAT=( python2_7 )
|
||
8 years ago
|
DISTUTILS_OPTIONAL=1
|
||
9 years ago
|
|
||
8 years ago
|
inherit autotools distutils-r1 eutils linux-info readme.gentoo-r1 systemd
|
||
9 years ago
|
|
||
|
DESCRIPTION="Single Packet Authorization and Port Knocking application"
|
||
8 years ago
|
HOMEPAGE="https://www.cipherdyne.org/fwknop/ https://github.com/mrash/fwknop"
|
||
9 years ago
|
SRC_URI="https://github.com/mrash/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
|
||
|
|
||
8 years ago
|
LICENSE="GPL-2+"
|
||
9 years ago
|
SLOT="0"
|
||
|
KEYWORDS="~amd64 ~x86"
|
||
7 years ago
|
IUSE="+client extras firewalld gdbm gpg +iptables nfqueue python +server udp-server"
|
||
9 years ago
|
|
||
9 years ago
|
DEPEND="
|
||
9 years ago
|
client? ( net-misc/wget[ssl] )
|
||
9 years ago
|
firewalld? ( net-firewall/firewalld[${PYTHON_USEDEP}] )
|
||
|
gdbm? ( sys-libs/gdbm )
|
||
9 years ago
|
gpg? (
|
||
9 years ago
|
app-crypt/gpgme
|
||
9 years ago
|
dev-libs/libassuan
|
||
|
dev-libs/libgpg-error
|
||
9 years ago
|
)
|
||
9 years ago
|
iptables? ( net-firewall/iptables )
|
||
8 years ago
|
nfqueue? ( net-libs/libnetfilter_queue )
|
||
9 years ago
|
python? ( ${PYTHON_DEPS} )
|
||
8 years ago
|
server? ( !nfqueue? ( !udp-server? ( net-libs/libpcap ) ) )
|
||
9 years ago
|
"
|
||
9 years ago
|
RDEPEND="${DEPEND}"
|
||
9 years ago
|
|
||
9 years ago
|
REQUIRED_USE="
|
||
8 years ago
|
nfqueue? ( server )
|
||
|
python? ( ${PYTHON_REQUIRED_USE} )
|
||
9 years ago
|
server? ( ^^ ( firewalld iptables ) )
|
||
9 years ago
|
udp-server? ( server )
|
||
|
"
|
||
9 years ago
|
|
||
8 years ago
|
DOCS=( AUTHORS ChangeLog README.md )
|
||
9 years ago
|
|
||
8 years ago
|
DISABLE_AUTOFORMATTING=1
|
||
9 years ago
|
DOC_CONTENTS="
|
||
8 years ago
|
Example configuration files were installed to '${EPREFIX}/etc/fwknopd/'.
|
||
|
Please edit them to suit your needs and then remove the .example suffix.
|
||
9 years ago
|
|
||
|
fwknopd supports several backends: firewalld, iptables, ipfw, pf, ipf.
|
||
|
You can set the desired backend via FIREWALL_EXE option in fwknopd.conf
|
||
|
instead of the default one chosen at compile time.
|
||
|
"
|
||
|
|
||
9 years ago
|
src_prepare() {
|
||
8 years ago
|
default_src_prepare
|
||
|
|
||
|
# Install example configs with .example suffix.
|
||
9 years ago
|
if use server; then
|
||
8 years ago
|
sed -i -e 's|conf;|conf.example;|g' Makefile.am || die
|
||
9 years ago
|
fi
|
||
|
|
||
8 years ago
|
eautoreconf
|
||
9 years ago
|
}
|
||
|
|
||
|
src_configure() {
|
||
|
local myeconfargs=(
|
||
8 years ago
|
--localstatedir="${EPREFIX}/run"
|
||
9 years ago
|
$(use_enable client)
|
||
|
$(use_enable !gdbm file-cache)
|
||
8 years ago
|
$(use_enable nfqueue nfq-capture)
|
||
9 years ago
|
$(use_enable server)
|
||
|
$(use_enable udp-server)
|
||
|
$(use_with gpg gpgme)
|
||
|
)
|
||
8 years ago
|
use firewalld && myeconfargs+=(--with-firewalld="${EPREFIX}/usr/sbin/firewalld")
|
||
|
use iptables && myeconfargs+=(--with-iptables="${EPREFIX}/sbin/iptables")
|
||
9 years ago
|
|
||
8 years ago
|
econf "${myeconfargs[@]}"
|
||
9 years ago
|
}
|
||
|
|
||
|
src_compile() {
|
||
8 years ago
|
default_src_compile
|
||
9 years ago
|
|
||
|
if use python; then
|
||
8 years ago
|
cd python || die
|
||
9 years ago
|
distutils-r1_src_compile
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
src_install() {
|
||
8 years ago
|
default_src_install
|
||
9 years ago
|
prune_libtool_files --modules
|
||
|
|
||
8 years ago
|
if use extras; then
|
||
|
dodoc extras/apparmor/usr.sbin.fwknopd
|
||
|
dodoc extras/console-qr/console-qr.sh
|
||
|
dodoc extras/fwknop-launcher/*
|
||
|
fi
|
||
|
|
||
9 years ago
|
if use server; then
|
||
9 years ago
|
newinitd "${FILESDIR}/fwknopd.init" fwknopd
|
||
9 years ago
|
newconfd "${FILESDIR}/fwknopd.confd" fwknopd
|
||
9 years ago
|
systemd_dounit extras/systemd/fwknopd.service
|
||
|
systemd_newtmpfilesd extras/systemd/fwknopd.tmpfiles.conf fwknopd.conf
|
||
|
readme.gentoo_create_doc
|
||
9 years ago
|
fi
|
||
|
|
||
|
if use python; then
|
||
8 years ago
|
# Redefine DOCS, otherwise distutils-r1 eclass interferes.
|
||
9 years ago
|
local DOCS=()
|
||
8 years ago
|
cd python || die
|
||
9 years ago
|
distutils-r1_src_install
|
||
|
fi
|
||
|
}
|
||
9 years ago
|
|
||
|
pkg_postinst() {
|
||
8 years ago
|
if use server; then
|
||
|
readme.gentoo_print_elog
|
||
|
|
||
|
if ! linux_config_exists || ! linux_chkconfig_present NETFILTER_XT_MATCH_COMMENT; then
|
||
|
echo
|
||
|
ewarn "fwknopd daemon relies on the 'comment' match in order to expire"
|
||
|
ewarn "created firewall rules, which is an important security feature."
|
||
|
ewarn "Please enable NETFILTER_XT_MATCH_COMMENT support in your kernel."
|
||
|
echo
|
||
|
fi
|
||
|
if use nfqueue && \
|
||
|
! linux_config_exists || ! linux_chkconfig_present NETFILTER_XT_TARGET_NFQUEUE; then
|
||
|
echo
|
||
|
ewarn "fwknopd daemon relies on the 'NFQUEUE' target for NFQUEUE mode."
|
||
|
ewarn "Please enable NETFILTER_XT_TARGET_NFQUEUE support in your kernel."
|
||
|
echo
|
||
|
fi
|
||
|
fi
|
||
9 years ago
|
}
|