all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#30817] [PATCH] openssh-service: export AcceptEnv option
@ 2018-03-14 14:55 Martin Castillo
  2018-03-15 17:13 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Castillo @ 2018-03-14 14:55 UTC (permalink / raw)
  To: 30817


[-- Attachment #1.1.1: Type: text/plain, Size: 286 bytes --]

(Resent, because I forgot '[PATCH]' in the subject.)

This patch makes AcceptEnv configurable from config.scm.

Questions:
Is the dash in environment-variables correct?
Why are there always two spaces after a period?
Is @option the correct annotation for AcceptEnv?

Martin


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-services-openssh-Add-AcceptEnv-field.patch --]
[-- Type: text/x-patch; name="0001-services-openssh-Add-AcceptEnv-field.patch", Size: 2376 bytes --]

From e64e4a908936c5aec0c026324cc08be12edb8ec1 Mon Sep 17 00:00:00 2001
From: Martin Castillo <castilma@uni-bremen.de>
Date: Tue, 13 Mar 2018 16:40:55 +0100
Subject: [PATCH] services: openssh: Add 'AcceptEnv' field.

* gnu/services/ssh.scm (<openssh-configuration>)[AcceptEnv]: New field.
(openssh-config-file): Honor 'AcceptEnv'.
* doc/guix.texi (Networking Services): Document it.
---
 doc/guix.texi        | 11 +++++++++++
 gnu/services/ssh.scm |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index d3a7908f9..bed0d3359 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -11158,6 +11158,17 @@ server.  Alternately, one can specify the @command{sftp-server} command:
            `(("sftp" ,(file-append openssh "/libexec/sftp-server"))))))
 @end example
 
+@item @code{accept-env} (default: @code{'()})
+List of strings describing which environment-variables may be exported.
+
+Each string gets on its own line.  See the @option{AcceptEnv} option in
+@code{sshd_config(5)}.
+@example
+(service openssh-service-type
+         (openssh-configuration
+		  (accept-env '("COLORTERM"))))
+@end example
+
 @item @code{authorized-keys} (default: @code{'()})
 @cindex authorized keys, SSH
 @cindex SSH authorized keys
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index 301ba7404..ad778f394 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -302,6 +302,10 @@ The other options should be self-descriptive."
   (subsystems            openssh-configuration-subsystems
                          (default '(("sftp" "internal-sftp"))))
 
+  ;; list of strings
+  (accept-env            openssh-configuration-accept-env
+                         (default '()))
+
   ;; list of user-name/file-like tuples
   (authorized-keys       openssh-authorized-keys
                          (default '()))
@@ -430,6 +434,9 @@ of user-name/file-like tuples."
            (format port "AuthorizedKeysFile \
  .ssh/authorized_keys .ssh/authorized_keys2 /etc/ssh/authorized_keys.d/%u\n")
 
+           (for-each (lambda (s) (format port "AcceptEnv ~a\n" s))
+                     '#$(openssh-configuration-accept-env config))
+
            (for-each
             (match-lambda
               ((name command) (format port "Subsystem\t~a\t~a\n" name command)))
-- 
2.16.2



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#30817] [PATCH] openssh-service: export AcceptEnv option
  2018-03-14 14:55 [bug#30817] [PATCH] openssh-service: export AcceptEnv option Martin Castillo
@ 2018-03-15 17:13 ` Ludovic Courtès
  2018-03-15 22:54   ` Martin Castillo
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-03-15 17:13 UTC (permalink / raw)
  To: Martin Castillo; +Cc: 30817

Hello,

Martin Castillo <castilma@uni-bremen.de> skribis:

> This patch makes AcceptEnv configurable from config.scm.

Nice!

> Questions:
> Is the dash in environment-variables correct?

No, just “environment variables”.

> Why are there always two spaces after a period?

It’s inherited from an (old) convention honored by Emacs notably that
mimics English typographic conventions regarding spacing after
end-of-sentence periods.

> Is @option the correct annotation for AcceptEnv?

@option is normally for command-line option, so I’d just use @code.

> From e64e4a908936c5aec0c026324cc08be12edb8ec1 Mon Sep 17 00:00:00 2001
> From: Martin Castillo <castilma@uni-bremen.de>
> Date: Tue, 13 Mar 2018 16:40:55 +0100
> Subject: [PATCH] services: openssh: Add 'AcceptEnv' field.
>
> * gnu/services/ssh.scm (<openssh-configuration>)[AcceptEnv]: New field.
> (openssh-config-file): Honor 'AcceptEnv'.
> * doc/guix.texi (Networking Services): Document it.

Overall the patch LGTM, so the comments below are really nitpicking:

> +@item @code{accept-env} (default: @code{'()})
> +List of strings describing which environment-variables may be exported.
> +
> +Each string gets on its own line.  See the @option{AcceptEnv} option in
> +@code{sshd_config(5)}.

I’d write “… in @code{man sshd_config(5)}.”

> +@example
> +(service openssh-service-type
> +         (openssh-configuration
> +		  (accept-env '("COLORTERM"))))
> +@end example

Please add a sentence describing the example, even if it seems obvious.

> +  ;; list of strings
> +  (accept-env            openssh-configuration-accept-env
> +                         (default '()))

We usually avoid abbreviations, so that would be “accepted-environment”
(see <https://gnu.org/software/guix/manual/html_node/Formatting-Code.html>).

Could you send an updated patch?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#30817] [PATCH] openssh-service: export AcceptEnv option
  2018-03-15 17:13 ` Ludovic Courtès
@ 2018-03-15 22:54   ` Martin Castillo
  2018-03-17 21:16     ` bug#30817: " Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Castillo @ 2018-03-15 22:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 30817


[-- Attachment #1.1.1: Type: text/plain, Size: 124 bytes --]

Hello,

> Could you send an updated patch?
 Here you go

-- 
GPG: 7FDE 7190 2F73 2C50 236E  403D CC13 48F1 E644 08EC

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-services-openssh-Add-accepted-environment-field.patch --]
[-- Type: text/x-patch; name="0001-services-openssh-Add-accepted-environment-field.patch", Size: 2715 bytes --]

From 2cc779c3e0f02f7f58bed4bebfac92f94353cb3b Mon Sep 17 00:00:00 2001
From: Martin Castillo <castilma@uni-bremen.de>
Date: Thu, 15 Mar 2018 23:40:58 +0100
Subject: [PATCH] services: openssh: Add 'accepted-environment' field.

* gnu/services/ssh.scm (<openssh-configuration>)[accepted-environment]: New field.
(openssh-config-file): Honor 'acccepted-environment'.
* doc/guix.texi (Networking Services): Document it.
---
 doc/guix.texi        | 16 ++++++++++++++++
 gnu/services/ssh.scm |  7 +++++++
 2 files changed, 23 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index d3a7908f9..6e449b90c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -11158,6 +11158,22 @@ server.  Alternately, one can specify the @command{sftp-server} command:
            `(("sftp" ,(file-append openssh "/libexec/sftp-server"))))))
 @end example
 
+@item @code{accepted-environment} (default: @code{'()})
+List of strings describing which environment variables may be exported.
+
+Each string gets on its own line.  See the @code{AcceptEnv} option in
+@code{man sshd_config(5)}.
+
+This example allows ssh-clients to export the @code{COLORTERM} variable.  
+It is set by terminal emulators, which support colors.  You can use it in 
+your shell's ressource file to enable colors for the prompt and commands 
+if this variable is set.
+@example
+(service openssh-service-type
+         (openssh-configuration
+		  (accepted-environment '("COLORTERM"))))
+@end example
+
 @item @code{authorized-keys} (default: @code{'()})
 @cindex authorized keys, SSH
 @cindex SSH authorized keys
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index 301ba7404..f1d2be3f6 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -302,6 +302,10 @@ The other options should be self-descriptive."
   (subsystems            openssh-configuration-subsystems
                          (default '(("sftp" "internal-sftp"))))
 
+  ;; list of strings
+  (accepted-environment  openssh-configuration-accepted-environment
+                         (default '()))
+
   ;; list of user-name/file-like tuples
   (authorized-keys       openssh-authorized-keys
                          (default '()))
@@ -430,6 +434,9 @@ of user-name/file-like tuples."
            (format port "AuthorizedKeysFile \
  .ssh/authorized_keys .ssh/authorized_keys2 /etc/ssh/authorized_keys.d/%u\n")
 
+           (for-each (lambda (s) (format port "AcceptEnv ~a\n" s))
+                     '#$(openssh-configuration-accepted-environment config))
+
            (for-each
             (match-lambda
               ((name command) (format port "Subsystem\t~a\t~a\n" name command)))
-- 
2.16.2


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#30817: [PATCH] openssh-service: export AcceptEnv option
  2018-03-15 22:54   ` Martin Castillo
@ 2018-03-17 21:16     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-03-17 21:16 UTC (permalink / raw)
  To: Martin Castillo; +Cc: 30817-done

Hi Martin,

Martin Castillo <castilma@uni-bremen.de> skribis:

> From 2cc779c3e0f02f7f58bed4bebfac92f94353cb3b Mon Sep 17 00:00:00 2001
> From: Martin Castillo <castilma@uni-bremen.de>
> Date: Thu, 15 Mar 2018 23:40:58 +0100
> Subject: [PATCH] services: openssh: Add 'accepted-environment' field.
>
> * gnu/services/ssh.scm (<openssh-configuration>)[accepted-environment]: New field.
> (openssh-config-file): Honor 'acccepted-environment'.
> * doc/guix.texi (Networking Services): Document it.

Awesome.  Applied, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-17 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-14 14:55 [bug#30817] [PATCH] openssh-service: export AcceptEnv option Martin Castillo
2018-03-15 17:13 ` Ludovic Courtès
2018-03-15 22:54   ` Martin Castillo
2018-03-17 21:16     ` bug#30817: " Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.