mirror of
https://git.yoctoproject.org/meta-security
synced 2026-08-30 00:32:21 +00:00
samhain: fix server startup failure on systemd-based systems
Fix two issues preventing samhain-server (yule) from starting: 1. The compiled-in PID file path /var/run/samhain.pid fails because /var/run is a symlink to /run on systemd-based systems, and samhain's security check rejects symlinks for PID directories. Add SetLockfilePath = /run/yule.pid to yulerc.template, following the same approach used in 0004-Set-the-PID-Lock-path-for-samhain.pid for the standalone/client configuration. 2. The init scripts unconditionally source /etc/default/rcS which does not exist on systemd-based systems, producing a confusing error message. Source it conditionally instead. Signed-off-by: Bin Cao <bin.cao.cn@windriver.com> (adapted against prior 4.5.3 upgrade) Signed-off-by: Scott Murray <scott.murray@konsulko.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
From 7070832b4652f3cdaa2e37325fc6f9456859cb5d Mon Sep 17 00:00:00 2001
|
||||
From: Bin Cao <bin.cao.cn@windriver.com>
|
||||
Date: Mon, 25 May 2026 14:55:37 +0800
|
||||
Subject: [PATCH] yulerc: set SetLockfilePath to /run/yule.pid
|
||||
|
||||
On systemd-based systems, /var/run is a symlink to /run. Samhain's
|
||||
security-hardened code uses lstat() to verify the PID file directory
|
||||
is a real directory and rejects symlinks. This causes yule (the samhain
|
||||
server) to fail to start with "Path of PID directory refers to a
|
||||
non-directory object".
|
||||
|
||||
Set SetLockfilePath explicitly to /run/yule.pid to bypass the
|
||||
compiled-in default of /var/run/samhain.pid.
|
||||
|
||||
This is the same approach used in 0004-Set-the-PID-Lock-path-for-
|
||||
samhain.pid.patch for the standalone/client configuration.
|
||||
|
||||
Upstream-Status: Inappropriate [OE-specific configuration]
|
||||
Signed-off-by: Bin Cao <bin.cao.cn@windriver.com>
|
||||
---
|
||||
yulerc.template | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/yulerc.template b/yulerc.template
|
||||
index 512bc0d..24b437c 100644
|
||||
--- a/yulerc.template
|
||||
+++ b/yulerc.template
|
||||
@@ -173,6 +173,10 @@ Daemon=yes
|
||||
# SetLoopTime = 60
|
||||
SetLoopTime = 600
|
||||
|
||||
+## Path to the PID file
|
||||
+#
|
||||
+SetLockfilePath = /run/yule.pid
|
||||
+
|
||||
## Normally, client messages are regarded as data within a
|
||||
## server message of fixed severity. The following two
|
||||
## options cause the server to use the original severity/class
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -13,7 +13,8 @@ DAEMON=/usr/sbin/samhain
|
||||
RETVAL=0
|
||||
PIDFILE=/var/run/samhain.pid
|
||||
|
||||
. /etc/default/rcS
|
||||
# Source rcS only if it exists (not present on systemd-based systems)
|
||||
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
||||
|
||||
. /etc/default/samhain-client
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ DAEMON=/usr/sbin/yule
|
||||
RETVAL=0
|
||||
PIDFILE=/var/run/yule.pid
|
||||
|
||||
. /etc/default/rcS
|
||||
# Source rcS only if it exists (not present on systemd-based systems)
|
||||
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
||||
|
||||
. /etc/default/samhain-server
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ SRC_URI = "https://la-samhna.de/archive/samhain_signed-${PV}.tar.gz \
|
||||
file://0009-fix-build-with-new-version-attr.patch \
|
||||
file://0010-Fix-initializer-element-is-not-constant.patch \
|
||||
file://0001-Format-test-output-to-match-Automake-standards.patch \
|
||||
file://0013-yulerc-set-SetLockfilePath-to-run-yule.pid.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "e7837adfde3d59a23c59e1bf3ebacdf71bce018619194cfad938cd30cbb9d15b"
|
||||
|
||||
Reference in New Issue
Block a user