Bug 1215400 - munin-node calls 'logtail /etc/hosts' which then segfaults
Summary: munin-node calls 'logtail /etc/hosts' which then segfaults
Status: NEW
Alias: None
Product: PUBLIC SUSE Linux Enterprise Server 15 SP5
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: unspecified
Hardware: Other Other
: P5 - None : Major
Target Milestone: ---
Assignee: Bernhard Wiedemann
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-15 20:10 UTC by Christian Boltz
Modified: 2023-09-15 20:13 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Boltz 2023-09-15 20:10:46 UTC
munin comes with a cronjob that runs every 5 minutes as user munin:

    */5 * * * *     munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron

Unfortunately this cronjobs triggers logtail segfaults every time it runs (and spams /var/log/messages while doing so) - see bug 1215399 for the logtail part of this bug.


On the munin side, the problem is:

/usr/lib/munin/plugins/amavis calls
    logtail /etc/hosts
which then segfaults because it can't write /etc/hosts.offset. (You can reproduce this by manually running   logtail /etc/hosts   as non-root.)


The fix is to specify a writeable path for the offset file:

--- /usr/lib/munin/plugins/amavis_ORIG  2023-09-15 21:49:38.926514309 +0200
+++ /usr/lib/munin/plugins/amavis       2023-09-15 21:50:45.762436708 +0200
@@ -77,6 +77,7 @@
 AMAVIS_LOG=${amavislog:-/var/log/mail/mail.info}
 LOGTAIL=${logtail:-logtail}
 STATEFILE=$MUNIN_PLUGSTATE/amavis.offset
+HOSTS_STATEFILE=$MUNIN_PLUGSTATE/amavis-hosts.offset

 if [ "$1" = "autoconf" ]; then
        if [ -f "${AMAVIS_LOG}" ] && [ -n "${LOGTAIL}" ] && [ -x "${LOGTAIL}" ] ; then
@@ -90,7 +91,7 @@

 # Try tailing a random file to check how arguments are passed
 ARGS=0
-"$LOGTAIL" /etc/hosts 2>/dev/null >/dev/null
+"$LOGTAIL" /etc/hosts "$HOSTS_STATEFILE" 2>/dev/null >/dev/null
 if [ $? = 66 ]; then
     if [ -z "$logtail" ]; then
        ARGS=1



/usr/lib/munin/plugins/courier_ and /usr/lib/munin/plugins/perdition also contain
    "$LOGTAIL" /etc/hosts 2>/dev/null >/dev/null
and will need a similar patch.


This bug is a regression in Leap 15.5.
On Leap 15.4, I didn't see these segfaults (maybe the old munin package didn't have the "logtail /etc/hosts" calls?)
Comment 1 Christian Boltz 2023-09-15 20:13:56 UTC
As a side note: logtail was split into a separate package, therefore you might want to change "Recommends: logdigest" to "Recommends: logtail" (or maybe even "Requires: logtail"?)