all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: jbranso@dismail.de
To: "Josua Stingelin" <josuast@hotmail.com>, guix-devel@gnu.org
Subject: Re: unbound-service-type
Date: Sat, 12 Feb 2022 03:43:08 +0000	[thread overview]
Message-ID: <40b2f100c498883e155e6ceb66d30da3@dismail.de> (raw)
In-Reply-To: <DB9PR06MB7657C505B6B580A05DED5487AA309@DB9PR06MB7657.eurprd06.prod.outlook.com>

February 11, 2022 6:43 AM, "Josua Stingelin" <josuast@hotmail.com> wrote:

> Hei Guix!
> 
> As far as I can see there's no service type to run unbound. A local, recursive,
> caching DNS server.
> 
> I've tried to create it - but it doesn't quite work.
> 
> In order to be pushed upstream I'd like to add the configuration of the options
> easily using the unbound-configuration-type.
> 
> For now I'd just like to get it up and running to start playing around with
> more configuration options.
> 
> I'd like unbound to run in a chroot and with the user unbound.
> 
> So I started with the user account.
> 
> (define %unbound-accounts
> (list (user-account
> (name "unbound")
> (group "nogroup")
> (system? #t)
> (comment "unbound daemon user")
> (home-directory "/etc/unbound")
> (shell (file-append shadow "/sbin/nologin")))))
> 
> Then I defined the unbound-configuration record type. Later on I want to expand
> that. (Allow configuring of the user, group and directly set properties instead
> of copying the configuration file)
> 
> (define-record-type* <unbound-configuration>
> unbound-configuration make-unbound-configuration
> unbound-configuration?
> (package unbound-configuration-package
> (default unbound))
> (pid-file unbound-configuration-pid-file
> (default "/etc/unbound/unbound.pid")))
> 
> Next there is the shepherd-service configuration.
> 
> (define unbound-shepherd-service
> (match-lambda
> (($ <unbound-configuration> package pid-file)
> (list (shepherd-service
> (provision '(unbound))
> (documentation "Run the unbound DNS server.")
> (requirement '(networking))
> (start #~(make-forkexec-constructor
> '(#$(file-append package "/sbin/unbound")
> "-d"
> "-c" "/etc/unbound/unbound.conf")
> #:pid-file #$pid-file))
> (stop #~(make-kill-destructor)))))))
> 
> Based on these definitions I can now create the unbound-service-type.
> 
> (define unbound-service-type
> (service-type
> (name 'unbound)
> (extensions
> (list (service-extension shepherd-root-service-type unbound-shepherd-service)
> (service-extension account-service-type (const %unbound-accounts))))
> (default-value (unbound-configuration))
> (description "Run the unbound DNS server")))
> 
> However when I add these to my operating-system configuration, and copy the
> configuration file using the etc-service-type it doesn't run on start.
> 
> (operating-system
> ...
> (services (append (list
> (simple-service 'unbound-service
> etc-service-type
> `(("unbound/unbound.conf", (local-file "unbound/unbound.conf"))
> ("unbound/root.hints", (local-file "unbound/root.hints"))
> ("unbound/root.key", (local-file "unbound/root.key"))))
> (service unbound-service-type))
> %base-services)))
> 
> As /etc/unbound is owned by root and a symlink to /etc/static/unbound that
> isn't surprising.
> 
> How would I configure such a service under Guix (point me to an example maybe?)
> and which directory should be used for the chroot? /etc/unbound doesn't feel
> quite right.

I made some online videos of me a while ago trying to compliment the existing opensmtpd-service
that guix has.  It might not be a specific answer to your problem but perhaps you could get some
ideas workflow suggestions:

the videos are here: https://video.hardlimit.com/w/p/bmbYAkQ84BBfF4aAZNAPcR

> 
> Kind Regards
> Josua a.k.a Joshua/Josh


  reply	other threads:[~2022-02-12  3:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 11:42 unbound-service-type Josua Stingelin
2022-02-12  3:43 ` jbranso [this message]
2022-02-14 21:42 ` unbound-service-type Ludovic Courtès
2022-02-20 17:06   ` unbound-service-type Josua Stingelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40b2f100c498883e155e6ceb66d30da3@dismail.de \
    --to=jbranso@dismail.de \
    --cc=guix-devel@gnu.org \
    --cc=josuast@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.