diff options
| author | Clément Lassieur <clement@lassieur.org> | 2017-02-21 00:53:55 +0100 |
|---|---|---|
| committer | Clément Lassieur <clement@lassieur.org> | 2017-03-21 20:49:26 +0100 |
| commit | 12723370e5a780b18eae4c44ab9634adaff927ea (patch) | |
| tree | e646b30d1e274553579e09d18c44a1ed523060e9 /gnu | |
| parent | 4ca3e9b7b6909839c3b03f691a1c370e3fdea3b0 (diff) | |
services: openssh: Add 'subsystems' option.
* gnu/services/ssh.scm (openssh-config-file): Add it.
(<openssh-configuration>)[subsystems]: Add it.
* doc/guix.texi (Networking Services): Document it.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/services/ssh.scm | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm index 6272d53fc89..b7f9887b308 100644 --- a/gnu/services/ssh.scm +++ b/gnu/services/ssh.scm | |||
| @@ -292,7 +292,10 @@ The other options should be self-descriptive." | |||
| 292 | (default #t)) | 292 | (default #t)) |
| 293 | ;; Boolean | 293 | ;; Boolean |
| 294 | (print-last-log? openssh-configuration-print-last-log? | 294 | (print-last-log? openssh-configuration-print-last-log? |
| 295 | (default #t))) | 295 | (default #t)) |
| 296 | ;; list of two-element lists | ||
| 297 | (subsystems openssh-configuration-subsystems | ||
| 298 | (default '(("sftp" "internal-sftp"))))) | ||
| 296 | 299 | ||
| 297 | (define %openssh-accounts | 300 | (define %openssh-accounts |
| 298 | (list (user-group (name "sshd") (system? #t)) | 301 | (list (user-group (name "sshd") (system? #t)) |
| @@ -327,40 +330,48 @@ The other options should be self-descriptive." | |||
| 327 | "Return the sshd configuration file corresponding to CONFIG." | 330 | "Return the sshd configuration file corresponding to CONFIG." |
| 328 | (computed-file | 331 | (computed-file |
| 329 | "sshd_config" | 332 | "sshd_config" |
| 330 | #~(call-with-output-file #$output | 333 | #~(begin |
| 331 | (lambda (port) | 334 | (use-modules (ice-9 match)) |
| 332 | (display "# Generated by 'openssh-service'.\n" port) | 335 | (call-with-output-file #$output |
| 333 | (format port "Port ~a\n" | 336 | (lambda (port) |
| 334 | #$(number->string (openssh-configuration-port-number config))) | 337 | (display "# Generated by 'openssh-service'.\n" port) |
| 335 | (format port "PermitRootLogin ~a\n" | 338 | (format port "Port ~a\n" |
| 336 | #$(match (openssh-configuration-permit-root-login config) | 339 | #$(number->string |
| 337 | (#t "yes") | 340 | (openssh-configuration-port-number config))) |
| 338 | (#f "no") | 341 | (format port "PermitRootLogin ~a\n" |
| 339 | ('without-password "without-password"))) | 342 | #$(match (openssh-configuration-permit-root-login config) |
| 340 | (format port "PermitEmptyPasswords ~a\n" | 343 | (#t "yes") |
| 341 | #$(if (openssh-configuration-allow-empty-passwords? config) | 344 | (#f "no") |
| 342 | "yes" "no")) | 345 | ('without-password "without-password"))) |
| 343 | (format port "PasswordAuthentication ~a\n" | 346 | (format port "PermitEmptyPasswords ~a\n" |
| 344 | #$(if (openssh-configuration-password-authentication? config) | 347 | #$(if (openssh-configuration-allow-empty-passwords? config) |
| 345 | "yes" "no")) | 348 | "yes" "no")) |
| 346 | (format port "PubkeyAuthentication ~a\n" | 349 | (format port "PasswordAuthentication ~a\n" |
| 347 | #$(if (openssh-configuration-public-key-authentication? config) | 350 | #$(if (openssh-configuration-password-authentication? config) |
| 348 | "yes" "no")) | 351 | "yes" "no")) |
| 349 | (format port "X11Forwarding ~a\n" | 352 | (format port "PubkeyAuthentication ~a\n" |
| 350 | #$(if (openssh-configuration-x11-forwarding? config) | 353 | #$(if (openssh-configuration-public-key-authentication? |
| 351 | "yes" "no")) | 354 | config) |
| 352 | (format port "PidFile ~a\n" | 355 | "yes" "no")) |
| 353 | #$(openssh-configuration-pid-file config)) | 356 | (format port "X11Forwarding ~a\n" |
| 354 | (format port "ChallengeResponseAuthentication ~a\n" | 357 | #$(if (openssh-configuration-x11-forwarding? config) |
| 355 | #$(if (openssh-challenge-response-authentication? config) | 358 | "yes" "no")) |
| 356 | "yes" "no")) | 359 | (format port "PidFile ~a\n" |
| 357 | (format port "UsePAM ~a\n" | 360 | #$(openssh-configuration-pid-file config)) |
| 358 | #$(if (openssh-configuration-use-pam? config) | 361 | (format port "ChallengeResponseAuthentication ~a\n" |
| 359 | "yes" "no")) | 362 | #$(if (openssh-challenge-response-authentication? config) |
| 360 | (format port "PrintLastLog ~a\n" | 363 | "yes" "no")) |
| 361 | #$(if (openssh-configuration-print-last-log? config) | 364 | (format port "UsePAM ~a\n" |
| 362 | "yes" "no")) | 365 | #$(if (openssh-configuration-use-pam? config) |
| 363 | #t)))) | 366 | "yes" "no")) |
| 367 | (format port "PrintLastLog ~a\n" | ||
| 368 | #$(if (openssh-configuration-print-last-log? config) | ||
| 369 | "yes" "no")) | ||
| 370 | (for-each | ||
| 371 | (match-lambda | ||
| 372 | ((name command) (format port "Subsystem\t~a\t~a\n" name command))) | ||
| 373 | '#$(openssh-configuration-subsystems config)) | ||
| 374 | #t))))) | ||
| 364 | 375 | ||
| 365 | (define (openssh-shepherd-service config) | 376 | (define (openssh-shepherd-service config) |
| 366 | "Return a <shepherd-service> for openssh with CONFIG." | 377 | "Return a <shepherd-service> for openssh with CONFIG." |
