From patchwork Sat Nov 26 23:59:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 44884 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 0EAC427BBEC; Sun, 27 Nov 2022 00:01:33 +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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,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 89F0327BBE9 for ; Sun, 27 Nov 2022 00:01:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oz56X-0002ib-2N; Sat, 26 Nov 2022 19:01:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oz56V-0002iE-N8 for guix-patches@gnu.org; Sat, 26 Nov 2022 19:01:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oz56V-0001sG-Et for guix-patches@gnu.org; Sat, 26 Nov 2022 19:01:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oz56U-0000WQ-9Z for guix-patches@gnu.org; Sat, 26 Nov 2022 19:01:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59621] [PATCH] services: nginx: Add support for ssl-stapling in server blocks. Resent-From: mirai@makinata.eu Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Nov 2022 00:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59621 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59621@debbugs.gnu.org Cc: Bruno Victal X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16695072551991 (code B ref -1); Sun, 27 Nov 2022 00:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Nov 2022 00:00:55 +0000 Received: from localhost ([127.0.0.1]:41694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oz56M-0000W3-Nk for submit@debbugs.gnu.org; Sat, 26 Nov 2022 19:00:55 -0500 Received: from lists.gnu.org ([209.51.188.17]:44694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oz56I-0000Vx-AS for submit@debbugs.gnu.org; Sat, 26 Nov 2022 19:00:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oz56G-0002eU-0O for guix-patches@gnu.org; Sat, 26 Nov 2022 19:00:50 -0500 Received: from smtpmciv5.myservices.hosting ([185.26.107.241]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oz56D-0001kD-Sl for guix-patches@gnu.org; Sat, 26 Nov 2022 19:00:47 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.172]) by smtpmciv5.myservices.hosting (Postfix) with ESMTP id A9DAB20D4A for ; Sun, 27 Nov 2022 01:00:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 68B6F80097; Sun, 27 Nov 2022 01:00:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-1.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iok6FB1jP8LI; Sun, 27 Nov 2022 01:00:14 +0100 (CET) Received: from guix-nuc.home.arpa (bl12-93-156.dsl.telepac.pt [85.245.93.156]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 595EE80093; Sun, 27 Nov 2022 01:00:14 +0100 (CET) From: mirai@makinata.eu Date: Sat, 26 Nov 2022 23:59:50 +0000 Message-Id: <9a18d0c03940cfe0d8ab01964f12d08fcc972e30.1669507155.git.mirai@makinata.eu> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=185.26.107.241; envelope-from=mirai@makinata.eu; helo=smtpmciv5.myservices.hosting X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Bruno Victal * gnu/services/web.scm (): Add ssl-stapling? and ssl-stapling-verify?. * doc/guix.texi (NGINX): Document this. --- doc/guix.texi | 7 +++++ gnu/services/web.scm | 69 +++++++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 30 deletions(-) base-commit: 68925b5ee7e0d96b0c84ae98a633eea5097bf511 diff --git a/doc/guix.texi b/doc/guix.texi index e547d469f4..f116798dba 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -29339,6 +29339,13 @@ you don't have a certificate or you don't want to use HTTPS. Where to find the private key for secure connections. Set it to @code{#f} if you don't have a key or you don't want to use HTTPS. +@item @code{ssl-stapling?} (default: @code{#f}) +Whether the server should @uref{https://datatracker.ietf.org/doc/html/rfc6066#section-8,staple OCSP responses}. +Requires at least one @samp{resolver} directive in @code{raw-content}. + +@item @code{ssl-stapling-verify?} (default: @code{#f}) +Whether the server should verify the OCSP responses. + @item @code{server-tokens?} (default: @code{#f}) Whether the server should add its configuration to response. diff --git a/gnu/services/web.scm b/gnu/services/web.scm index 83aa97055f..8ab4050d47 100644 --- a/gnu/services/web.scm +++ b/gnu/services/web.scm @@ -510,48 +510,52 @@ (define httpd-service-type (define-record-type* nginx-server-configuration make-nginx-server-configuration nginx-server-configuration? - (listen nginx-server-configuration-listen - (default '("80" "443 ssl"))) - (server-name nginx-server-configuration-server-name - (default (list 'default))) - (root nginx-server-configuration-root - (default "/srv/http")) - (locations nginx-server-configuration-locations - (default '())) - (index nginx-server-configuration-index - (default (list "index.html"))) - (try-files nginx-server-configuration-try-files - (default '())) - (ssl-certificate nginx-server-configuration-ssl-certificate - (default #f)) - (ssl-certificate-key nginx-server-configuration-ssl-certificate-key - (default #f)) - (server-tokens? nginx-server-configuration-server-tokens? - (default #f)) - (raw-content nginx-server-configuration-raw-content - (default '()))) + (listen nginx-server-configuration-listen + (default '("80" "443 ssl"))) + (server-name nginx-server-configuration-server-name + (default (list 'default))) + (root nginx-server-configuration-root + (default "/srv/http")) + (locations nginx-server-configuration-locations + (default '())) + (index nginx-server-configuration-index + (default (list "index.html"))) + (try-files nginx-server-configuration-try-files + (default '())) + (ssl-certificate nginx-server-configuration-ssl-certificate + (default #f)) + (ssl-certificate-key nginx-server-configuration-ssl-certificate-key + (default #f)) + (ssl-stapling? nginx-server-configuration-ssl-stapling? + (default #f)) + (ssl-stapling-verify? nginx-server-configuration-ssl-stapling-verify? + (default #f)) + (server-tokens? nginx-server-configuration-server-tokens? + (default #f)) + (raw-content nginx-server-configuration-raw-content + (default '()))) (define-record-type* nginx-upstream-configuration make-nginx-upstream-configuration nginx-upstream-configuration? - (name nginx-upstream-configuration-name) - (servers nginx-upstream-configuration-servers) - (extra-content nginx-upstream-configuration-extra-content - (default '()))) + (name nginx-upstream-configuration-name) + (servers nginx-upstream-configuration-servers) + (extra-content nginx-upstream-configuration-extra-content + (default '()))) (define-record-type* nginx-location-configuration make-nginx-location-configuration nginx-location-configuration? - (uri nginx-location-configuration-uri - (default #f)) - (body nginx-location-configuration-body)) + (uri nginx-location-configuration-uri + (default #f)) + (body nginx-location-configuration-body)) (define-record-type* nginx-named-location-configuration make-nginx-named-location-configuration nginx-named-location-configuration? - (name nginx-named-location-configuration-name - (default #f)) - (body nginx-named-location-configuration-body)) + (name nginx-named-location-configuration-name + (default #f)) + (body nginx-named-location-configuration-body)) (define-record-type* nginx-configuration make-nginx-configuration @@ -628,6 +632,9 @@ (define (emit-nginx-server-config server) (ssl-certificate (nginx-server-configuration-ssl-certificate server)) (ssl-certificate-key (nginx-server-configuration-ssl-certificate-key server)) + (ssl-stapling? (nginx-server-configuration-ssl-stapling? server)) + (ssl-stapling-verify? + (nginx-server-configuration-ssl-stapling-verify? server)) (root (nginx-server-configuration-root server)) (index (nginx-server-configuration-index server)) (try-files (nginx-server-configuration-try-files server)) @@ -647,6 +654,8 @@ (define-syntax-rule (and/l x tail ...) " server_name " (config-domain-strings server-name) ";\n" (and/l ssl-certificate " ssl_certificate " <> ";\n") (and/l ssl-certificate-key " ssl_certificate_key " <> ";\n") + " ssl_stapling " (if ssl-stapling? "on" "off") ";\n" + " ssl_stapling_verify " (if ssl-stapling-verify? "on" "off") ";\n" (if (not (equal? "" root)) (list " root " root ";\n") "")