logging in using sereference policy
Ok, I'm inlining one patch, and attaching another patch of which the inlined patch is a subset.
The inlined patch allowed me to log in in enforcing mode. The rest were supporting pieces which addressed various denied messages I'd been seeing. I know most of these allow statements need to be moved to appropriate macros in completely different files, but I won't be able to get around to that until mid next week at the earliest, so here's the info in any case.
Kind of obvious in retrospect :) And I sort of knew that must be what was going on, but wasn't sure how to find the real problem if there was no audit msg about it. In the future I may just have to start by adding a debug make target which removes all dontaudits.
-serge
policy/modules/system/authlogin.if +4 -0
@@ -115,6 +115,8 @@ template(`authlogin_per_userdomain_templ allow $2 self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay }; dontaudit $2 shadow_t:file { getattr read }; + typeattribute $2 can_read_shadow_passwords; + allow $2 shadow_t:file { getattr read }; # Transition from the user domain to this domain. domain_auto_trans($2,chkpwd_exec_t,$1_chkpwd_t)
@@ -253,6 +255,8 @@ interface(`auth_domtrans_chk_passwd',` allow system_chkpwd_t $1:process sigchld; dontaudit $1 shadow_t:file { getattr read }; + typeattribute $1 can_read_shadow_passwords; + allow $1 shadow_t:file { getattr read }; dev_read_rand($1) dev_read_urand($1)
policy/modules/system/userdomain.if +4 -0
@@ -33,6 +33,10 @@ template(`base_user_template',` role $1_r types $1_t; allow system_r $1_r; + # serge + allow $1_t local_login_t:process { sigchld }; + allow $1_t etc_runtime_t:file r_file_perms; + # user pseudoterminal type $1_devpts_t; term_user_pty($1_t,$1_devpts_t)
thanks,
-serge
policy/modules/system/udev.te +3 -0
@@ -203,3 +203,6 @@ optional_policy(`sysnetwork',` ifdef(`TODO',` dontaudit udev_t ttyfile:chr_file unlink; ') dnl endif TODO + +# serge - try to let logins succeed +allow kernel_t user_t:file read;
policy/modules/kernel/filesystem.te +4 -0
@@ -166,3 +166,7 @@ files_mountpoint(nfs_t) genfscon nfs / gen_context(system_u:object_r:nfs_t,s0) genfscon nfs4 / gen_context(system_u:object_r:nfs_t,s0) genfscon afs / gen_context(system_u:object_r:nfs_t,s0) + +# serge +allow user_tty_device_t tmpfs_t:filesystem associate; +allow sysadm_tty_device_t tmpfs_t:filesystem associate;
policy/modules/system/logging.te +9 -0
@@ -388,3 +388,12 @@ allow syslogd_t xconsole_device_t:fifo_f # allow syslogd_t { device_t file_t }:sock_file { getattr unlink }; ') dnl end TODO + +# serge +allow local_login_t device_t:sock_file rw_file_perms; +allow local_login_t shlib_t:file execmod; +allow initrc_t initrc_t:sock_file r_file_perms; +allow initrc_t initrc_t:capability { sys_admin }; +allow initrc_t proc_kmsg_t:file r_file_perms; +allow local_login_t sbin_t:file rx_file_perms; +allow local_login_t sbin_t:file execute_no_trans;
policy/modules/system/init.te +42 -0
51 lines not on this page · raw message
policy/modules/system/mount.te +3 -0
@@ -143,3 +143,6 @@ ifdef(`TODO',` # for when /etc/mtab loses its type allow mount_t file_t:file unlink; ') dnl endif TODO + +# serge +allow mount_t urandom_device_t:chr_file rw_term_perms;
policy/modules/admin/consoletype.te +3 -0
@@ -125,3 +125,6 @@ allow consoletype_t printconf_t:file r_f ') ') dnl end TODO + +# serge +allow consoletype_t urandom_device_t:chr_file rw_term_perms;
policy/modules/admin/dmesg.te +3 -0
@@ -73,3 +73,6 @@ ifdef(`strict_policy',` ') ') + +#serge +allow dmesg_t urandom_device_t:chr_file rw_term_perms;
policy/modules/system/hostname.te +3 -0
@@ -87,3 +87,6 @@ optional_policy(`udev',` udev_dontaudit_use_fd(hostname_t) udev_read_db(hostname_t) ') + +# serge +allow hostname_t urandom_device_t:chr_file rw_term_perms;
policy/modules/services/ssh.te +7 -0
@@ -256,3 +256,10 @@ ifdef(`targeted_policy',`',` udev_read_db(ssh_keygen_t) ') ') + +# serge +allow sshd_t device_t:sock_file rw_file_perms; + +# - bad idea? +allow sshd_t sshd_t:process { execstack execmem }; +
policy/modules/services/cron.te +3 -0
@@ -452,3 +452,6 @@ ifdef(`targeted_policy',` ') dnl end TODO ') + +# serge +allow crond_t device_t:sock_file rw_file_perms;
policy/modules/system/getty.te +3 -0
@@ -115,3 +115,6 @@ optional_policy(`ppp',` optional_policy(`udev',` udev_read_db(getty_t) ') + +# serge +allow getty_t urandom_device_t:chr_file rw_term_perms;
policy/modules/system/locallogin.te +4 -0
@@ -280,3 +280,7 @@ ifdef(`sulogin_no_pam', ` optional_policy(`nis',` nis_use_ypbind(sulogin_t) ') + +# serge - bc /root is mislabeled +allow local_login_t default_t:dir r_dir_perms; +allow local_login_t default_t:file r_file_perms;
policy/modules/system/authlogin.if +4 -0
@@ -115,6 +115,8 @@ template(`authlogin_per_userdomain_templ allow $2 self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay }; dontaudit $2 shadow_t:file { getattr read }; + typeattribute $2 can_read_shadow_passwords; + allow $2 shadow_t:file { getattr read }; # Transition from the user domain to this domain. domain_auto_trans($2,chkpwd_exec_t,$1_chkpwd_t)
@@ -253,6 +255,8 @@ interface(`auth_domtrans_chk_passwd',` allow system_chkpwd_t $1:process sigchld; dontaudit $1 shadow_t:file { getattr read }; + typeattribute $1 can_read_shadow_passwords; + allow $1 shadow_t:file { getattr read }; dev_read_rand($1) dev_read_urand($1)
policy/modules/system/userdomain.if +4 -0
@@ -33,6 +33,10 @@ template(`base_user_template',` role $1_r types $1_t; allow system_r $1_r; + # serge + allow $1_t local_login_t:process { sigchld }; + allow $1_t etc_runtime_t:file r_file_perms; + # user pseudoterminal type $1_devpts_t; term_user_pty($1_t,$1_devpts_t)
Quoted 6 lines
Kind of obvious in retrospect :) And I sort of knew that must be what was going on, but wasn't sure how to find the real problem if there was no audit msg about it. In the future I may just have to start by adding a debug make target which removes all dontaudits.
It used to be called "make enableaudit". Not sure what it's called nowdays, since I haven't looked at policy sources in a while, but I see Dan Walsh shipping a policy base module that removes all dontaudits - if you can switch to it (with semodule), it will probably do what you want.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.