Skip to contentSkip to conversation

pam_mount

DISCUSSION Stefan Schulze Frielinghaus 2 participants 4 messages Jun 21, 2008 – Jul 18, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I try to temporarily create a policy fix for pam_mount and I'm running into some problems.

While using local console login mount_t tries to "getattr" every sock_file in /var/run which I could dontaudit using the following:

dontaudit mount_t pidfile:sock_file getattr;

But there is still another very annoying AVC message which I get for every directory in /proc which is not labeled as proc_t.

type=1400 audit(1214045895.760:29702): avc: denied { getattr } for pid=28153 comm="fuser" path="/proc/1" dev=proc ino=1675 scontext=system_u:system_r:mount_t:s0-s0:c0.c1023 tcontext=system_u:system_r:init_t:s0 tclass=dir

type=1400 audit(1214045895.762:29703): avc: denied { search } for pid=28153 comm="fuser" name="1" dev=proc ino=1675 scontext=system_u:system_r:mount_t:s0-s0:c0.c1023 tcontext=system_u:system_r:init_t:s0 tclass=dir

For the first few tries I dontaudit every occurrence (over a dozen types) but I realized that's something I can't win ;-) So I tried using the following rule:

dontaudit mount_t proc_type:dir { getattr search };

But the AVC is still generated. I hoped that proc_type is an attribute for every file/dir under /proc. Am I wrong? Or why doesn't the dontaudit rule count?

Best regards
Stefan

--
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.

#1 lore raw
Quoted 16 lines · Stefan Schulze Frielinghaus

I try to temporarily create a policy fix for pam_mount and I'm running into some problems.

While using local console login mount_t tries to "getattr" every sock_file in /var/run which I could dontaudit using the following:

dontaudit mount_t pidfile:sock_file getattr;

But there is still another very annoying AVC message which I get for every directory in /proc which is not labeled as proc_t.

type=1400 audit(1214045895.760:29702): avc: denied { getattr } for pid=28153 comm="fuser" path="/proc/1" dev=proc ino=1675 scontext=system_u:system_r:mount_t:s0-s0:c0.c1023 tcontext=system_u:system_r:init_t:s0 tclass=dir

Quoted 8 lines

type=1400 audit(1214045895.762:29703): avc: denied { search } for pid=28153 comm="fuser" name="1" dev=proc ino=1675 scontext=system_u:system_r:mount_t:s0-s0:c0.c1023 tcontext=system_u:system_r:init_t:s0 tclass=dir

For the first few tries I dontaudit every occurrence (over a dozen types) but I realized that's something I can't win ;-) So I tried using the following rule:

This is due to all of the /proc/pid entries being labeled with the domain's type. You need domain_dontaudit_search_all_domains_state(), and probably kernel_dontaudit_list_all_sysctls() too.

Quoted 5 lines

dontaudit mount_t proc_type:dir { getattr search };

But the AVC is still generated. I hoped that proc_type is an attribute for every file/dir under /proc. Am I wrong? Or why doesn't the dontaudit rule count?

Right now domain types are not included in the proc_type. The sysctl types are not included either. I don't know that we've ever considered extending that attribute to include all of those types. Right now it just includes all the types prefixed with proc, for example, proc_t, proc_kmsg_t, proc_net_t, etc. It may be ok, since the attribute is only used in two rules, one is a dontaudit and one is an allow for unconfined.

Signature · 10 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150



--
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.
#2 lore raw

Attached patch solves a problem of local logins while using pam_mount. In xserver.te GDM already has this permission to
manage /var/run/pam_mount. Therefore GDM logins which use pam_mount to e.g. decrypt a partition work. But local logins not.

I also had a lot of strange { getattr search } requests of mount. I dontaudit everyone and the login still works. I'm not sure if we should add these ones to mount_t:

domain_dontaudit_search_all_domains_state(mount_t) dontaudit mount_t pam_var_console_t:file write; dontaudit mount_t self:process ptrace; dontaudit mount_t proc_net_t:lnk_file read;

Nevertheless with the attached patch local logins via pam_mount work.

I cc'd Dan in the hope that he will add the patch to the upstream policy of Fedora. Then I don't have to install a local policy for every installation. Lazy me ;-)

modules/system/locallogin.te renamed from usr/src/refpolicy-20080402/policy/modules/system/locallogin.te +1 -0
@@ -100,6 +100,7 @@
 
 auth_rw_login_records(local_login_t)
 auth_rw_faillog(local_login_t)
+auth_manage_pam_pid(local_login_t)
 auth_manage_pam_console_data(local_login_t)
 auth_domtrans_pam_console(local_login_t)
 
#3 lore raw
Quoted 14 lines · Stefan Schulze Frielinghaus

Attached patch solves a problem of local logins while using pam_mount. In xserver.te GDM already has this permission to
manage /var/run/pam_mount. Therefore GDM logins which use pam_mount to e.g. decrypt a partition work. But local logins not.

I also had a lot of strange { getattr search } requests of mount. I dontaudit everyone and the login still works. I'm not sure if we should add these ones to mount_t:

domain_dontaudit_search_all_domains_state(mount_t) dontaudit mount_t pam_var_console_t:file write; dontaudit mount_t self:process ptrace; dontaudit mount_t proc_net_t:lnk_file read;

Quoted 5 lines

Nevertheless with the attached patch local logins via pam_mount work.

I cc'd Dan in the hope that he will add the patch to the upstream policy of Fedora. Then I don't have to install a local policy for every installation. Lazy me ;-)

Merged.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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.