guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GHM debriefing


From: Christopher Allan Webber
Subject: Re: GHM debriefing
Date: Mon, 29 Aug 2016 10:20:59 -0500
User-agent: mu4e 0.9.16; emacs 24.5.1

All good news!  One comment:

Ludovic Courtès writes:

> For the last talk, I rehashed the basics since the audience wasn’t too
> familiar I suppose, and then wrote a GuixSD service for OpenSSH’s ‘sshd’
> (attached).  Hopefully a useful starting point and tutorial.

It looks like a good tutorial in its simplicity!  Maybe it could be
added as an "example" section at the end of the Defining Services
chapter?

You might have also seen that, as a non-tutorial, Julien Lepiller has
been working on getting an openssh-service into GuixSD.  It might be
good for someone to look if there are any overlaps or things that should
be joined between both definitions, as in terms of getting it really
into Guix :)

(Unfortunately, I'm still in crunchmode, so I'm not volunteering
myself!)

 - Chris

> That’s it!
>
> Ludo’.
>
> (define-module (gnu services openssh)
>   #:use-module (gnu)
>   #:use-module (gnu services shepherd)
>   #:use-module (gnu packages ssh)
>   #:use-module (guix)
>   #:export (openssh-service-type))
>
> (define (ssh-shepherd-service config-file)
>   (list (shepherd-service
>          (provision '(ssh-daemon))
>          (requirement '(networking))
>          (start #~(make-forkexec-constructor
>                    (list (string-append #$openssh "/sbin/sshd")
>                          "-f" #$config-file)
>                    #:pid-file "/etc/sshd.pid"))
>          (stop #~(make-kill-destructor)))))
>
> (define %sshd-accounts
>   (list (user-account
>          (name "sshd")
>          (comment "OpenSSH privilege separation user")
>          (home-directory "/var/empty")
>          (system? #t)
>          (group "nogroup"))))
>
> (define %sshd-keygen
>   #~(system* (string-append #$openssh "/bin/ssh-keygen")
>              "-t" "ed25519" "-N" "" "-f"
>              "/etc/ssh_host_ed25519_key"))
>
> (define openssh-service-type
>   (service-type
>    (name 'openssh)
>    (extensions (list (service-extension shepherd-root-service-type
>                                         ssh-shepherd-service)
>                      (service-extension account-service-type
>                                         (const %sshd-accounts))
>                      (service-extension activation-service-type
>                                         (const %sshd-keygen))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]