Subject: [bug#62461] Additional ssh configuration options.

From: Ludovic Courtès <[email-masked]>
Date: Sat, 01 Apr 2023 09:59:25 +0200

Nicolas Graves <[email-masked]> skribis:

> ---
>  gnu/home/services/ssh.scm | 49 ++++++++++++++++++++++++++++++++++-----
>  1 file changed, 43 insertions(+), 6 deletions(-)

[...]

> +(define ssh-match-keywords
> +  '("canonical" "final" "exec" "host" "originalhost" "user" "localuser"))

Should it be symbols?

>  (define-configuration openssh-host
>    (name
> -   (string)
> -   "Name of this host declaration.")
> +   maybe-string
> +   "Name of this host declaration.  A @code{openssh-host} must define only
> +@code{name} or @code{match-criteria}.  Use host-name \"*\" for top-level
> +options.")

“Use host name @code{\"*\"} for …”

> +  (match-criteria ;TODO implement stricter match-criteria rules
> +   maybe-match-criteria
> +   "A string where the first element is all or one of
> +@code{ssh-match-keywords}.  The rest of the elements are arguments for the

How about: “When specified, this string denotes the set of hosts to
which the entry applies, superseding the @code{host-name} field.  Its
first element must be all or one of…”

>    (string-append
> -   "Host " (openssh-host-name config) "\n"
> +   (if (maybe-value-set? (openssh-host-name config))
> +       (if (maybe-value-set? (openssh-host-match-criteria config))
> +           (error
> +            "You must either define name or match-criteria, not both.")
> +           (string-append "Host " (openssh-host-name config) "\n"))
> +       (if (maybe-value-set? (openssh-host-match-criteria config))
> +           (string-append
> +            "Match " (string-join (openssh-host-match-criteria config) " ") "\n")
> +           (error
> +            "You must either define name or match-criteria once.")))

Please report errors as lowercase messages with:

  (raise (formatted-message (G_ "…") …))

You can also use ‘&fix-hint’ to provide an additional hint, if needed.

Ludo’.