From patchwork Fri Mar 25 15:35:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 38106 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CC1FB27BBEA; Fri, 25 Mar 2022 15:36:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4703927BBE9 for ; Fri, 25 Mar 2022 15:36:21 +0000 (GMT) Received: from localhost ([::1]:53932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXlzA-0007RT-EB for patchwork@mira.cbaines.net; Fri, 25 Mar 2022 11:36:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXlyt-0007Pq-Az for guix-patches@gnu.org; Fri, 25 Mar 2022 11:36:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXlyt-00021E-2c for guix-patches@gnu.org; Fri, 25 Mar 2022 11:36:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nXlyt-0001Gs-0U for guix-patches@gnu.org; Fri, 25 Mar 2022 11:36:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#52578] [PATCH v2 2/2] DRAFT services: Add openldap service. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Mar 2022 15:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52578 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52578@debbugs.gnu.org Cc: jean-francois.guillaume@univ-nantes.fr Received: via spool by 52578-submit@debbugs.gnu.org id=B52578.16482225274837 (code B ref 52578); Fri, 25 Mar 2022 15:36:02 +0000 Received: (at 52578) by debbugs.gnu.org; 25 Mar 2022 15:35:27 +0000 Received: from localhost ([127.0.0.1]:52218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXlyI-0001Fs-Vp for submit@debbugs.gnu.org; Fri, 25 Mar 2022 11:35:27 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:39531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXlyH-0001FY-IZ for 52578@debbugs.gnu.org; Fri, 25 Mar 2022 11:35:26 -0400 Received: by mail-wr1-f50.google.com with SMTP id j18so11375419wrd.6 for <52578@debbugs.gnu.org>; Fri, 25 Mar 2022 08:35:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KnfZ8OfGFc5Se4GzR4vfCgmJ3nill7kzCqLJa4gRUYI=; b=AJsjgA9eZCK3MZwg3Isu5F0m5+53gJttjD2Pp3Lgq7mm6cfmEbb8iK7I+pXMV0l+Zo DFi+Nofh4aCG0PPJdLveZDOVoRNIhwigu2oc85DVA4hNZJ2wvovfLGMBUPS8+bw03/RO R1utKBptY7oSn8sFK9WpQ1ITl0+JUZCN+HVdOzsa44LIHD4l0ha3FfxR7YCmH+xdxy90 I7NXzrgZ/4fqXTcGes9teFrRvYrHth3+WJBGjxQ5W0cfGvuiSmKogcNG6NyLpicYJaRA 6L5+aocjyNuEWXFDwg2C7p+ozWp4uRpnYKRURYVJZN30OLJNTua6xXF39SiJlhrtCWYq ai4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KnfZ8OfGFc5Se4GzR4vfCgmJ3nill7kzCqLJa4gRUYI=; b=TZIBu6VDpk/ha6kjGf9U3bizpMC7gTDOJi67m9qdJTyqIdkbsKeBdreg52sbWhOHbT dCNXEM5XILQd9IZw/DsB9FJi7RLMyUQqXuWy82uMZV8j6zhywXiHQPPbXkPPM1IyZa5Y MyfrJ0ZpeJQvuaNntwfzGyPuz2ocYCPfQ+lqz5gnRJjBuug9pHNsLdMSJrDTHYiRZc5R lB2q/QbcCR4obxqIPDME5d3vaaEQUwPSLOsWjBv9M5sfeo5W1ZkNYy4staShxC5rbDh1 p7EFXduQbkfnJVTzHMCetSiyNg/L00khM0bf4GI9dSr680MR3sy5cOINAiv3Yjt4HaEQ 3ohg== X-Gm-Message-State: AOAM533cKN4aTdOq6i9KuHTWtWLVxoaoupJwxENXldilzRmZYqbGlcqa pB6hLUzaWjayf+oJegqVXl0BFCUE0E8= X-Google-Smtp-Source: ABdhPJxOsehjLr5HUS5Qh6SgAbpE8eTRvDrowDw6RYhmrb54VPuUrHQyNskO1GjhyL+8VaHdPqZSXg== X-Received: by 2002:a05:6000:1541:b0:204:1a56:e159 with SMTP id 1-20020a056000154100b002041a56e159mr9395588wry.469.1648222519806; Fri, 25 Mar 2022 08:35:19 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id w5-20020a5d5445000000b00203f8c96bcesm5189244wrv.49.2022.03.25.08.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 08:35:19 -0700 (PDT) From: zimoun Date: Fri, 25 Mar 2022 16:35:17 +0100 Message-Id: <20220325153517.1478717-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220325153517.1478717-1-zimon.toutoune@gmail.com> References: <20220325153517.1478717-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Jean-François Guillaume * gnu/services/openlda.scm (): New record. (openldap-shepherd-service): New procedure. (%openldap-activation, openldap-service-type): New variable. --- gnu/services/openldap.scm | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 gnu/services/openldap.scm diff --git a/gnu/services/openldap.scm b/gnu/services/openldap.scm new file mode 100644 index 0000000000..dc5ae3fa8f --- /dev/null +++ b/gnu/services/openldap.scm @@ -0,0 +1,84 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Jean-François Guillaume +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu services openldap) + #:use-module (gnu packages openldap) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix) + #:use-module (guix records) + #:use-module (ice-9 match) + #:export (openldap-configuration + openldap-configuration? + openldap-service-type + + )) + +(define-record-type* + openldap-configuration make-openldap-configuration + openldap-configuration? + (openldap openldap-configuration-openldap + (default openldap)) + (uri openldap-configuration-uri + (default "ldapi:// ldap://")) + (logflags openldap-configuration-logflags + (default "0")) + (pid-file openldap-configuration-pid-file + (default "/var/run/openldap/slapd.pid")) + (config-file openldap-configuration-config-file + (default (file-append openldap "/etc/openldap/slapd.conf"))) + (log-file openldap-configuration-log-file + (default "/var/log/slapd.log"))) + +(define openldap-shepherd-service + (match-lambda + (($ openldap uri logflags pid-file config-file log-file) + (list + (shepherd-service + (provision '(slapd) ) + (documentation "Run OpenLDAP.") + (requirement '(user-processes)) + (respawn? #t) + (start #~(make-forkexec-constructor + (list + #$(file-append openldap "/libexec/slapd") + "-h" #$uri + "-d" #$logflags + "-f" #$config-file) + #:pid-file #$pid-file + #:log-file #$log-file)) + (stop #~(make-kill-destructor))))))) + +(define %openldap-activation + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (mkdir-p "/var/run/openldap") + (mkdir-p "/var/lib/ldap") + #t))) + +(define openldap-service-type + (service-type (name 'slapd) + (extensions + (list + (service-extension shepherd-root-service-type + openldap-shepherd-service) + (service-extension activation-service-type + (const %openldap-activation)))) + (description + "Run @uref{https://www.openldap.org, OpenLDAP}.")))