unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: guix-devel@gnu.org
Subject: [PATCH 4/4] services: openssh: Add 'subsystems' option.
Date: Tue, 21 Feb 2017 00:53:55 +0100	[thread overview]
Message-ID: <20170220235355.29115-5-clement@lassieur.org> (raw)
In-Reply-To: <20170220235355.29115-1-clement@lassieur.org>

* gnu/services/ssh.scm (openssh-config-file): Add it.
  (<openssh-configuration>)[subsystems]: Add it.
* doc/guix.texi (Networking Services): Document it.
---
 doc/guix.texi        | 19 +++++++++++++
 gnu/services/ssh.scm | 80 +++++++++++++++++++++++++++++-----------------------
 2 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index db0bf0f9b..69ff33149 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9175,6 +9175,25 @@ equivalent role to password authentication, you should disable either
 @item @code{print-last-log?} (default: @code{#t})
 Specifies whether @command{sshd} should print the date and time of the
 last user login when a user logs in interactively.
+
+@item @code{subsystems} (default: @code{'()})
+Configures external subsystems (e.g. file transfer daemon).
+
+This is a list of two-element tuples, where each tuple contains the
+subsystem name and a command (with optional arguments) to execute upon
+subsystem request.
+
+The command @command{sftp-server} implements the SFTP file transfer
+subsystem.
+@example
+'(("sftp" "/usr/libexec/sftp-server"))
+@end example
+
+Alternately the name @command{internal-sftp} implements an in-process
+SFTP server.
+@example
+'(("sftp" "internal-sftp"))
+@end example
 @end table
 @end deftp
 
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index 9e1449743..054743d11 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -280,7 +280,9 @@ The other options should be self-descriptive."
   (use-pam?              openssh-configuration-use-pam?
                          (default #t)) ;Boolean
   (print-last-log?       openssh-configuration-print-last-log?
-                         (default #t))) ;Boolean
+                         (default #t)) ;Boolean
+  (subsystems            openssh-configuration-subsystems
+                         (default '()))) ;List of two-element tuples
 
 (define %openssh-accounts
   (list (user-group (name "sshd") (system? #t))
@@ -314,40 +316,48 @@ The other options should be self-descriptive."
   "Return the sshd configuration file corresponding to CONFIG."
   (computed-file
    "sshd_config"
-   #~(call-with-output-file #$output
-       (lambda (port)
-         (display "# Generated by 'openssh-service'.\n" port)
-         (format port "Port ~a\n"
-                 #$(number->string (openssh-configuration-port-number config)))
-         (format port "PermitRootLogin ~a\n"
-                 #$(match (openssh-configuration-permit-root-login config)
-                     (#t "yes")
-                     (#f "no")
-                     ('without-password "without-password")))
-         (format port "PermitEmptyPasswords ~a\n"
-                 #$(if (openssh-configuration-allow-empty-passwords? config)
-                       "yes" "no"))
-         (format port "PasswordAuthentication ~a\n"
-                 #$(if (openssh-configuration-password-authentication? config)
-                       "yes" "no"))
-         (format port "PubkeyAuthentication ~a\n"
-                 #$(if (openssh-configuration-public-key-authentication? config)
-                       "yes" "no"))
-         (format port "X11Forwarding ~a\n"
-                 #$(if (openssh-configuration-x11-forwarding? config)
-                       "yes" "no"))
-         (format port "PidFile ~a\n"
-                 #$(openssh-configuration-pid-file config))
-         (format port "ChallengeResponseAuthentication ~a\n"
-                 #$(if (openssh-challenge-response-authentication? config)
-                       "yes" "no"))
-         (format port "UsePAM ~a\n"
-                 #$(if (openssh-configuration-use-pam? config)
-                       "yes" "no"))
-         (format port "PrintLastLog ~a\n"
-                 #$(if (openssh-configuration-print-last-log? config)
-                       "yes" "no"))
-         #t))))
+   #~(begin
+       (use-modules (ice-9 match))
+       (call-with-output-file #$output
+         (lambda (port)
+           (display "# Generated by 'openssh-service'.\n" port)
+           (format port "Port ~a\n"
+                   #$(number->string
+                      (openssh-configuration-port-number config)))
+           (format port "PermitRootLogin ~a\n"
+                   #$(match (openssh-configuration-permit-root-login config)
+                       (#t "yes")
+                       (#f "no")
+                       ('without-password "without-password")))
+           (format port "PermitEmptyPasswords ~a\n"
+                   #$(if (openssh-configuration-allow-empty-passwords? config)
+                         "yes" "no"))
+           (format port "PasswordAuthentication ~a\n"
+                   #$(if (openssh-configuration-password-authentication? config)
+                         "yes" "no"))
+           (format port "PubkeyAuthentication ~a\n"
+                   #$(if (openssh-configuration-public-key-authentication?
+                          config)
+                         "yes" "no"))
+           (format port "X11Forwarding ~a\n"
+                   #$(if (openssh-configuration-x11-forwarding? config)
+                         "yes" "no"))
+           (format port "PidFile ~a\n"
+                   #$(openssh-configuration-pid-file config))
+           (format port "ChallengeResponseAuthentication ~a\n"
+                   #$(if (openssh-challenge-response-authentication? config)
+                         "yes" "no"))
+           (format port "UsePAM ~a\n"
+                   #$(if (openssh-configuration-use-pam? config)
+                         "yes" "no"))
+           (format port "PrintLastLog ~a\n"
+                   #$(if (openssh-configuration-print-last-log? config)
+                         "yes" "no"))
+           (for-each
+            (match-lambda
+              ((name command) (format port "Subsystem\t~a\t~a\n" name command)))
+            '#$(openssh-configuration-subsystems config))
+           #t)))))
 
 (define (openssh-shepherd-service config)
   "Return a <shepherd-service> for openssh with CONFIG."
-- 
2.11.1

  parent reply	other threads:[~2017-02-20 23:55 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 16:37 [PATCH 0/2] Openssh service patches Clément Lassieur
2017-02-17 16:37 ` [PATCH 1/2] services: openssh: Use PAM in sshd by default Clément Lassieur
2017-02-17 16:37 ` [PATCH 2/2] services: openssh: remove deprecated 'RSAAuthentication' option Clément Lassieur
2017-02-17 17:18 ` [PATCH 0/2] Openssh service patches ng0
2017-02-17 17:45   ` Julien Lepiller
2017-02-18 11:46     ` [PATCH 1/2] services: openssh: Enable PAM Clément Lassieur
2017-02-18 11:46       ` [PATCH 2/2] services: openssh: Remove deprecated 'RSAAuthentication' option Clément Lassieur
2017-02-18 15:43         ` Ricardo Wurmus
2017-02-18 18:32           ` Clément Lassieur
2017-02-19 18:54             ` ng0
2017-02-20 23:53               ` [PATCH 0/4] Openssh service patches Clément Lassieur
2017-02-20 23:53                 ` [PATCH 1/4] services: openssh: Enable PAM Clément Lassieur
2017-02-22  9:22                   ` Clément Lassieur
2017-02-22 21:07                     ` [PATCH] " Clément Lassieur
2017-03-02  7:34                       ` Danny Milosavljevic
2017-02-20 23:53                 ` [PATCH 2/4] services: openssh: Remove deprecated options Clément Lassieur
2017-03-02  7:45                   ` Danny Milosavljevic
2017-02-20 23:53                 ` [PATCH 3/4] services: openssh: Fix 'PrintLastLog' default behaviour Clément Lassieur
2017-03-02  7:37                   ` Danny Milosavljevic
2017-03-02 21:03                     ` Clément Lassieur
2017-03-02 21:06                       ` [PATCH 1/3] services: openssh: Enable PAM Clément Lassieur
2017-03-02 21:06                         ` [PATCH 2/3] services: openssh: Remove deprecated options Clément Lassieur
2017-03-03 10:16                           ` Danny Milosavljevic
2017-03-09 22:37                             ` Leo Famulari
2017-03-02 21:06                         ` [PATCH 3/3] services: openssh: Fix 'PrintLastLog' default behaviour Clément Lassieur
2017-03-03 10:19                           ` Danny Milosavljevic
2017-03-09 22:37                             ` Leo Famulari
2017-03-03 10:16                         ` [PATCH 1/3] services: openssh: Enable PAM Danny Milosavljevic
2017-03-09 22:37                           ` Leo Famulari
2017-03-10 18:25                         ` Danny Milosavljevic
2017-02-20 23:53                 ` Clément Lassieur [this message]
2017-03-02  7:44                   ` [PATCH 4/4] services: openssh: Add 'subsystems' option Danny Milosavljevic
2017-03-02 21:00                     ` Clément Lassieur
2017-03-05 14:50                       ` ng0
2017-03-07 20:49                         ` Danny Milosavljevic
2017-03-07 21:01                           ` Clément Lassieur
2017-03-16 10:03                             ` Ludovic Courtès
2017-03-16 20:45                               ` ng0
2017-03-16 20:50                                 ` Clément Lassieur
2017-03-17  5:36                                 ` John Darrington
2017-03-17 11:08                                   ` grammar usage (was: Re: [PATCH 4/4] services: openssh: Add 'subsystems' option.) ng0
2017-03-17 10:28                                     ` John Darrington
2017-03-17 10:42                                       ` ng0
2017-03-17 10:47                                         ` John Darrington
2017-03-17 10:57                                       ` grammar usage Andy Wingo
2017-03-17 11:12                                         ` John Darrington
2017-03-17 11:28                                           ` Andy Wingo
2017-03-17 13:58                                             ` Ricardo Wurmus
2017-03-17 14:13                                               ` John Darrington
2017-03-17 16:43                                               ` Mathieu Lirzin
2017-03-18 13:52                                                 ` Ludovic Courtès
2017-03-17 11:31                                           ` ng0
2017-03-17 16:13                                   ` grammar usage (was: Re: [PATCH 4/4] services: openssh: Add 'subsystems' option.) Tobias Geerinckx-Rice
2017-03-17 17:50                                     ` John Darrington
2017-03-17 16:21                                   ` [PATCH 4/4] services: openssh: Add 'subsystems' option Leo Famulari
2017-03-17 17:58                                     ` John Darrington
2017-03-18 11:09                                       ` ng0
2017-03-18 11:45                                         ` Mathieu Lirzin
2017-03-18 11:52                                           ` ng0
2017-03-18 12:10                                             ` John Darrington
2017-03-18 12:17                                               ` Catonano
2017-03-18 12:28                                           ` Catonano
2017-03-18 13:43                                         ` Being excellent to one another Ludovic Courtès
2017-03-19 15:47                                           ` dian_cecht
2017-03-19 16:33                                             ` John Darrington
2017-03-19 21:21                                             ` Ludovic Courtès
2017-03-19 22:40                                           ` Christopher Allan Webber
2017-03-20  2:57                                             ` dian_cecht
2017-03-20  6:36                                               ` John Darrington
2017-03-20  8:57                                                 ` Alex Sassmannshausen
2017-03-20  9:54                                                   ` John Darrington
2017-03-20 10:17                                                     ` Alex Sassmannshausen
2017-03-20 10:44                                                       ` John Darrington
2017-03-20 11:08                                                         ` Catonano
2017-03-20 11:21                                                         ` Alex Sassmannshausen
2017-03-20 11:53                                                           ` Pjotr Prins
2017-03-20 12:12                                                             ` ng0
2017-03-20 12:12                                                             ` John Darrington
2017-03-20 12:10                                                           ` John Darrington
2017-03-20 14:27                                                             ` Ludovic Courtès
2017-03-20 14:40                                                               ` John Darrington
2017-03-20 23:54                                                       ` dian_cecht
2017-03-21  8:50                                                         ` Ricardo Wurmus
2017-03-20 11:02                                                 ` Catonano
2017-03-20 15:09                                                 ` Christopher Allan Webber
2017-03-20 15:17                                                   ` John Darrington
2017-03-20 15:49                                                     ` Ludovic Courtès
2017-03-20 17:12                                                       ` John Darrington
2017-03-21  9:14                                                         ` Alex Sassmannshausen
2017-03-21 10:02                                                           ` pelzflorian (Florian Pelz)
2017-03-21 12:07                                                           ` John Darrington
2017-03-21 12:17                                                             ` ng0
2017-03-21 12:26                                                               ` John Darrington
2017-03-21 12:36                                                                 ` ng0
2017-03-21 12:38                                                                   ` ng0
2017-03-21 14:50                                                         ` [EOT] " Ricardo Wurmus
2017-03-19 16:50                               ` [PATCH 4/4] services: openssh: Add 'subsystems' option Clément Lassieur
2017-03-21  0:17                           ` Clément Lassieur
2017-02-18 15:45         ` [PATCH 2/2] services: openssh: Remove deprecated 'RSAAuthentication' option Ricardo Wurmus
2017-02-18 18:07           ` Clément Lassieur
2017-02-18 11:47     ` [PATCH 0/2] Openssh service patches Clément Lassieur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170220235355.29115-5-clement@lassieur.org \
    --to=clement@lassieur.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).