GNU bug report logs

#39136 [PATCH] gnu: services: Add endlessh.

PackageSource(s)Maintainer(s)
guix-patches PTS Buildd Popcon
Full log

Message #11 received at 39136@debbugs.gnu.org (full text, mbox, reply):

Received: (at 39136) by debbugs.gnu.org; 15 Mar 2021 16:30:42 +0000
From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 15 12:30:42 2021
Received: from localhost ([127.0.0.1]:36591 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1lLq77-0008DU-OP
	for submit@debbugs.gnu.org; Mon, 15 Mar 2021 12:30:42 -0400
Received: from mx1.dismail.de ([78.46.223.134]:14705)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jbranso@dismail.de>) id 1lLq75-0008D7-1v
 for 39136@debbugs.gnu.org; Mon, 15 Mar 2021 12:30:40 -0400
Received: from mx1.dismail.de (localhost [127.0.0.1])
 by mx1.dismail.de (OpenSMTPD) with ESMTP id dff06951;
 Mon, 15 Mar 2021 17:30:32 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc
 :subject:date:message-id:mime-version:content-type
 :content-transfer-encoding; s=20190914; bh=Tk6JjC8fyJ1LrzU5iVT/v
 CyUXldeLislM8LsuyUE3UA=; b=CJyaMlmNTS4Kx487rc7suLxShh0EaZPztNHZa
 2mP86l++eS9RszTH2Qow40aZFpTrSEfNBM3FDfBYfFD8nxOJSPG9s26Zz6S+zunl
 6nog3tz3xoe5WBs7wcXFfwVQMlclLVfgB9R2O55CyeYOhufDlLKnoipX78+wc7FT
 DIOsZwZvFRDHDtZTimgvK3l2kj/vr6TCDN0otKTvoO57BSwyqNR3Yg3aEi24rHqV
 afXOkuHfFA/UFvnU1zEpCnmcGtVXhGDwqb7JXVn0zPR3JaDdvL0dVNUE7SldvsEd
 R2moiE+7sz2nXXpLQMHSH2TTEW3hjteGfZzf9MLv9LKc8Mhww==
Received: from smtp2.dismail.de (<unknown> [10.240.26.12])
 by mx1.dismail.de (OpenSMTPD) with ESMTP id beebfcd2;
 Mon, 15 Mar 2021 17:30:31 +0100 (CET)
Received: from smtp2.dismail.de (localhost [127.0.0.1])
 by smtp2.dismail.de (OpenSMTPD) with ESMTP id b8faeee4;
 Mon, 15 Mar 2021 17:30:31 +0100 (CET)
Received: by dismail.de (OpenSMTPD) with ESMTPSA id 260a3f7e
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Mon, 15 Mar 2021 17:30:30 +0100 (CET)
From: Joshua Branson <jbranso@dismail.de>
To: 39136@debbugs.gnu.org
Subject: [PATCH 1/2] services: Add endlessh service.
Date: Mon, 15 Mar 2021 12:29:48 -0400
Message-Id: <20210315162949.17092-1-jbranso@dismail.de>
X-Mailer: git-send-email 2.30.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.3 (/)
X-Debbugs-Envelope-To: 39136
Cc: Nicolò Balzarotti <nicolo@nixo.xyz>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -1.3 (-)
From: Nicolò Balzarotti <nicolo@nixo.xyz>

* gnu/services/ssh.scm: Add endlessh service
(<endlessh-configuration>): New record type.
(endlessh-config->conf, endlessh-shepherd-service, endlessh-service-type): New procedures.
---
 gnu/services/ssh.scm | 73 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index 1891db0487..aad9bbc754 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -54,6 +54,10 @@
             autossh-configuration?
             autossh-service-type
 
+            endlessh-configuration
+            endlessh-configuration?
+            endlessh-service-type
+
             webssh-configuration
             webssh-configuration?
             webssh-service-type
@@ -739,6 +743,75 @@ object."
                              autossh-service-activation)))
    (default-value (autossh-configuration))))
 
+
+;;;
+;;; Endlessh.
+;;;
+
+(define-record-type* <endlessh-configuration>
+  endlessh-configuration make-endlessh-configuration
+  endlessh-configuration?
+  ;; list of two symbols, allowed values are ipv4, ipv6 or both
+  (bind-family endlessh-configuration-bind-family (default '(ipv4 ipv6)))
+  ;; integer
+  (delay endlessh-configuration-delay (default 10000))
+  ;; integer
+  ;; Must be in the range
+  (length endlessh-configuration-length (default 32))
+  ;; integer
+  (max-clients endlessh-configuration-max-clients (default 4096))
+  ;; integer
+  (port-number endlessh-configuration-port-number (default 2222))
+  ;; integer
+  ;; Allowed values are 0, 1 and 2
+  (log-level endlessh-configuration-log-level (default 0)))
+
+(define (endlessh-config->conf config)
+  "Convert the CONFIG of type <endlessh-config> to a config file."
+  (let* ((family (endlessh-configuration-bind-family config))
+	 (ipv4 (member 'ipv4 family))
+	 (ipv6 (member 'ipv6 family))
+	 (port (endlessh-configuration-port-number config))
+	 (delay (endlessh-configuration-delay config))
+	 (length (endlessh-configuration-length config))
+	 (log-level (endlessh-configuration-log-level config))
+	 (max-clients (endlessh-configuration-max-clients config))
+	 (bind
+	  ;; check if both are true (0), or only one of them is present
+	  (if (not (and (equal? ipv4 ipv6) ipv4))
+	      (if ipv4 4
+		  (if ipv6 6
+		      (throw 'endlessh-error
+			     "bind-family must contain at least one value")))
+	      0)))
+    (mixed-text-file "endlessh.conf"
+		     "# Generated by 'endlessh-config'.\n\n"
+		     "Port " (number->string port) "\n"
+		     "Delay " (number->string delay) "\n"
+		     "MaxLineLength " (number->string length) "\n"
+		     "MaxClients " (number->string max-clients) "\n"
+		     "LogLevel " (number->string log-level) "\n"
+		     "BindFamily " (number->string bind) "\n")))
+
+(define (endlessh-shepherd-service config)
+  (shepherd-service
+   (documentation "Run endlessh tarpit server.")
+   (provision '(endlessh))
+   (start #~(make-forkexec-constructor
+	     (list #$(file-append endlessh "/bin/endlessh")
+		   "-f" #$(endlessh-config->conf config))))
+   (stop  #~(make-kill-destructor))))
+
+(define endlessh-service-type
+  (service-type
+   (name 'endlessh)
+   (description "Run endlessh tarpit server.")
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             (compose list endlessh-shepherd-service))))
+   (default-value (endlessh-configuration))))
+
+
 
 ;;;
 ;;; WebSSH
-- 
2.30.0





Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Tue Jan 7 02:26:31 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.