unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: John Darrington <jmd@gnu.org>
To: 24366@debbugs.gnu.org
Cc: John Darrington <jmd@gnu.org>
Subject: bug#24366: [PATCH] gnu: Use a directory owned by ntpd user for drift file.
Date: Tue,  6 Sep 2016 21:05:21 +0200	[thread overview]
Message-ID: <1473188721-15624-1-git-send-email-jmd@gnu.org> (raw)
In-Reply-To: <20160904204353.GA515@jasmine>

I think this fixes the problem.  What do you think?


* gnu/services/networking.scm (ntp-shepherd-service): Create new
directory at startup.
---
 gnu/services/networking.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 71f49a0..714dc80 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -271,8 +271,11 @@ Protocol (DHCP) client, on all the non-loopback network interfaces."
     (($ <ntp-configuration> ntp servers)
      (let ()
        ;; TODO: Add authentication support.
+       (define %user
+         (getpw "ntpd"))
+
        (define config
-         (string-append "driftfile /var/run/ntp.drift\n"
+         (string-append "driftfile /var/run/ntpd/ntp.drift\n"
                         (string-join (map (cut string-append "server " <>)
                                           servers)
                                      "\n")
@@ -294,6 +297,8 @@ restrict -6 ::1\n"))
               (documentation "Run the Network Time Protocol (NTP) daemon.")
               (requirement '(user-processes networking))
               (start #~(make-forkexec-constructor
+                        (mkdir-p "/var/run/ntpd")
+                        (chown "/var/run/nptd"  (passwd:uid %user) (passwd:gid %user))
                         (list (string-append #$ntp "/bin/ntpd") "-n"
                               "-c" #$ntpd.conf "-u" "ntpd")))
               (stop #~(make-kill-destructor))))))))
-- 
2.1.4

  parent reply	other threads:[~2016-09-06 19:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 17:45 bug#24366: ntpd cannot write to its drift file John Darrington
2016-09-04 20:22 ` Leo Famulari
2016-09-04 20:24   ` John Darrington
2016-09-04 20:43     ` Leo Famulari
2016-09-04 21:12       ` John Darrington
2016-09-06 19:05       ` John Darrington [this message]
2016-09-09 14:26         ` bug#24366: [PATCH] gnu: Use a directory owned by ntpd user for " Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=1473188721-15624-1-git-send-email-jmd@gnu.org \
    --to=jmd@gnu.org \
    --cc=24366@debbugs.gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).