diff options
author | Shrikant Bobade <shrikant_bobade@mentor.com> | 2016-08-29 19:08:25 +0530 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2016-09-01 14:30:47 -0400 |
commit | ad4ca6ad63de4f2da4412b91bc48aebf85c03f9c (patch) | |
tree | 568175fdfea60b421ebfdbb855bdefee2fc54936 | |
parent | 01556456a076d4e96d8a292872ea277580df26ce (diff) | |
download | meta-selinux-ad4ca6ad63de4f2da4412b91bc48aebf85c03f9c.tar.gz |
refpolicy-minimum: systemd: fix for login & journal service
1. fix for systemd services: login & journal wile using refpolicy-minimum
and systemd as init manager.
2. fix login duration after providing root password.
Signed-off-by: Shrikant Bobade <shrikant_bobade@mentor.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r-- | recipes-security/refpolicy/refpolicy-minimum/0007-refpolicy-minimum-systemd-fix-for-login-journal-serv.patch | 105 | ||||
-rw-r--r-- | recipes-security/refpolicy/refpolicy-minimum_2.20151208.bb | 1 |
2 files changed, 106 insertions, 0 deletions
diff --git a/recipes-security/refpolicy/refpolicy-minimum/0007-refpolicy-minimum-systemd-fix-for-login-journal-serv.patch b/recipes-security/refpolicy/refpolicy-minimum/0007-refpolicy-minimum-systemd-fix-for-login-journal-serv.patch new file mode 100644 index 0000000..50e3c64 --- /dev/null +++ b/recipes-security/refpolicy/refpolicy-minimum/0007-refpolicy-minimum-systemd-fix-for-login-journal-serv.patch | |||
@@ -0,0 +1,105 @@ | |||
1 | From 5a1cef9e4a9472982f6c68190f3aa20c73c8de1e Mon Sep 17 00:00:00 2001 | ||
2 | From: Shrikant Bobade <shrikant_bobade@mentor.com> | ||
3 | Date: Fri, 26 Aug 2016 17:54:09 +0530 | ||
4 | Subject: [PATCH 7/9] refpolicy-minimum: systemd: fix for login & journal | ||
5 | service | ||
6 | |||
7 | 1. fix for systemd services: login & journal wile using refpolicy-minimum and | ||
8 | systemd as init manager. | ||
9 | 2. fix login duration after providing root password. | ||
10 | |||
11 | without these changes we are getting avc denails like these and below | ||
12 | systemd services failure: | ||
13 | |||
14 | audit[]: AVC avc: denied { write } for pid=422 comm="login" path="/run/ | ||
15 | systemd/sessions/c1.ref" dev="tmpfs" ino=13455 scontext=system_u:system_r: | ||
16 | local_login_t:s0-s0:c0.c1023 tcontext=system_u:object_r:init_var_run_t:s0 | ||
17 | tclass=fifo_file permissive=0 | ||
18 | |||
19 | audit[]: AVC avc: denied { open } for pid=216 comm="systemd-tmpfile" path | ||
20 | ="/proc/1/environ" dev="proc" ino=9221 scontext=system_u:system_r: | ||
21 | systemd_tmpfiles_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=file | ||
22 | |||
23 | audit[]: USER_AVC pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u: | ||
24 | system_r:init_t:s0 msg='avc: denied { stop } for auid=n/a uid=0 gid=0 path | ||
25 | ="/lib/systemd/system/systemd-journald.service" cmdline="/bin/journalctl | ||
26 | --flush" scontext=system_u:system_r:initrc_t:s0 tcontext=system_u:object_r: | ||
27 | lib_t:s0 tclass=service | ||
28 | |||
29 | [FAILED] Failed to start Flush Journal to Persistent Storage. | ||
30 | See 'systemctl status systemd-journal-flush.service' for details. | ||
31 | |||
32 | [FAILED] Failed to start Login Service. | ||
33 | See 'systemctl status systemd-logind.service' for details. | ||
34 | |||
35 | [FAILED] Failed to start Avahi mDNS/DNS-SD Stack. | ||
36 | See 'systemctl status avahi-daemon.service' for details. | ||
37 | |||
38 | Upstream-Status: Pending | ||
39 | |||
40 | Signed-off-by: Shrikant Bobade <shrikant_bobade@mentor.com> | ||
41 | --- | ||
42 | policy/modules/system/init.te | 5 +++++ | ||
43 | policy/modules/system/locallogin.te | 3 +++ | ||
44 | policy/modules/system/systemd.if | 6 ++++-- | ||
45 | policy/modules/system/systemd.te | 3 ++- | ||
46 | 4 files changed, 14 insertions(+), 3 deletions(-) | ||
47 | |||
48 | diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te | ||
49 | index 19a7a20..cefa59d 100644 | ||
50 | --- a/policy/modules/system/init.te | ||
51 | +++ b/policy/modules/system/init.te | ||
52 | @@ -1105,3 +1105,8 @@ allow init_t self:capability2 audit_read; | ||
53 | |||
54 | allow initrc_t init_t:system { start status reboot }; | ||
55 | allow initrc_t init_var_run_t:service { start status }; | ||
56 | + | ||
57 | +allow initrc_t init_var_run_t:service stop; | ||
58 | +allow initrc_t init_t:dbus send_msg; | ||
59 | + | ||
60 | +allow init_t initrc_t:dbus { send_msg acquire_svc }; | ||
61 | diff --git a/policy/modules/system/locallogin.te b/policy/modules/system/locallogin.te | ||
62 | index 09ec33f..be25c82 100644 | ||
63 | --- a/policy/modules/system/locallogin.te | ||
64 | +++ b/policy/modules/system/locallogin.te | ||
65 | @@ -284,3 +284,6 @@ allow local_login_t var_run_t:file { open read write lock}; | ||
66 | allow local_login_t var_run_t:sock_file write; | ||
67 | allow local_login_t tmpfs_t:dir { add_name write search}; | ||
68 | allow local_login_t tmpfs_t:file { create open read write lock }; | ||
69 | +allow local_login_t init_var_run_t:fifo_file write; | ||
70 | +allow local_login_t initrc_t:dbus send_msg; | ||
71 | +allow initrc_t local_login_t:dbus send_msg; | ||
72 | diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if | ||
73 | index 822c03d..8723527 100644 | ||
74 | --- a/policy/modules/system/systemd.if | ||
75 | +++ b/policy/modules/system/systemd.if | ||
76 | @@ -205,9 +205,11 @@ interface(`systemd_service_file_operations',` | ||
77 | # | ||
78 | interface(`systemd_service_lib_function',` | ||
79 | gen_require(` | ||
80 | - class service start; | ||
81 | + class service { start status stop }; | ||
82 | + class file { execmod open }; | ||
83 | ') | ||
84 | |||
85 | - allow initrc_t $1:service start; | ||
86 | + allow initrc_t $1:service { start status stop }; | ||
87 | + allow initrc_t $1:file execmod; | ||
88 | |||
89 | ') | ||
90 | diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te | ||
91 | index 70ccb0e..22021eb 100644 | ||
92 | --- a/policy/modules/system/systemd.te | ||
93 | +++ b/policy/modules/system/systemd.te | ||
94 | @@ -265,6 +265,7 @@ tunable_policy(`systemd_tmpfiles_manage_all',` | ||
95 | |||
96 | allow systemd_tmpfiles_t init_t:dir search; | ||
97 | allow systemd_tmpfiles_t proc_t:filesystem getattr; | ||
98 | -allow systemd_tmpfiles_t init_t:file read; | ||
99 | allow systemd_tmpfiles_t initrc_t:unix_dgram_socket sendto; | ||
100 | allow systemd_tmpfiles_t self:capability net_admin; | ||
101 | + | ||
102 | +allow systemd_tmpfiles_t init_t:file { open getattr read }; | ||
103 | -- | ||
104 | 1.9.1 | ||
105 | |||
diff --git a/recipes-security/refpolicy/refpolicy-minimum_2.20151208.bb b/recipes-security/refpolicy/refpolicy-minimum_2.20151208.bb index 1647c28..7312ada 100644 --- a/recipes-security/refpolicy/refpolicy-minimum_2.20151208.bb +++ b/recipes-security/refpolicy/refpolicy-minimum_2.20151208.bb | |||
@@ -78,4 +78,5 @@ SYSTEMD_REFPOLICY_PATCHES = " \ | |||
78 | file://0004-refpolicy-minimum-locallogin-add-allow-rules-for-typ.patch \ | 78 | file://0004-refpolicy-minimum-locallogin-add-allow-rules-for-typ.patch \ |
79 | file://0005-refpolicy-minimum-init-fix-reboot-with-systemd-as-in.patch \ | 79 | file://0005-refpolicy-minimum-init-fix-reboot-with-systemd-as-in.patch \ |
80 | file://0006-refpolicy-minimum-systemd-mount-enable-requiried-ref.patch \ | 80 | file://0006-refpolicy-minimum-systemd-mount-enable-requiried-ref.patch \ |
81 | file://0007-refpolicy-minimum-systemd-fix-for-login-journal-serv.patch \ | ||
81 | " | 82 | " |