From patchwork Wed Jul 10 21:13:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 1130572 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="eWKhTDAh"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45kXC12fJWz9sN6 for ; Thu, 11 Jul 2019 07:19:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1DD8585FD4; Wed, 10 Jul 2019 21:19:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02nqIIqke-fQ; Wed, 10 Jul 2019 21:19:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1C3CD85643; Wed, 10 Jul 2019 21:19:53 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 672E01BF400 for ; Wed, 10 Jul 2019 21:19:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 63D2A85643 for ; Wed, 10 Jul 2019 21:19:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fnKmKmw1QODf for ; Wed, 10 Jul 2019 21:19:50 +0000 (UTC) X-Greylist: delayed 00:05:53 by SQLgrey-1.7.6 Received: from mail-ed1-f67.google.com (mail-ed1-f67.google.com [209.85.208.67]) by fraxinus.osuosl.org (Postfix) with ESMTPS id DFFB984789 for ; Wed, 10 Jul 2019 21:19:49 +0000 (UTC) Received: by mail-ed1-f67.google.com with SMTP id e2so3532749edi.12 for ; Wed, 10 Jul 2019 14:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id; bh=K0JTtPfVIT0qEaVGwwxlmWZAR1APHe8uyz6wdwwh3cU=; b=eWKhTDAhcHD1l5AwuG7XrPEkjWub/C9j1JE4mHJ1Gkt8nyEb85Q+WcxXWtv0DTIWqR o5QxGielZAA5/ieiDytNdrA8lR+pB4As5Pux1YrJ3vA+Koykqi2yVnx1ELcjOSM29pNN R8c7peennb9V3bWxaE+S1YNTORKCLULzY/h2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=K0JTtPfVIT0qEaVGwwxlmWZAR1APHe8uyz6wdwwh3cU=; b=Rfo/pckmf31RMuwtmAsYLepJAGK+bguBx9iz4PDT5o9nde63l5gMgBMCkrqZDaqriP FQ+j4gkDNygZM6ac1iRmehbtAXBMoWWIcU/fEAwh75FTFVDVdnZ0HeWlTyd8NA+fVTL2 EWlSZukvyBJeJvZEbiN8KDjf+eVmHacUUR65wjRLToHS+AIC9Jy22Y5ci9ytmlkMId6B ar9VeKKvDskn5EvNvIcEqBvVfmHiybrbarhJc3/TnSfx3HOszIfckyVVSjRjjHx4t/yj OfzPFO7PbMSXfmq3ga4WzI38V8AgIZxcF+nkPBOkFHS6hnzznXsWumZe6lird+iiNZug Kr4A== X-Gm-Message-State: APjAAAWZ2uOnXZ2dPAh/UIH935KlVHEgNrWNCHZPYZx7GzeFl+kMB4ND XB+9rRQTR6bJW6OORNBz6oBvTA2SZU8= X-Google-Smtp-Source: APXvYqyEGqqIctt5/+Y9jQQqi5LQ7P0MlXgWc5bx2cP8OKTF2YyQvXqxysxCubDJmNyNUwOoxe37KQ== X-Received: by 2002:a17:906:944f:: with SMTP id z15mr171119ejx.137.1562793234576; Wed, 10 Jul 2019 14:13:54 -0700 (PDT) Received: from localhost.localdomain ([37.162.211.140]) by smtp.gmail.com with ESMTPSA id uz27sm742746ejb.24.2019.07.10.14.13.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jul 2019 14:13:53 -0700 (PDT) From: Angelo Compagnucci To: buildroot@buildroot.org Date: Wed, 10 Jul 2019 23:13:48 +0200 Message-Id: <1562793228-5530-1-git-send-email-angelo@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 Subject: [Buildroot] [PATCH] package/sshguard: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Angelo Compagnucci MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" sshguard protects hosts from brute-force attacks against SSH and other services. Signed-off-by: Angelo Compagnucci --- DEVELOPERS | 1 + package/Config.in | 1 + package/sshguard/Config.in | 10 ++++++++++ package/sshguard/S39sshguard | 27 +++++++++++++++++++++++++++ package/sshguard/sshguard.hash | 3 +++ package/sshguard/sshguard.mk | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 package/sshguard/Config.in create mode 100644 package/sshguard/S39sshguard create mode 100644 package/sshguard/sshguard.hash create mode 100644 package/sshguard/sshguard.mk diff --git a/DEVELOPERS b/DEVELOPERS index e9c521f..ce50777 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -175,6 +175,7 @@ F: package/python-can/ F: package/python-pillow/ F: package/python-pydal/ F: package/python-web2py/ +F: package/sshguard/ F: package/sysdig/ N: Anisse Astier diff --git a/package/Config.in b/package/Config.in index d501b5a..fb03993 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2052,6 +2052,7 @@ endif source "package/spice/Config.in" source "package/spice-protocol/Config.in" source "package/squid/Config.in" + source "package/sshguard/Config.in" source "package/sshpass/Config.in" source "package/sslh/Config.in" source "package/strongswan/Config.in" diff --git a/package/sshguard/Config.in b/package/sshguard/Config.in new file mode 100644 index 0000000..6bf1800 --- /dev/null +++ b/package/sshguard/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_SSHGUARD + bool "sshguard" + depends on BR2_PACKAGE_IPTABLES + help + sshguard protects hosts from brute-force attacks against SSH and + other services. It aggregates system logs and blocks repeat offenders + using one of several firewall backends, including iptables, ipfw, + and pf. + + https://www.sshguard.net diff --git a/package/sshguard/S39sshguard b/package/sshguard/S39sshguard new file mode 100644 index 0000000..8b46bc5 --- /dev/null +++ b/package/sshguard/S39sshguard @@ -0,0 +1,27 @@ +#!/bin/sh + +case "$1" in + start) + printf "Starting sshguard: " + iptables -N sshguard + iptables -A INPUT -j sshguard + start-stop-daemon -S -q -b -p /run/sshguard.pid \ + -x /usr/sbin/sshguard -- -i /run/sshguard.pid + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + printf "Stopping sshguard: " + start-stop-daemon -K -q -p /run/sshguard.pid + [ $? = 0 ] && echo "OK" || echo "FAIL" + iptables -D INPUT -j sshguard + iptables -F sshguard + iptables -X sshguard + ;; + restart) + "$0" stop + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + ;; +esac diff --git a/package/sshguard/sshguard.hash b/package/sshguard/sshguard.hash new file mode 100644 index 0000000..68f891e --- /dev/null +++ b/package/sshguard/sshguard.hash @@ -0,0 +1,3 @@ +# sha256 locally computed +sha256 d34a241ce6f3c5bcaebebd35ad292853d1aa3659f8fb9eb3ad56332259d3135a sshguard-v2.4.0.tar.gz +sha256 c3ae64f12153a1bc55bc234d09f40a08ab0e0149fffc972c0b7f02d5a12c1a5c COPYING diff --git a/package/sshguard/sshguard.mk b/package/sshguard/sshguard.mk new file mode 100644 index 0000000..634bc17 --- /dev/null +++ b/package/sshguard/sshguard.mk @@ -0,0 +1,35 @@ +################################################################################ +# +# sshguard +# +################################################################################ + +SSHGUARD_VERSION = v2.4.0 +SSHGUARD_SITE = https://bitbucket.org/sshguard/sshguard +SSHGUARD_SITE_METHOD = git +SSHGUARD_LICENSE = GPL-2.0+ +SSHGUARD_LICENSE_FILES = COPYING +SSHGUARD_AUTORECONF = YES + +define SSHGUARD_INSTALL_CONFIG + $(INSTALL) -D -m 0644 $(@D)/examples/sshguard.conf.sample \ + $(TARGET_DIR)/etc/sshguard.conf + $(SED) '/^#BACKEND/c\BACKEND="/usr/libexec/sshg-fw-iptables"' $(TARGET_DIR)/etc/sshguard.conf + $(SED) '/^#FILES/c\FILES="/var/log/messages"' $(TARGET_DIR)/etc/sshguard.conf +endef +SSHGUARD_POST_INSTALL_TARGET_HOOKS += SSHGUARD_INSTALL_CONFIG + +define SSHGUARD_INSTALL_INIT_SYSV + $(INSTALL) -D -m 755 package/sshguard/S60sshguard \ + $(TARGET_DIR)/etc/init.d/S60sshguard +endef + +define SSHGUARD_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 0644 $(@D)/examples/sshguard.service \ + $(TARGET_DIR)/usr/lib/systemd/system/sshguard.service + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + ln -fs ../../../../usr/lib/systemd/system/sshguard.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/sshguard.service +endef + +$(eval $(autotools-package))