Bug#950459: initscripts: bootmisc.sh needs to set SE Linux context after file creation

Russell Coker russell at coker.com.au
Sun Feb 2 00:32:56 GMT 2020

Package: initscripts
Version: 2.96-2.1
Severity: normal
Tags: patch

The following patch gives the correct SE Linux context for this file and does
nothing on systems that don't have SE Linux.  Generally any time a system
script creates a file and needs to run chmod or similar it will need to run

--- /etc/init.d/bootmisc.sh.orig	2020-02-02 00:28:31.053649650 +0000
+++ /etc/init.d/bootmisc.sh	2020-02-02 00:29:32.454386939 +0000
@@ -35,6 +35,7 @@
 	if > "${utmp}" ; then
 		chgrp utmp "${utmp}" || log_warning_msg "failed to chgrp ${utmp}"
 		chmod 664  "${utmp}" || log_warning_msg "failed to chmod ${utmp}"
+		[ -x /sbin/restorecon ] && /sbin/restorecon "${utmp}"
 		return 0
 		log_failure_msg "failed to truncate ${utmp}"

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-6-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: SELinux: enabled - Mode: Enforcing - Policy name: default

Versions of packages initscripts depends on:
ii  coreutils       8.30-3+b1
ii  debianutils     4.9.1
ii  lsb-base        11.1.0
ii  sysv-rc         2.96-2.1
ii  sysvinit-utils  2.96-2.1

Versions of packages initscripts recommends:
iu  e2fsprogs  1.45.5-2
ii  psmisc     23.2-1

initscripts suggests no packages.

-- Configuration Files:
/etc/init.d/bootmisc.sh changed [not included]
/etc/rc.local changed [not included]

-- no debconf information

More information about the Debian-init-diversity mailing list