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).
This commit is contained in:
Collin J. Doering 2023-03-29 22:45:38 -04:00
parent a31e2194a1
commit 50d17a7dbe
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
1 changed files with 31 additions and 6 deletions

View File

@ -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)