diff options
| author | Andreas Enge <andreas@enge.fr> | 2025-11-18 17:23:45 +0100 |
|---|---|---|
| committer | Andreas Enge <andreas@enge.fr> | 2025-11-21 14:35:35 +0100 |
| commit | e1a3b41a4ba0d438559af5a8bbecd6383b226396 (patch) | |
| tree | 5159a53525aeb37ade3c73fe51e764715b05ca7f /gnu/services | |
| parent | ad30252858f066e0b2ec46650e9a8edbc5486699 (diff) | |
gnu: Remove lsh-service-type.
* gnu/services/ssh.scm (<lsh-configuration>, %yarrow-seed,
lsh-initialization, lsh-activation, lsh-shepherd-service,
lsh-pam-services, lsh-service-type): Delete variables.
* doc/guix.texi: Remove lsh-service-type documentation.
Change-Id: I18377a111c10ec6f6d362fadabc64cb66a2b122d
Diffstat (limited to 'gnu/services')
| -rw-r--r-- | gnu/services/ssh.scm | 173 |
1 files changed, 1 insertions, 172 deletions
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm index aac6c1e3539..77359501e4c 100644 --- a/gnu/services/ssh.scm +++ b/gnu/services/ssh.scm @@ -40,11 +40,7 @@ #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:use-module (ice-9 vlist) - #:export (lsh-configuration - lsh-configuration? - lsh-service-type - - openssh-configuration + #:export (openssh-configuration openssh-configuration? openssh-configuration-openssh openssh-configuration-pid-file @@ -87,173 +83,6 @@ ;;; ;;; This module implements secure shell (SSH) services. ;;; -;;; Code: - -(define-record-type* <lsh-configuration> - lsh-configuration make-lsh-configuration - lsh-configuration? - (lsh lsh-configuration-lsh - (default lsh)) - (daemonic? lsh-configuration-daemonic? - (default #t)) - (host-key lsh-configuration-host-key - (default "/etc/lsh/host-key")) - (interfaces lsh-configuration-interfaces - (default '())) - (port-number lsh-configuration-port-number - (default 22)) - (allow-empty-passwords? lsh-configuration-allow-empty-passwords? - (default #f)) - (root-login? lsh-configuration-root-login? - (default #f)) - (syslog-output? lsh-configuration-syslog-output? - (default #t)) - (pid-file? lsh-configuration-pid-file? - (default #f)) - (pid-file lsh-configuration-pid-file - (default "/var/run/lshd.pid")) - (x11-forwarding? lsh-configuration-x11-forwarding? - (default #t)) - (tcp/ip-forwarding? lsh-configuration-tcp/ip-forwarding? - (default #t)) - (password-authentication? lsh-configuration-password-authentication? - (default #t)) - (public-key-authentication? lsh-configuration-public-key-authentication? - (default #t)) - (initialize? lsh-configuration-initialize? - (default #t))) - -(define %yarrow-seed - "/var/spool/lsh/yarrow-seed-file") - -(define (lsh-initialization lsh host-key) - "Return the gexp to initialize the LSH service for HOST-KEY." - #~(begin - (unless (file-exists? #$%yarrow-seed) - (system* (string-append #$lsh "/bin/lsh-make-seed") - "--sloppy" "-o" #$%yarrow-seed)) - - (unless (file-exists? #$host-key) - (mkdir-p (dirname #$host-key)) - (format #t "creating SSH host key '~a'...~%" #$host-key) - - ;; FIXME: We're just doing a simple pipeline, but 'system' cannot be - ;; used yet because /bin/sh might be dangling; factorize this somehow. - (let* ((in+out (pipe)) - (keygen (primitive-fork))) - (case keygen - ((0) - (close-port (car in+out)) - (close-fdes 1) - (dup2 (fileno (cdr in+out)) 1) - (execl (string-append #$lsh "/bin/lsh-keygen") - "lsh-keygen" "--server")) - (else - (let ((write-key (primitive-fork))) - (case write-key - ((0) - (close-port (cdr in+out)) - (close-fdes 0) - (dup2 (fileno (car in+out)) 0) - (execl (string-append #$lsh "/bin/lsh-writekey") - "lsh-writekey" "--server" "-o" #$host-key)) - (else - (close-port (car in+out)) - (close-port (cdr in+out)) - (waitpid keygen) - (waitpid write-key)))))))))) - -(define (lsh-activation config) - "Return the activation gexp for CONFIG." - #~(begin - (use-modules (guix build utils)) - (mkdir-p "/var/spool/lsh") - #$(if (lsh-configuration-initialize? config) - (lsh-initialization (lsh-configuration-lsh config) - (lsh-configuration-host-key config)) - #t))) - -(define (lsh-shepherd-service config) - "Return a <shepherd-service> for lsh with CONFIG." - (define lsh (lsh-configuration-lsh config)) - (define pid-file (lsh-configuration-pid-file config)) - (define pid-file? (lsh-configuration-pid-file? config)) - (define daemonic? (lsh-configuration-daemonic? config)) - (define interfaces (lsh-configuration-interfaces config)) - - (define lsh-command - (append - (cons (file-append lsh "/sbin/lshd") - (if daemonic? - (let ((syslog (if (lsh-configuration-syslog-output? config) - '() - (list "--no-syslog")))) - (cons "--daemonic" - (if pid-file? - (cons #~(string-append "--pid-file=" #$pid-file) - syslog) - (cons "--no-pid-file" syslog)))) - (if pid-file? - (list #~(string-append "--pid-file=" #$pid-file)) - '()))) - (cons* #~(string-append "--host-key=" - #$(lsh-configuration-host-key config)) - #~(string-append "--password-helper=" #$lsh "/sbin/lsh-pam-checkpw") - #~(string-append "--subsystems=sftp=" #$lsh "/sbin/sftp-server") - "-p" (number->string (lsh-configuration-port-number config)) - (if (lsh-configuration-password-authentication? config) - "--password" "--no-password") - (if (lsh-configuration-public-key-authentication? config) - "--publickey" "--no-publickey") - (if (lsh-configuration-root-login? config) - "--root-login" "--no-root-login") - (if (lsh-configuration-x11-forwarding? config) - "--x11-forward" "--no-x11-forward") - (if (lsh-configuration-tcp/ip-forwarding? config) - "--tcpip-forward" "--no-tcpip-forward") - (if (null? interfaces) - '() - (map (cut string-append "--interface=" <>) - interfaces))))) - - (define requires - `(user-processes - networking - pam - ,@(if (and daemonic? (lsh-configuration-syslog-output? config)) - '(syslogd) - '()))) - - (list (shepherd-service - (documentation "GNU lsh SSH server") - (provision '(ssh-daemon ssh sshd)) - (requirement requires) - (start #~(make-forkexec-constructor (list #$@lsh-command))) - (stop #~(make-kill-destructor))))) - -(define (lsh-pam-services config) - "Return a list of <pam-services> for lshd with CONFIG." - (list (unix-pam-service - "lshd" - #:login-uid? #t - #:allow-empty-passwords? - (lsh-configuration-allow-empty-passwords? config)))) - -(define lsh-service-type - (service-type - (name 'lsh) - (extensions - (list (service-extension shepherd-root-service-type - lsh-shepherd-service) - (service-extension pam-root-service-type - lsh-pam-services) - (service-extension activation-service-type - lsh-activation))) - (description "Run the GNU@tie{}lsh secure shell (SSH) daemon, -@command{lshd}.") - (default-value (lsh-configuration)))) - -;;; ;;; OpenSSH. ;;; |
