All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] fix /var/run/console bits
@ 2004-08-04  2:01 Colin Walters
  2004-08-04  9:30 ` Luke Kenneth Casson Leighton
  2004-08-04 10:07 ` Russell Coker
  0 siblings, 2 replies; 7+ messages in thread
From: Colin Walters @ 2004-08-04  2:01 UTC (permalink / raw)
  To: rcoker, dwalsh; +Cc: selinux


[-- Attachment #1.1: Type: text/plain, Size: 773 bytes --]

Hi,

Currently /var/run/console is labeled as xdm_var_run_t, which is totally
wrong, since it's actually owned by pam_console.  I noticed this while I
was trying to work on the D-BUS policy, which recently gained console
user authentication.

Attached is a patch which creates a new type for it, grants the
requisite permissions to login and xdm.  I still think we need a nicer
way of mapping the PAM permissions in policy.  The only reason that
login and xdm are granted these permissions is because they happen to
ship with pam_console in their PAM stack on Fedora, presumably.  (IIRC
Debian doesn't use pam_console).

But this patch should work better in the short term at least; if it's
accepted I'll post a little patch to update dbusd.te too.





[-- Attachment #1.2: console-policy.patch --]
[-- Type: text/x-patch, Size: 3059 bytes --]

--- policy-1.15.11/file_contexts/program/pam.fc~	2004-07-31 06:22:37.000000000 -0400
+++ policy-1.15.11/file_contexts/program/pam.fc	2004-08-03 20:44:39.117905464 -0400
@@ -1,3 +1,4 @@
 /var/run/sudo(/.*)?			system_u:object_r:pam_var_run_t
+/var/run/console.*			system_u:object_r:pam_var_console_t
 /sbin/pam_timestamp_check	 --	system_u:object_r:pam_exec_t
 /lib(64)?/security/pam_krb5/pam_krb5_storetmp -- system_u:object_r:pam_exec_t
--- policy-1.15.11/file_contexts/program/xdm.fc~	2004-07-31 06:22:37.000000000 -0400
+++ policy-1.15.11/file_contexts/program/xdm.fc	2004-08-03 18:22:22.181717032 -0400
@@ -16,7 +16,6 @@
 /etc/X11/[wx]dm/Xsession	--	system_u:object_r:xsession_exec_t
 /etc/kde/kdm/Xsession	--	system_u:object_r:xsession_exec_t
 /var/run/xdmctl(/.*)?		system_u:object_r:xdm_var_run_t
-/var/run/console.*		system_u:object_r:xdm_var_run_t
 /var/lib/[xkw]dm(/.*)?		system_u:object_r:xdm_var_lib_t
 /usr/lib/qt-3.3/etc/settings/qtrc(/.*)? system_u:object_r:xdm_var_lib_t
 
--- policy-1.15.11/domains/program/unused/xdm.te~	2004-07-31 06:22:37.000000000 -0400
+++ policy-1.15.11/domains/program/unused/xdm.te	2004-08-03 21:54:42.650871320 -0400
@@ -291,6 +291,9 @@
 allow xdm_t pam_var_run_t:file create_file_perms;
 allow pam_t xdm_t:fifo_file { getattr ioctl write };
 can_exec(xdm_t, pam_exec_t)
+# For pam_console
+rw_dir_create_file(xdm_t, var_run_t)
+rw_dir_create_file(xdm_t, pam_var_console_t)
 ')
 
 allow xdm_t var_log_t:file { read };
--- policy-1.15.11/domains/program/unused/pam.te~	2004-07-31 06:22:37.000000000 -0400
+++ policy-1.15.11/domains/program/unused/pam.te	2004-08-03 20:44:54.704535936 -0400
@@ -10,6 +10,8 @@
 allow pam_t pam_var_run_t:dir { search getattr read write remove_name };
 allow pam_t pam_var_run_t:file { getattr read unlink };
 
+type pam_var_console_t, file_type, sysadmfile;
+
 role system_r types pam_t;
 in_user_role(pam_t)
 domain_auto_trans(userdomain, pam_exec_t, pam_t)
--- policy-1.15.11/domains/program/login.te~	2004-07-31 06:22:36.000000000 -0400
+++ policy-1.15.11/domains/program/login.te	2004-08-03 21:54:26.419338888 -0400
@@ -62,6 +62,9 @@
 
 ifdef(`pam.te', `
 can_exec($1_login_t, pam_exec_t)
+# For pam_console
+rw_dir_create_file($1_login_t, var_run_t)
+rw_dir_create_file($1_login_t, pam_var_console_t)
 ')
 
 # Use capabilities
@@ -81,11 +84,8 @@
 r_dir_file($1_login_t, nfs_t)
 ')dnl end if nfs_home_dirs
 
-#
-# /var/run/console requires the following
-#
+# FIXME: what is this for?
 ifdef(`xdm.te', `
-create_dir_file($1_login_t, xdm_var_run_t)
 allow xdm_t $1_login_t:process { signull };
 ')
 
@@ -184,10 +184,6 @@
 # Allow setting of attributes on sound devices.
 allow local_login_t sound_device_t:chr_file { getattr setattr };
 
-# Allow access to /var/run/console and /var/run/console.lock.  Need a separate type?
-allow local_login_t var_run_t:dir rw_dir_perms;
-allow local_login_t var_run_t:file create_file_perms;
-
 #################################
 #
 # Rules for the remote_login_t domain.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-05 19:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-04  2:01 [patch] fix /var/run/console bits Colin Walters
2004-08-04  9:30 ` Luke Kenneth Casson Leighton
2004-08-04 10:07 ` Russell Coker
2004-08-04 13:03   ` Colin Walters
2004-08-04 13:19     ` Daniel J Walsh
2004-08-05  7:40     ` Russell Coker
2004-08-05 19:23       ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.