Accepting request 918932 from home:jsegitz:branches:systemdhardening:filesystems

Automatic systemd hardening effort by the security team. This has not been tested. For details please see https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort

OBS-URL: https://build.opensuse.org/request/show/918932
OBS-URL: https://build.opensuse.org/package/show/filesystems/e2fsprogs?expand=0&rev=142
This commit is contained in:
Jan Kara 2021-09-15 09:02:50 +00:00 committed by Git OBS Bridge
parent 26487abc61
commit aa2b862d09
6 changed files with 105 additions and 0 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Sep 14 07:03:07 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
- Added hardening to systemd service(s) (bsc#1181400). Added patch(es):
* harden_e2scrub@.service.patch
* harden_e2scrub_all.service.patch
* harden_e2scrub_fail@.service.patch
* harden_e2scrub_reap.service.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Aug 2 20:47:09 UTC 2021 - Jan Kara <jack@suse.cz> Mon Aug 2 20:47:09 UTC 2021 - Jan Kara <jack@suse.cz>

View File

@ -89,6 +89,10 @@ Source5: https://thunk.org/tytso/tytso-key.asc#/%{name}.keyring
Patch3: libcom_err-compile_et_permissions.patch Patch3: libcom_err-compile_et_permissions.patch
Patch4: e2fsprogs-1.42-implicit_fortify_decl.patch Patch4: e2fsprogs-1.42-implicit_fortify_decl.patch
Patch5: e2fsprogs-1.42-ext2fsh_implicit.patch Patch5: e2fsprogs-1.42-ext2fsh_implicit.patch
Patch6: harden_e2scrub@.service.patch
Patch7: harden_e2scrub_all.service.patch
Patch8: harden_e2scrub_fail@.service.patch
Patch9: harden_e2scrub_reap.service.patch
# Do not suppress make commands # Do not suppress make commands
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -253,6 +257,10 @@ Development files for the com_err error message display library. Static librarie
%patch4 %patch4
%patch5 %patch5
cp %{SOURCE2} . cp %{SOURCE2} .
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build %build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects %global _lto_cflags %{_lto_cflags} -ffat-lto-objects

View File

@ -0,0 +1,21 @@
Index: e2fsprogs-1.46.3/scrub/e2scrub@.service.in
===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub@.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub@.service.in
@@ -10,6 +10,16 @@ PrivateNetwork=true
ProtectSystem=true
ProtectHome=read-only
PrivateTmp=yes
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
AmbientCapabilities=CAP_SYS_ADMIN CAP_SYS_RAWIO
NoNewPrivileges=yes
User=root

View File

@ -0,0 +1,23 @@
Index: e2fsprogs-1.46.3/scrub/e2scrub_all.service.in
===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub_all.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub_all.service.in
@@ -6,6 +6,18 @@ ConditionCapability=CAP_SYS_RAWIO
Documentation=man:e2scrub_all(8)
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
Type=oneshot
Environment=SERVICE_MODE=1
ExecStart=@root_sbindir@/e2scrub_all

View File

@ -0,0 +1,23 @@
Index: e2fsprogs-1.46.3/scrub/e2scrub_fail@.service.in
===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub_fail@.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub_fail@.service.in
@@ -3,6 +3,18 @@ Description=Online ext4 Metadata Check F
Documentation=man:e2scrub(8)
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
Type=oneshot
ExecStart=@pkglibdir@/e2scrub_fail "%I"
User=mail

View File

@ -0,0 +1,21 @@
Index: e2fsprogs-1.46.3/scrub/e2scrub_reap.service.in
===================================================================
--- e2fsprogs-1.46.3.orig/scrub/e2scrub_reap.service.in
+++ e2fsprogs-1.46.3/scrub/e2scrub_reap.service.in
@@ -11,6 +11,16 @@ PrivateNetwork=true
ProtectSystem=true
ProtectHome=read-only
PrivateTmp=yes
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectHostname=true
+ProtectClock=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+# end of automatic additions
AmbientCapabilities=CAP_SYS_ADMIN CAP_SYS_RAWIO
NoNewPrivileges=yes
User=root