From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YL0uBGiOT2CSQwAA0tVLHw (envelope-from ) for ; Mon, 15 Mar 2021 16:42:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id OnwIAGiOT2ByLAAAB5/wlQ (envelope-from ) for ; Mon, 15 Mar 2021 16:42:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9AE9618810 for ; Mon, 15 Mar 2021 17:42:15 +0100 (CET) Received: from localhost ([::1]:56534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLqII-0001Mp-NZ for larch@yhetil.org; Mon, 15 Mar 2021 12:42:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLq7R-0003TQ-Vx for guix-patches@gnu.org; Mon, 15 Mar 2021 12:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLq7R-0007P2-O3 for guix-patches@gnu.org; Mon, 15 Mar 2021 12:31:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLq7R-0008EA-LB for guix-patches@gnu.org; Mon, 15 Mar 2021 12:31:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#39136] [PATCH 1/2] services: Add endlessh service. References: <874kwx91k6.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> In-Reply-To: <874kwx91k6.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Resent-From: Joshua Branson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Mar 2021 16:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39136 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39136@debbugs.gnu.org Cc: =?UTF-8?Q?Nicol=C3=B2?= Balzarotti Received: via spool by 39136-submit@debbugs.gnu.org id=B39136.161582584231592 (code B ref 39136); Mon, 15 Mar 2021 16:31:01 +0000 Received: (at 39136) by debbugs.gnu.org; 15 Mar 2021 16:30:42 +0000 Received: from localhost ([127.0.0.1]:36591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) 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 ) 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 ( [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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Joshua Branson X-ACL-Warn: , Joshua Branson via Guix-patches From: Joshua Branson via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615826535; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=0zJYavY94aFA4o6dfyHPE9605yVkqcByNxD8yjCyyO0=; b=PcYC/3vKUF98ySqz/uxkrLPNKhSxOMjYC4wErCNN5TJLzMDVrpq45AEecENjUgVeXKybYO S2EOB/7YFU+Ky+eiljjTOrDxDp5wwcsfVTE2BKduGO8FjwseKDxJaIvDXNRU2e8lVpHnjn vNy9bwtcaXqy1EWNHKQ64fJLO8YeajK1WZOSavRa2oTyUF3jSWL3lzWH9P23aHkf9sKWye KV0kiM4SuaQT0KqimgR1v5vl6Vnl60/s62Jtsw9xLsEgrLMDf74erJh0hNtPTyJ0qinXJo LCtYNYkL2pd/gLvzxBHM/eKUYBYyIFdkcVZBPYzFK9xVRlITb0IHsDjeS6gLDg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615826535; a=rsa-sha256; cv=none; b=d75V7jh+pHX0J7SaoEbYwi3WUS2vjQng8VqJrEXOhP5BvuT9s3id33J1CuAeegrAXZmlXF sQf2XAI2lCJSMTrPO7tZRmkn5qpjGrz7e9wF/VzU+u5uryzYf6Cgx8gLVVm8Kdl89UsnyD l09AU1Pn5Bx6Am7jnVaZxUXvIp8VdkHh1A70potS6k2nwWNm9ynopky63QQmtmlXgoWdAn a6gYUswALFOLoTjERpA3ivPdNqBR/hqLBG2yYA4srdYSQSozE8eUYh+xEZr1HQNSJmtkcG 54/RL8BI9/COyscoTFvKjdVP3G4tMkd7aBXcqz8OynxaaxL6dYagybFvWmvC9A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=dismail.de header.s=20190914 header.b=CJyaMlmN; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -2.90 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=dismail.de header.s=20190914 header.b=CJyaMlmN; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 9AE9618810 X-Spam-Score: -2.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: qUpCMN+DB2lJ From: Nicolò Balzarotti * gnu/services/ssh.scm: Add endlessh service (): 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 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 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