From 50d17a7dbeaa0d1ddac58387adb4bc8e2fe17cc8 Mon Sep 17 00:00:00 2001 From: "Collin J. Doering" Date: Wed, 29 Mar 2023 22:45:38 -0400 Subject: [PATCH] rekahsoft: Temporarily replace syslogd service to add --hop argument This is necessary to enable log forwarding to a remote host (with configurations that use @ prefixed actions). --- .../guix-config/proxmox-vm-lvm-minimal.scm | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/.guix/rekahsoft/guix-config/proxmox-vm-lvm-minimal.scm b/.guix/rekahsoft/guix-config/proxmox-vm-lvm-minimal.scm index 74f4b4a..909981f 100644 --- a/.guix/rekahsoft/guix-config/proxmox-vm-lvm-minimal.scm +++ b/.guix/rekahsoft/guix-config/proxmox-vm-lvm-minimal.scm @@ -8,8 +8,10 @@ #:use-module (gnu services desktop) #:use-module (gnu services networking) #:use-module (gnu services monitoring) + #:use-module (gnu services shepherd) #:use-module (gnu services ssh) #:use-module (gnu services xorg) + #:use-module (gnu packages admin) #:use-module (gnu packages bash) #:use-module (gnu packages shells) #:export (%proxmox-vm-lvm-minimal-services @@ -18,7 +20,7 @@ (define %automation-user "auto") (define %guix-key (local-file "../../../.pubkeys/guix-coordinator-key.pub")) -(define %syslog-configuration +(define syslog-configuration (plain-file "syslog.conf" " # Log all error messages, authentication messages of @@ -48,6 +50,30 @@ mail.* -/var/log/maillog *.* @logs.home.rekahsoft.ca ")) +;; TODO: this is a temporary solution; the syslogd service configuration should be extended +;; to allow for the various options supported by inetutils syslogd. +(define syslog-service-hop + (simple-service 'syslogd shepherd-root-service-type + (list + ;; Taken from 'gnu/services/base.scm' and and adjusted to allow forwarding to + ;; remote hosts using the '-h|--hop' option + (shepherd-service + (documentation "Run the syslog daemon (syslogd).") + (provision '(syslogd)) + (requirement '(user-processes)) + (actions (list (shepherd-configuration-action syslog-configuration))) + (start #~(let ((spawn (make-forkexec-constructor + (list #$(file-append inetutils "/libexec/syslogd") + "--rcfile" #$syslog-configuration "--hop") + #:pid-file "/var/run/syslog.pid"))) + (lambda () + ;; Set the umask such that file permissions are #o640. + (let ((mask (umask #o137)) + (pid (spawn))) + (umask mask) + pid)))) + (stop #~(make-kill-destructor)))))) + ;; Services need to be exposed this way so they can be overriden via guix's special ;; record inheritance. Otherwise, if trying to directly use an operating-system's ;; services, an error will be recieved about an abiguous-service called 'system. @@ -66,13 +92,12 @@ mail.* -/var/log/maillog ;; Services required by dockerd (service dbus-root-service-type) - (service elogind-service-type)) + (service elogind-service-type) + + syslog-service-hop) (modify-services %base-services - (syslog-service-type - config => (syslog-configuration - (inherit config) - (config-file %syslog-configuration))) + (delete syslog-service-type) (guix-service-type config => (guix-configuration (inherit config)