public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/smartmontools] f43: update smartdnotify to avoid some selinux errors (#2542445)
@ 2026-10-08 16:54 Michal Hlavinka
0 siblings, 0 replies; only message in thread
From: Michal Hlavinka @ 2026-10-08 16:54 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/smartmontools
Branch : f43
Commit : 47bd6d74f6c52aae80c3d4674889ce4d4f5e0402
Author : Michal Hlavinka <mhlavink@redhat.com>
Date : 2026-10-08T17:57:19+02:00
Stats : +38/-46 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/smartmontools/c/47bd6d74f6c52aae80c3d4674889ce4d4f5e0402?branch=f43
Log:
update smartdnotify to avoid some selinux errors (#2542445)
---
diff --git a/smartdnotify b/smartdnotify
index cd49631..a039b05 100644
--- a/smartdnotify
+++ b/smartdnotify
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/usr/bin/sh
# Send mail
if which mail >/dev/null 2>&1
@@ -16,9 +16,20 @@ then
SESSION_TYPE=$(loginctl show-session "$SESSION_ID" -p Type --value 2>/dev/null)
case "$SESSION_TYPE" in
x11|wayland)
- DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$SESS_UID/bus" \
- runuser -u "$USER" -- notify-send -u critical -i drive-harddisk "SMART Disk Monitor" "$MESSAGE" 2>/dev/null ||:
- ;;
+ # Fetch the exact display variable associated with this specific loginctl session
+ if [ "$SESSION_TYPE" = "x11" ]; then
+ DISP_ENV="DISPLAY=$(loginctl show-session "$SESSION_ID" -p Display --value 2>/dev/null)"
+ else
+ # For Wayland, fetch the WAYLAND_DISPLAY value
+ # Fallback to wayland-0 if loginctl doesn't store it natively on older systemd versions
+ WAYLAND_VAL=$(loginctl show-session "$SESSION_ID" -p WaylandDisplay --value 2>/dev/null)
+ DISP_ENV="WAYLAND_DISPLAY=${WAYLAND_VAL:-wayland-0}"
+ fi
+
+ # Deliver via systemd-run using the session-specific display context
+ systemd-run --user --machine="$USER@.host" env "$DISP_ENV" \
+ notify-send -u critical -i drive-harddisk "SMART Disk Monitor" "$MESSAGE" 2>/dev/null || :
+ ;;
esac
done
fi
diff --git a/smartmon.te b/smartmon.te
index 861a645..c30d1f4 100644
--- a/smartmon.te
+++ b/smartmon.te
@@ -1,4 +1,4 @@
-policy_module(smartmon, 1.14.0)
+policy_module(smartmon, 1.15.0)
########################################
#
@@ -15,11 +15,12 @@ gen_tunable(smartmon_3ware, false)
require {
class capability dac_override;
+ class unix_dgram_socket sendto;
+ class filesystem getattr;
+ class unix_stream_socket { ioctl read write };
+ class system { start status };
type tmpfs_t, fs_t, tty_device_t, user_devpts_t, system_mail_t, sssd_var_lib_t, systemd_logind_sessions_t, mail_home_t;
- type kernel_t, sssd_public_t, sssd_t, devlog_t, systemd_logind_t, syslogd_var_run_t, unconfined_t;
- type systemd_userdbd_runtime_t, systemd_homed_t, systemd_machined_t, systemd_userdbd_t;
- type system_dbusd_t, system_dbusd_var_run_t;
- type session_dbusd_tmp_t, user_tmp_t, unconfined_dbusd_t;
+ type kernel_t, pidfs_t, init_t;
}
type fsdaemon_t;
@@ -51,6 +52,19 @@ hostname_domtrans(smartdwarn_t)
# smartd_warning.sh to run smartd_warning.d/* scripts
allow smartdwarn_t smartdwarn_script_t:file execute_no_trans;
+# for notify-send (including systemd-run)
+allow smartdwarn_t self:unix_dgram_socket create_socket_perms;
+allow smartdwarn_t kernel_t:unix_dgram_socket sendto;
+allow smartdwarn_t pidfs_t:filesystem getattr;
+dbus_system_bus_client(smartdwarn_t)
+systemd_dbus_chat_logind(smartdwarn_t)
+init_dbus_chat(smartdwarn_t)
+allow init_t smartdwarn_t:unix_stream_socket { ioctl read write };
+allow smartdwarn_t init_t:system { start status };
+allow system_dbusd_t smartdwarn_t:unix_stream_socket { read write };
+
+
+
# for wall cmd
init_read_utmp(smartdwarn_t)
allow smartdwarn_t tty_device_t:chr_file { open write };
@@ -61,42 +75,6 @@ allow smartdwarn_t systemd_logind_sessions_t:file { getattr open read };
allow smartdwarn_t sssd_var_lib_t:dir search;
allow smartdwarn_t sssd_var_lib_t:sock_file write;
-# for loginctl (sd_notify socket and system D-Bus)
-allow smartdwarn_t self:unix_dgram_socket { create getopt setopt connect write };
-allow smartdwarn_t kernel_t:unix_dgram_socket sendto;
-allow smartdwarn_t system_dbusd_var_run_t:dir search;
-allow smartdwarn_t system_dbusd_var_run_t:sock_file write;
-allow smartdwarn_t system_dbusd_t:unix_stream_socket connectto;
-allow smartdwarn_t system_dbusd_t:dbus send_msg;
-allow smartdwarn_t systemd_logind_t:dbus send_msg;
-allow smartdwarn_t unconfined_t:dbus send_msg;
-
-# for runuser (user lookup via SSSD)
-allow smartdwarn_t sssd_public_t:dir search;
-allow smartdwarn_t sssd_public_t:file { read open getattr map };
-allow smartdwarn_t sssd_t:unix_stream_socket connectto;
-
-# for runuser (user lookup via systemd-userdb)
-allow smartdwarn_t systemd_userdbd_runtime_t:dir { getattr open read search };
-allow smartdwarn_t systemd_userdbd_runtime_t:sock_file write;
-allow smartdwarn_t systemd_userdbd_runtime_t:lnk_file read;
-allow smartdwarn_t systemd_homed_t:unix_stream_socket connectto;
-allow smartdwarn_t systemd_machined_t:unix_stream_socket connectto;
-allow smartdwarn_t systemd_userdbd_t:unix_stream_socket connectto;
-
-# for runuser (PAM audit and syslog)
-allow smartdwarn_t self:netlink_audit_socket { create read write nlmsg_relay };
-allow smartdwarn_t self:process setsched;
-allow smartdwarn_t devlog_t:lnk_file read;
-allow smartdwarn_t devlog_t:sock_file write;
-allow smartdwarn_t syslogd_var_run_t:dir search;
-
-# for notify-send (user session D-Bus)
-allow smartdwarn_t user_tmp_t:dir search;
-allow smartdwarn_t session_dbusd_tmp_t:sock_file write;
-allow smartdwarn_t unconfined_dbusd_t:unix_stream_socket connectto;
-allow smartdwarn_t unconfined_dbusd_t:dbus send_msg;
-
files_manage_generic_tmp_files(smartdwarn_t)
term_open_unallocated_ttys(smartdwarn_t)
term_search_ptys(smartdwarn_t)
diff --git a/smartmontools.spec b/smartmontools.spec
index ac3fb0b..cb9cd4d 100644
--- a/smartmontools.spec
+++ b/smartmontools.spec
@@ -7,7 +7,7 @@
Summary: Tools for monitoring SMART capable hard disks
Name: smartmontools
Version: 7.5
-Release: 9%{?dist}
+Release: 10%{?dist}
Epoch: 1
License: GPL-2.0-or-later
URL: https://www.smartmontools.org/
@@ -175,6 +175,9 @@ fi
%changelog
+* Thu Oct 08 2026 Michal Hlavinka <mhlavink@redhat.com> - 1:7.5-10
+- update smartdnotify to avoid some selinux errors (#2542445)
+
* Sat Aug 15 2026 Michal Hlavinka <mhlavink@redhat.com> - 1:7.5-9
- use notify-send for notification for users with graphical sessions
- smartd notify for all SMARTD_FAILTYPEs
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-08 16:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 16:54 [rpms/smartmontools] f43: update smartdnotify to avoid some selinux errors (#2542445) Michal Hlavinka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox