[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gnu: Use a directory owned by ntpd user for drift file.
From: |
John Darrington |
Subject: |
[PATCH] gnu: Use a directory owned by ntpd user for drift file. |
Date: |
Wed, 7 Sep 2016 21:52:36 +0200 |
Fixes bug #24366
* gnu/services/networking.scm (ntp-shepherd-service): Create new
directory at startup.
---
gnu/services/networking.scm | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 71f49a0..f983961 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
;;; Copyright © 2015 Mark H Weaver <address@hidden>
;;; Copyright © 2016 Efraim Flashner <address@hidden>
+;;; Copyright © 2016 John Darrington <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -272,7 +273,7 @@ Protocol (DHCP) client, on all the non-loopback network
interfaces."
(let ()
;; TODO: Add authentication support.
(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")
@@ -307,13 +308,28 @@ restrict -6 ::1\n"))
(home-directory "/var/empty")
(shell #~(string-append #$shadow "/sbin/nologin")))))
+
+(define (ntp-service-activation config)
+ "Return the activation gexp for config"
+ #~(begin
+ (use-modules (guix build utils))
+
+ (define %user
+ (getpw "ntpd"))
+
+ (let ((directory "/var/run/ntpd"))
+ (mkdir-p directory)
+ (chown directory (passwd:uid %user) (passwd:gid %user)))))
+
(define ntp-service-type
(service-type (name 'ntp)
(extensions
(list (service-extension shepherd-root-service-type
ntp-shepherd-service)
(service-extension account-service-type
- (const %ntp-accounts))))))
+ (const %ntp-accounts))
+ (service-extension activation-service-type
+ ntp-service-activation)))))
(define* (ntp-service #:key (ntp ntp)
(servers %ntp-servers))
--
2.1.4
- [PATCH] gnu: Use a directory owned by ntpd user for drift file.,
John Darrington <=