Some simple core policy updates
cover Some simple core policy updates
This is a small set of policy updates that have been in the Gentoo policy for a while and are ready for upstreaming.
Sven Vermeulen (7):
Run grub(2)-mkconfig in bootloader domain New sudo manages timestamp directory in /var/run/sudo xfce4-notifyd is an executable
Mark f2fs as a SELinux capable file system Add in LightDM contexts
Add gfisk and efibootmgr as fsadm_exec_t
Add /var/lib/racoon as runtime directory for ipsec
policy/modules/admin/bootloader.fc | 1 + policy/modules/admin/sudo.if | 3 ++- policy/modules/kernel/corecommands.fc | 1 + policy/modules/kernel/filesystem.te | 1 + policy/modules/services/xserver.fc | 7 +++++++ policy/modules/system/fstools.fc | 2 ++ policy/modules/system/ipsec.fc | 2 ++ 7 files changed, 16 insertions(+), 1 deletion(-)
Signature · 1 line
2.0.4
PATCH 1/7 Run grub(2)-mkconfig in bootloader domain
In order to write the grub configuration and perform the preliminary checks, the grub-mkconfig command should run in the bootloader_t domain. As such, update the file context definition to be bootloader_exec_t.
--- policy/modules/admin/bootloader.fc | 1 + 1 file changed, 1 insertion(+)
policy/modules/admin/bootloader.fc +1 -0
@@ -9,4 +9,5 @@ /usr/sbin/grub -- gen_context(system_u:object_r:bootloader_exec_t,s0) /usr/sbin/grub2?-bios-setup -- gen_context(system_u:object_r:bootloader_exec_t,s0) /usr/sbin/grub2?-install -- gen_context(system_u:object_r:bootloader_exec_t,s0) +/usr/sbin/grub2?-mkconfig -- gen_context(system_u:object_r:bootloader_exec_t,s0) /usr/sbin/grub2?-probe -- gen_context(system_u:object_r:bootloader_exec_t,s0)
Signature · 1 line
2.0.4
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
In reply to Sven VermeulenAllow sudo (1.8.9_p5 and higher) to handle /var/run/sudo/ts if it does not exist (given the tmpfs nature of /var/run). This is done when sudo is run in the user prefixed domain, and requires both the chown capability as well as the proper file transition when /var/run/sudo is created.
--- policy/modules/admin/sudo.if | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
policy/modules/admin/sudo.if +2 -1
@@ -52,7 +52,7 @@ template(`sudo_role_template',` # # Use capabilities. - allow $1_sudo_t self:capability { fowner setuid setgid dac_override sys_nice sys_resource }; + allow $1_sudo_t self:capability { chown fowner setuid setgid dac_override sys_nice sys_resource }; allow $1_sudo_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow $1_sudo_t self:process { setexec setrlimit }; allow $1_sudo_t self:fd use;
@@ -117,6 +117,7 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo") auth_use_nsswitch($1_sudo_t) init_rw_utmp($1_sudo_t)
Signature · 1 line
2.0.4
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
2014-11-22 19:54 GMT+01:00 Sven Vermeulen:
Quoted 13 lines
[...]
policy/modules/admin/sudo.if +1
-1@@ -52,7 +52,7 @@ template(`sudo_role_template',` # # Use capabilities. - allow $1_sudo_t self:capability { fowner setuid setgid dac_override sys_nice sys_resource }; + allow $1_sudo_t self:capability { chown fowner setuid setgid dac_override sys_nice sys_resource }; allow $1_sudo_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow $1_sudo_t self:process { setexec setrlimit }; allow $1_sudo_t self:fd use;
policy/modules/admin/sudo.if template(`sudo_role_template',` · line 120
Quoted 4 lines
policy/modules/admin/sudo.if +1
-0@@ -117,6 +117,7 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo")
This interface does not exist in refpolicy and the build fails because of this. Gentoo policy defines it in authlogin.if and the definition looks good to me:
https://github.com/sjvermeu/hardened-refpolicy/blob/9d229675d7084facc9592f1ddab5f976337524f4/policy/modules/system/authlogin.if#L1811
Thanks,
Nicolas
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
Good catch, I checked against the wrong repo :-( Thanks.
I've resent it with the interface added (although I got the mails twice now, my git send-email-fu is not at its peak right now).
Wkr,
Sven Vermeulen
2014-11-22 20:55 GMT+01:00 Nicolas Iooss <[email protected]>:
Quoted 28 lines
2014-11-22 19:54 GMT+01:00 Sven Vermeulen:
Quoted 13 lines
[...]
policy/modules/admin/sudo.if +1
-1@@ -52,7 +52,7 @@ template(`sudo_role_template',` # # Use capabilities. - allow $1_sudo_t self:capability { fowner setuid setgid dac_override sys_nice sys_resource }; + allow $1_sudo_t self:capability { chown fowner setuid setgid dac_override sys_nice sys_resource }; allow $1_sudo_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow $1_sudo_t self:process { setexec setrlimit }; allow $1_sudo_t self:fd use;policy/modules/admin/sudo.if template(`sudo_role_template',` · line 120
Quoted 4 lines
policy/modules/admin/sudo.if +1
-0@@ -117,6 +117,7 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo")This interface does not exist in refpolicy and the build fails because of this. Gentoo policy defines it in authlogin.if and the definition looks good to me:
https://github.com/sjvermeu/hardened-refpolicy/blob/9d229675d7084facc9592f1ddab5f976337524f4/policy/modules/system/authlogin.if#L1811Thanks,
Nicolas
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
Quoted 33 lines · Sven Vermeulen
Good catch, I checked against the wrong repo :-( Thanks.
I've resent it with the interface added (although I got the mails twice now, my git send-email-fu is not at its peak right now).
Wkr,
Sven Vermeulen2014-11-22 20:55 GMT+01:00 Nicolas Iooss <[email protected]>:
Quoted 24 lines
2014-11-22 19:54 GMT+01:00 Sven Vermeulen:
Quoted 13 lines
[...]
policy/modules/admin/sudo.if +1
-1@@ -52,7 +52,7 @@ template(`sudo_role_template',` # # Use capabilities. - allow $1_sudo_t self:capability { fowner setuid setgid dac_override sys_nice sys_resource }; + allow $1_sudo_t self:capability { chown fowner setuid setgid dac_override sys_nice sys_resource }; allow $1_sudo_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap }; allow $1_sudo_t self:process { setexec setrlimit }; allow $1_sudo_t self:fd use;policy/modules/admin/sudo.if template(`sudo_role_template',` · line 120
Quoted 4 lines
policy/modules/admin/sudo.if +1
-0@@ -117,6 +117,7 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo")This interface does not exist in refpolicy and the build fails because of this. Gentoo policy defines it in authlogin.if and the definition looks good to me:
https://github.com/sjvermeu/hardened-refpolicy/blob/9d229675d7084facc9592f1ddab5f976337524f4/policy/modules/system/authlogin.if#L1811
I do not see how /var/run/sudo is associated with pam
Signature · 8 lines
Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 648 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20141123/b28f95b3/attachment.bin
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
2014-11-23 13:50 GMT+01:00 Dominick Grift <[email protected]>:
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
policy/modules/admin/sudo.if template(`sudo_role_template',` · line 120
Quoted 5 lines
policy/modules/admin/sudo.if +1
-0@@ -117,6 +117,7 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo")This interface does not exist in refpolicy and the build fails because of this. Gentoo policy defines it in authlogin.if and the definition looks good to me:
https://github.com/sjvermeu/hardened-refpolicy/blob/9d229675d7084facc9592f1ddab5f976337524f4/policy/modules/system/authlogin.if#L1811
Quoted 1 line
I do not see how
/var/run/sudois associated with pam
The authlogin.fc already contains the following:
/var/run/sudo(/.*)? gen_context(system_u:object_r:pam_var_run_t,s0) /var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) /var/(db|adm)/sudo(/.*)? gen_context(system_u:object_r:pam_var_run_t,s0)
/var/lib/sudo(/.*)? gen_context(system_u:object_r:pam_var_run_t,s0)
I don't know if it is legacy, or because some PAM modules require a more common access pattern. In any case, this file transition is only to keep the application (and policy) running as-is -- without it, users need to run "restorecon -R /var/run/sudo" every time their system is started.
Wkr,
Sven Vermeulen
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
Quoted 20 lines · Sven Vermeulen
2014-11-23 13:50 GMT+01:00 Dominick Grift <[email protected]>:
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
policy/modules/admin/sudo.if template(`sudo_role_template',` · line 120
Quoted 5 lines
policy/modules/admin/sudo.if +1
-0@@ -117,6 +117,7 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo")This interface does not exist in refpolicy and the build fails because of this. Gentoo policy defines it in authlogin.if and the definition looks good to me:
https://github.com/sjvermeu/hardened-refpolicy/blob/9d229675d7084facc9592f1ddab5f976337524f4/policy/modules/system/authlogin.if#L1811Quoted 1 line
I do not see how
/var/run/sudois associated with pamThe authlogin.fc already contains the following:
/var/run/sudo(/.*)? gen_context(system_u:object_r:pam_var_run_t,s0) /var/run/user(/.*)? gen_context(system_u:object_r:var_auth_t,s0) /var/(db|adm)/sudo(/.*)? gen_context(system_u:object_r:pam_var_run_t,s0)
Quoted 8 lines
/var/lib/sudo(/.*)?
gen_context(system_u:object_r:pam_var_run_t,s0)I don't know if it is legacy, or because some PAM modules require a more common access pattern. In any case, this file transition is only to keep the application (and policy) running as-is -- without it, users need to run "restorecon -R
/var/run/sudo" every time their system is started.
Yea, probably legacy. Just sayin' though ideally it should probably not be associated with pam_var_run_t in my view.
Signature · 8 lines
Dominick Grift -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 648 bytes Desc: not available Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20141123/b940c87b/attachment.bin
PATCH 2/7 New sudo manages timestamp directory in /var/run/sudo
Quoted 16 lines · Dominick Grift
Quoted 15 lines · Sven Vermeulen
2014-11-23 13:50 GMT+01:00 Dominick Grift
<[email protected]>:Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 4 lines
(quoted diff) +0
-0@@ -117,6 +117,7 @@ template(`sudo_role_template',`
auth_run_chk_passwd($1_sudo_t, $2)# sudo stores a token in thepam_piddirectoryauth_manage_pam_pid($1_sudo_t)+auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo")This interface does not exist in refpolicy and the build fails because of this. Gentoo policy defines it in authlogin.if and the definition looks good to me:
https://github.com/sjvermeu/hardened-refpolicy/blob/9d229675d7084facc9592f1ddab5f976337524f4/policy/modules/system/authlogin.if#L1811
I do not see how /var/run/sudo is associated with pam
Quoted 19 lines
Quoted 12 lines
The authlogin.fc already contains the following:
/var/run/sudo(/.*)?
gen_context(system_u:object_r:pam_var_run_t,s0)
/var/run/user(/.*)?gen_context(system_u:object_r:var_auth_t,s0)
/var/(db|adm)/sudo(/.*)?gen_context(system_u:object_r:pam_var_run_t,s0)
/var/lib/sudo(/.*)?gen_context(system_u:object_r:pam_var_run_t,s0)Quoted 6 lines
I don't know if it is legacy, or because some PAM modules require a more common access pattern. In any case, this file transition is only to keep the application (and policy) running as-is -- without it, users need to run "restorecon -R
/var/run/sudo" every time their system is started.
Quoted 2 lines
Yea, probably legacy. Just sayin' though ideally it should probably not be associated with
pam_var_run_tin my view.
I agree, but will take it for now, since something like it already exists in the policy. If we can find a better solution, I'll take that too.
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
PATCH 3/7 xfce4-notifyd is an executable
In reply to Sven Vermeulen--- policy/modules/kernel/corecommands.fc | 1 + 1 file changed, 1 insertion(+)
policy/modules/kernel/corecommands.fc +1 -0
@@ -239,6 +239,7 @@ ifdef(`distro_gentoo',` /usr/lib/vte/gnome-pty-helper -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/xfce4/exo-1/exo-compose-mail-1 -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/xfce4/exo-1/exo-helper-1 -- gen_context(system_u:object_r:bin_t,s0) +/usr/lib/xfce4/notifyd/xfce4-notifyd -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/xfce4/panel/migrate -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/xfce4/panel/wrapper -- gen_context(system_u:object_r:bin_t,s0) /usr/lib/xfce4/session/balou-export-theme -- gen_context(system_u:object_r:bin_t,s0)
Signature · 1 line
2.0.4
PATCH 4/7 Mark f2fs as a SELinux capable file system
In reply to Sven VermeulenSince Linux kernel 3.11, F2FS supports XATTR and the security namespace. See commit
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8ae8f1627f39bae505b90cade50cd8a911b8bda6
--- policy/modules/kernel/filesystem.te | 1 + 1 file changed, 1 insertion(+)
policy/modules/kernel/filesystem.te +1 -0
@@ -27,6 +27,7 @@ fs_use_xattr ext2 gen_context(system_u:object_r:fs_t,s0); fs_use_xattr ext3 gen_context(system_u:object_r:fs_t,s0); fs_use_xattr ext4 gen_context(system_u:object_r:fs_t,s0); fs_use_xattr ext4dev gen_context(system_u:object_r:fs_t,s0); +fs_use_xattr f2fs gen_context(system_u:object_r:fs_t,s0); fs_use_xattr gfs gen_context(system_u:object_r:fs_t,s0); fs_use_xattr gfs2 gen_context(system_u:object_r:fs_t,s0); fs_use_xattr gpfs gen_context(system_u:object_r:fs_t,s0);
Signature · 1 line
2.0.4
PATCH 5/7 Add in LightDM contexts
In reply to Sven Vermeulen--- policy/modules/services/xserver.fc | 7 +++++++ 1 file changed, 7 insertions(+)
policy/modules/services/xserver.fc +7 -0
@@ -22,6 +22,8 @@ HOME_DIR/\.Xauthority.* -- gen_context(system_u:object_r:xauth_home_t,s0) /etc/gdm(3)?/PreSession/.* -- gen_context(system_u:object_r:xsession_exec_t,s0) /etc/gdm(3)?/Xsession -- gen_context(system_u:object_r:xsession_exec_t,s0) +/etc/lightdm/Xsession -- gen_context(system_u:object_r:xsession_exec_t,s0) + /etc/kde[34]?/kdm/Xstartup -- gen_context(system_u:object_r:xsession_exec_t,s0) /etc/kde[34]?/kdm/Xreset -- gen_context(system_u:object_r:xsession_exec_t,s0) /etc/kde[34]?/kdm/Xsession -- gen_context(system_u:object_r:xsession_exec_t,s0)
@@ -92,12 +94,16 @@ ifndef(`distro_debian',` /var/[xgkw]dm(/.*)? gen_context(system_u:object_r:xserver_log_t,s0) +/var/cache/lightdm(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) + /var/lib/gdm(3)?(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) +/var/lib/lightdm(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) /var/lib/lxdm(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) /var/lib/[xkw]dm(/.*)? gen_context(system_u:object_r:xdm_var_lib_t,s0) /var/lib/xkb(/.*)? gen_context(system_u:object_r:xkb_var_lib_t,s0) /var/log/[kwx]dm\.log.* -- gen_context(system_u:object_r:xserver_log_t,s0) +/var/log/lightdm(/.*)? gen_context(system_u:object_r:xserver_log_t,s0) /var/log/lxdm\.log -- gen_context(system_u:object_r:xserver_log_t,s0) /var/log/gdm(3)?(/.*)? gen_context(system_u:object_r:xserver_log_t,s0) /var/log/slim\.log -- gen_context(system_u:object_r:xserver_log_t,s0)
@@ -107,6 +113,7 @@ ifndef(`distro_debian',` /var/run/gdm(3)?(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0) /var/run/gdm(3)?\.pid -- gen_context(system_u:object_r:xdm_var_run_t,s0) /var/run/xdm\.pid -- gen_context(system_u:object_r:xdm_var_run_t,s0) +/var/run/lightdm(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0) /var/run/lxdm\.auth -- gen_context(system_u:object_r:xdm_var_run_t,s0) /var/run/lxdm\.pid -- gen_context(system_u:object_r:xdm_var_run_t,s0) /var/run/lxdm(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0)
Signature · 1 line
2.0.4
PATCH 6/7 Add gfisk and efibootmgr as fsadm_exec_t
In reply to Sven Vermeulen--- policy/modules/system/fstools.fc | 2 ++ 1 file changed, 2 insertions(+)
policy/modules/system/fstools.fc +2 -0
@@ -51,8 +51,10 @@ /usr/sbin/addpart -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/clubufflush -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/delpart -- gen_context(system_u:object_r:fsadm_exec_t,s0) +/usr/sbin/efibootmgr -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/fatsort -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/fsck.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) +/usr/sbin/gdisk -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/mkfs.* -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/parted -- gen_context(system_u:object_r:fsadm_exec_t,s0) /usr/sbin/partprobe -- gen_context(system_u:object_r:fsadm_exec_t,s0)
Signature · 1 line
2.0.4
PATCH 7/7 Add /var/lib/racoon as runtime directory for ipsec
In reply to Sven Vermeulen--- policy/modules/system/ipsec.fc | 2 ++ 1 file changed, 2 insertions(+)
policy/modules/system/ipsec.fc +2 -0
@@ -31,6 +31,8 @@ /usr/sbin/racoon -- gen_context(system_u:object_r:racoon_exec_t,s0) /usr/sbin/setkey -- gen_context(system_u:object_r:setkey_exec_t,s0) +/var/lib/racoon(/.*)? gen_context(system_u:object_r:ipsec_var_run_t,s0) + /var/lock/subsys/ipsec -- gen_context(system_u:object_r:ipsec_mgmt_lock_t,s0) /var/log/pluto\.log -- gen_context(system_u:object_r:ipsec_log_t,s0)
Signature · 1 line
2.0.4