summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/knock')
-rw-r--r--net-misc/knock/Manifest1
-rw-r--r--net-misc/knock/files/knockd.confd.28
-rw-r--r--net-misc/knock/files/knockd.initd.224
-rw-r--r--net-misc/knock/knock-0.8.ebuild47
-rw-r--r--net-misc/knock/metadata.xml11
5 files changed, 91 insertions, 0 deletions
diff --git a/net-misc/knock/Manifest b/net-misc/knock/Manifest
new file mode 100644
index 000000000000..853a1f8133f9
--- /dev/null
+++ b/net-misc/knock/Manifest
@@ -0,0 +1 @@
+DIST knock-0.8.tar.gz 377107 BLAKE2B 1397ed04b1a202db08b0bd3a8a26745cd2e8390604c9dde7d18182e7ad4ddd19da074b1b54ea1ed59b1576f3110e21bac722c90a2cd3820910bdaa0026eec395 SHA512 6511e29f604cebc4a4048f5e49c1b73db0bbe0041a88f7c8559fa1a60ea894aadb72a608c423f867a5a4dddb06d00a0713863473981e42273662a77364c260ec
diff --git a/net-misc/knock/files/knockd.confd.2 b/net-misc/knock/files/knockd.confd.2
new file mode 100644
index 000000000000..335a522fccb9
--- /dev/null
+++ b/net-misc/knock/files/knockd.confd.2
@@ -0,0 +1,8 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# interface to listen to
+IFACE="eth0"
+
+# extra options for knockd daemon
+OPTS=""
diff --git a/net-misc/knock/files/knockd.initd.2 b/net-misc/knock/files/knockd.initd.2
new file mode 100644
index 000000000000..1d80f5980afc
--- /dev/null
+++ b/net-misc/knock/files/knockd.initd.2
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+: ${CONFIGFILE:=/etc/knockd.conf}
+: ${IFACE:=eth0}
+
+get_config() {
+ [ -f ${CONFIGFILE} ] && conf=$(awk 'tolower($1) == "'$1'" { print $3 }' ${CONFIGFILE})
+
+ echo ${conf:-$2}
+}
+
+depend() {
+ need net
+ use net.${IFACE}
+
+ [ "$(get_config usesyslog no)" != "no" ] && use logger
+}
+
+pidfile=$(get_config pidfile /var/run/knockd.pid)
+
+command=/usr/sbin/knockd
+command_args="-d -i ${IFACE} ${OPTS}"
diff --git a/net-misc/knock/knock-0.8.ebuild b/net-misc/knock/knock-0.8.ebuild
new file mode 100644
index 000000000000..5d3643d7508a
--- /dev/null
+++ b/net-misc/knock/knock-0.8.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Simple port-knocking daemon"
+HOMEPAGE="https://www.zeroflux.org/projects/knock"
+SRC_URI="https://www.zeroflux.org/proj/knock/files/${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="amd64 ppc sparc x86"
+IUSE="+server"
+
+DEPEND="server? ( net-libs/libpcap )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ default
+
+ sed -e "/^AM_CFLAGS/s: -g : :" \
+ -e "/dist_doc_DATA/s:COPYING::" \
+ -i Makefile.in || die
+
+ sed -e "s:/usr/sbin/iptables:/sbin/iptables:g" \
+ -i knockd.conf || die
+}
+
+src_configure() {
+ econf $(use_enable server knockd)
+}
+
+src_install() {
+ emake DESTDIR="${D}" docdir="${EPREFIX}/usr/share/doc/${PF}" install
+
+ if use server ; then
+ newinitd "${FILESDIR}"/knockd.initd.2 knock
+ newconfd "${FILESDIR}"/knockd.confd.2 knock
+ fi
+}
+
+pkg_postinst() {
+ if use server && ! has_version net-firewall/iptables ; then
+ elog "You're really encouraged to install net-firewall/iptables to"
+ elog "actually modify your firewall and use the example configuration."
+ fi
+}
diff --git a/net-misc/knock/metadata.xml b/net-misc/knock/metadata.xml
new file mode 100644
index 000000000000..51136390988c
--- /dev/null
+++ b/net-misc/knock/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <use>
+ <flag name="server">Installs the knockd server daemon.</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">jvinet/knock</remote-id>
+ </upstream>
+</pkgmetadata>