Skip to contentSkip to conversation

Updates on master (non-contrib)

PATCH New Sven Vermeulen 3 participants 25 messages Dec 17, 2012 – Jan 11, 2013

lore
Share & tools
lore
#0 lore raw

cover Updates on master (non-contrib)

Loose updates on the master repository (non-contrib items)

Sven Vermeulen (8):
Postgresql 9.2 connects to its unix stream socket lvscan creates the /run/lock/lvm directory if nonexisting (v2) Allow syslogger to manage cron log files (v2)
Update towards apache_manage_all_content
Dontaudit getsched on all domains
Allow initrc_t to read stunnel configuration Introduce rw_inherited_file_perms definition Introduce exec-check interfaces for passwd binaries and useradd
binaries

 policy/modules/admin/usermanage.if    |   36 +++++++++++++++++++++++++++++++++
 policy/modules/admin/usermanage.te    |    2 +-
 policy/modules/kernel/domain.if       |   18 ++++++++++++++++
 policy/modules/services/postgresql.te |    2 +-
 policy/modules/system/init.te         |    4 +++
 policy/modules/system/logging.te      |    5 ++++
 policy/modules/system/lvm.te          |    2 +
 policy/modules/system/userdomain.if   |    2 +
 policy/support/obj_perm_sets.spt      |    3 +-
 9 files changed, 71 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH 1/8 Postgresql 9.2 connects to its unix stream socket

When starting postgresql, it fails with the (little saying) error message:
pg_ctl: could not start server

In the denials, we notice:

Nov 24 10:41:52 lerya kernel: [1628900.540506] type=1400

audit(1353750112.021:10143): avc: denied { connectto } for pid=20481 comm="pg_ctl" path="/run/postgresql/.s.PGSQL.5432" ipaddr=... scontext=system_u:system_r:postgresql_t tcontext=system_u:system_r:postgresql_t tclass=unix_stream_socket

Hence, allow postgresql to connect to its own stream socket.

---
 policy/modules/services/postgresql.te |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
policy/modules/services/postgresql.te +1 -1
index 0210aef..94b1a57 100644
@@ -234,7 +234,7 @@ allow postgresql_t self:shm create_shm_perms;
 allow postgresql_t self:tcp_socket create_stream_socket_perms;
 allow postgresql_t self:udp_socket create_stream_socket_perms;
 allow postgresql_t self:unix_dgram_socket create_socket_perms;
-allow postgresql_t self:unix_stream_socket create_stream_socket_perms;
+allow postgresql_t self:unix_stream_socket { create_stream_socket_perms connectto };
 allow postgresql_t self:netlink_selinux_socket create_socket_perms;
 tunable_policy(`sepgsql_transmit_client_label',`
 	allow postgresql_t self:process { setsockcreate };
Signature · 1 line
1.7.8.6
#2 lore raw

PATCH 1/8 Postgresql 9.2 connects to its unix stream socket

Quoted 22 lines · Sven Vermeulen

When starting postgresql, it fails with the (little saying) error message:
pg_ctl: could not start server

In the denials, we notice:

Nov 24 10:41:52 lerya kernel: [1628900.540506] type=1400

audit(1353750112.021:10143): avc: denied { connectto } for pid=20481 comm="pg_ctl" path="/run/postgresql/.s.PGSQL.5432" ipaddr=... scontext=system_u:system_r:postgresql_t tcontext=system_u:system_r:postgresql_t tclass=unix_stream_socket

Hence, allow postgresql to connect to its own stream socket.

---
 policy/modules/services/postgresql.te |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
policy/modules/services/postgresql.te +0 -0
index 0210aef..94b1a57 100644

policy/modules/services/postgresql.te allow postgresql_t self:shm create_shm_perms; · line 240

Quoted 8 lines
policy/modules/services/postgresql.te +1 -1
@@ -234,7 +234,7 @@ allow postgresql_t self:shm create_shm_perms;
 allow postgresql_t self:tcp_socket create_stream_socket_perms;
 allow postgresql_t self:udp_socket create_stream_socket_perms;
 allow postgresql_t self:unix_dgram_socket create_socket_perms;
-allow postgresql_t self:unix_stream_socket create_stream_socket_perms;
+allow postgresql_t self:unix_stream_socket { create_stream_socket_perms connectto };
 allow postgresql_t self:netlink_selinux_socket create_socket_perms;
 tunable_policy(`sepgsql_transmit_client_label',`
 	allow postgresql_t self:process { setsockcreate };

Merged.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#3 lore raw

PATCH 2/8 lvscan creates the /run/lock/lvm directory if nonexisting (v2)

In reply to Sven Vermeulen

If the /run/lock/lvm directory doesn't exist yet, running any of the LVM tools (like lvscan) will create this directory. Introduce a named file transition for the lock location when a directory named "lvm" is created and grant the necessary rights to create the directory.

---
 policy/modules/system/lvm.te |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
policy/modules/system/lvm.te +2 -0
index f8eeecd..a712d85 100644
@@ -192,7 +192,9 @@ can_exec(lvm_t, lvm_exec_t)
 
 # Creating lock files
 manage_files_pattern(lvm_t, lvm_lock_t, lvm_lock_t)
+create_dirs_pattern(lvm_t, lvm_lock_t, lvm_lock_t)
 files_lock_filetrans(lvm_t, lvm_lock_t, file)
+files_lock_filetrans(lvm_t, lvm_lock_t, dir, "lvm")
 
 manage_dirs_pattern(lvm_t, lvm_var_lib_t, lvm_var_lib_t)
 manage_files_pattern(lvm_t, lvm_var_lib_t, lvm_var_lib_t)
Signature · 1 line
1.7.8.6
#4 lore raw

PATCH 2/8 lvscan creates the /run/lock/lvm directory if nonexisting (v2)

Quoted 15 lines · Sven Vermeulen

If the /run/lock/lvm directory doesn't exist yet, running any of the LVM tools (like lvscan) will create this directory. Introduce a named file transition for the lock location when a directory named "lvm" is created and grant the necessary rights to create the directory.

---
 policy/modules/system/lvm.te |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
policy/modules/system/lvm.te +0 -0
index f8eeecd..a712d85 100644

policy/modules/system/lvm.te can_exec(lvm_t, lvm_exec_t) · line 200

Quoted 9 lines
policy/modules/system/lvm.te +2 -0
@@ -192,7 +192,9 @@ can_exec(lvm_t, lvm_exec_t)
 
 # Creating lock files
 manage_files_pattern(lvm_t, lvm_lock_t, lvm_lock_t)
+create_dirs_pattern(lvm_t, lvm_lock_t, lvm_lock_t)
 files_lock_filetrans(lvm_t, lvm_lock_t, file)
+files_lock_filetrans(lvm_t, lvm_lock_t, dir, "lvm")
 
 manage_dirs_pattern(lvm_t, lvm_var_lib_t, lvm_var_lib_t)
 manage_files_pattern(lvm_t, lvm_var_lib_t, lvm_var_lib_t)

Merged.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#5 lore raw

PATCH 3/8 Allow syslogger to manage cron log files (v2)

In reply to Sven Vermeulen

Some cron daemons, including vixie-cron, support using the system logger for handling their logging events. Hence we allow syslogd_t to manage the cron logs, and put a file transition in place for the system logger when it creates the cron.log file.

---
 policy/modules/system/logging.te |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
policy/modules/system/logging.te +5 -0
index 09b9a31..c75cd96 100644
@@ -490,6 +490,11 @@ optional_policy(`
 ')
 
 optional_policy(`
+	cron_manage_log_files(syslogd_t)
+	cron_generic_log_filetrans_log(syslogd_t, file, "cron.log")
+')
+
+optional_policy(`
 	inn_manage_log(syslogd_t)
 	inn_generic_log_filetrans_innd_log(syslogd_t, file, "news.crit")
 	inn_generic_log_filetrans_innd_log(syslogd_t, file, "news.err")
Signature · 1 line
1.7.8.6
#6 lore raw

PATCH 3/8 Allow syslogger to manage cron log files (v2)

Quoted 16 lines · Sven Vermeulen

Some cron daemons, including vixie-cron, support using the system logger for handling their logging events. Hence we allow syslogd_t to manage the cron logs, and put a file transition in place for the system logger when it creates the cron.log file.

---
 policy/modules/system/logging.te |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
policy/modules/system/logging.te +0 -0
index 09b9a31..c75cd96 100644
@@ -490,6 +490,11 @@ optional_policy(`
 ')

policy/modules/system/logging.te optional_policy(` · line 500

Quoted 10 lines
policy/modules/system/logging.te +5 -0
 
 optional_policy(`
+	cron_manage_log_files(syslogd_t)
+	cron_generic_log_filetrans_log(syslogd_t, file, "cron.log")
+')
+
+optional_policy(`
 	inn_manage_log(syslogd_t)
 	inn_generic_log_filetrans_innd_log(syslogd_t, file, "news.crit")
 	inn_generic_log_filetrans_innd_log(syslogd_t, file, "news.err")

Merged.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#7 lore raw

PATCH 4/8 Update towards apache_manage_all_content

In reply to Sven Vermeulen

The apache_manage_all_user_content interface has been deprecated and is now pointing towards apache_manage_all_content.

---
 policy/modules/admin/usermanage.te |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
policy/modules/admin/usermanage.te +1 -1
index 673180c..9721f3b 100644
@@ -533,7 +533,7 @@ ifdef(`distro_redhat',`
 ')
 
 optional_policy(`
-	apache_manage_all_user_content(useradd_t)
+	apache_manage_all_content(useradd_t)
 ')
 
 optional_policy(`
Signature · 1 line
1.7.8.6
#8 lore raw

PATCH 4/8 Update towards apache_manage_all_content

Quoted 13 lines · Sven Vermeulen

The apache_manage_all_user_content interface has been deprecated and is now pointing towards apache_manage_all_content.

---
 policy/modules/admin/usermanage.te |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
policy/modules/admin/usermanage.te +0 -0
index 673180c..9721f3b 100644

policy/modules/admin/usermanage.te ifdef(`distro_redhat',` · line 539

Quoted 8 lines
policy/modules/admin/usermanage.te +1 -1
@@ -533,7 +533,7 @@ ifdef(`distro_redhat',`
 ')
 
 optional_policy(`
-	apache_manage_all_user_content(useradd_t)
+	apache_manage_all_content(useradd_t)
 ')
 
 optional_policy(`

I disagree with this change. Useradd should only be creating user content, e.g. ~/public_html. This change would provide too much access.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#9 lore raw

PATCH 4/8 Update towards apache_manage_all_content

Quoted 3 lines · Christopher J. PeBenito
Quoted 2 lines · Sven Vermeulen

The apache_manage_all_user_content interface has been deprecated and is now pointing towards apache_manage_all_content.

[...]

Quoted 9 lines

policy/modules/admin/usermanage.te ifdef(`distro_redhat',` · line 539

Quoted 6 lines

optional_policy(`

policy/modules/admin/usermanage.te +1 -1
-	apache_manage_all_user_content(useradd_t)
+	apache_manage_all_content(useradd_t)
 ')
 
 optional_policy(`

I disagree with this change. Useradd should only be creating user content, e.g. ~/public_html. This change would provide too much access.

You misunderstood me (or I expressed myself badly ;-)

This is currently the definition of apache_manage_all_user_content:

#v+
interface(apache_manage_all_user_content',
refpolicywarn(`$0($*) has been deprecated, use apache_manage_all_content() instead.') apache_manage_all_content($1)
')
#v-

All I did in the patch was replace the call to the (deprecated) function towards the newly pointed function, so that we don't get a deprecation notice at build time anymore.

Wkr,
Sven Vermeulen

#10 lore raw

PATCH 4/8 Update towards apache_manage_all_content

Quoted 26 lines · Sven Vermeulen
Quoted 3 lines · Christopher J. PeBenito
Quoted 2 lines · Sven Vermeulen

The apache_manage_all_user_content interface has been deprecated and is now pointing towards apache_manage_all_content.

[...]

Quoted 9 lines

policy/modules/admin/usermanage.te ifdef(`distro_redhat',` · line 539

Quoted 6 lines

optional_policy(`

policy/modules/admin/usermanage.te +1 -1
-	apache_manage_all_user_content(useradd_t)
+	apache_manage_all_content(useradd_t)
 ')
 
 optional_policy(`

I disagree with this change. Useradd should only be creating user content, e.g. ~/public_html. This change would provide too much access.

You misunderstood me (or I expressed myself badly ;-)

This is currently the definition of apache_manage_all_user_content:

#v+
interface(apache_manage_all_user_content',
refpolicywarn(`$0($*) has been deprecated, use apache_manage_all_content() instead.') apache_manage_all_content($1)
')
#v-

Quoted 3 lines

All I did in the patch was replace the call to the (deprecated) function towards the newly pointed function, so that we don't get a deprecation notice at build time anymore.

I didn't misunderstand. I think the interface should be un-deprecated.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#11 lore raw

PATCH 4/8 Update towards apache_manage_all_content

Quoted 27 lines · Christopher J. PeBenito
Quoted 26 lines · Sven Vermeulen
Quoted 3 lines · Christopher J. PeBenito
Quoted 2 lines · Sven Vermeulen

The apache_manage_all_user_content interface has been deprecated and is now pointing towards apache_manage_all_content.

[...]

Quoted 9 lines

policy/modules/admin/usermanage.te ifdef(`distro_redhat',` · line 539

Quoted 6 lines

optional_policy(`

policy/modules/admin/usermanage.te +1 -1
-	apache_manage_all_user_content(useradd_t)
+	apache_manage_all_content(useradd_t)
 ')
 
 optional_policy(`

I disagree with this change. Useradd should only be creating user content, e.g. ~/public_html. This change would provide too much access.

You misunderstood me (or I expressed myself badly ;-)

This is currently the definition of apache_manage_all_user_content:

#v+
interface(apache_manage_all_user_content',
refpolicywarn(`$0($*) has been deprecated, use apache_manage_all_content() instead.') apache_manage_all_content($1)
')
#v-

Quoted 5 lines
Quoted 3 lines

All I did in the patch was replace the call to the (deprecated) function towards the newly pointed function, so that we don't get a deprecation notice at build time anymore.

I didn't misunderstand. I think the interface should be un-deprecated.

To further clarify, I think the interface should be un-deprecated and the original implementation restored. User content is the stuff in ~/public_html. Its not interchangeable with all content, which includes the static web pages and content from web apps.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#12 lore raw

PATCH 4/8 Update towards apache_manage_all_content

Quoted 28 lines · Christopher J. PeBenito
Quoted 27 lines · Christopher J. PeBenito
Quoted 26 lines · Sven Vermeulen
Quoted 3 lines · Christopher J. PeBenito
Quoted 2 lines · Sven Vermeulen

The apache_manage_all_user_content interface has been deprecated and is now pointing towards apache_manage_all_content.

[...]

Quoted 9 lines

policy/modules/admin/usermanage.te ifdef(`distro_redhat',` · line 539

Quoted 6 lines

optional_policy(`

policy/modules/admin/usermanage.te +1 -1
-	apache_manage_all_user_content(useradd_t)
+	apache_manage_all_content(useradd_t)
 ')
 
 optional_policy(`

I disagree with this change. Useradd should only be creating user content, e.g. ~/public_html. This change would provide too much access.

You misunderstood me (or I expressed myself badly ;-)

This is currently the definition of apache_manage_all_user_content:

#v+
interface(apache_manage_all_user_content',
refpolicywarn(`$0($*) has been deprecated, use apache_manage_all_content() instead.') apache_manage_all_content($1)
')
#v-

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

All I did in the patch was replace the call to the (deprecated) function towards the newly pointed function, so that we don't get a deprecation notice at build time anymore.

I didn't misunderstand. I think the interface should be un-deprecated.

To further clarify, I think the interface should be un-deprecated and the original implementation restored. User content is the stuff in ~/public_html. Its not interchangeable with all content, which includes the static web pages and content from web apps.

Yes, i guess i misunderstood this interface. Sven: will you create a patch for this or do i have to change it?

#13 lore raw

PATCH 4/8 Update towards apache_manage_all_content

Quoted 5 lines · Dominick Grift
Quoted 2 lines

To further clarify, I think the interface should be un-deprecated and the original implementation restored. User content is the stuff in ~/public_html. Its not interchangeable with all content, which includes the static web pages and content from web apps.

Yes, i guess i misunderstood this interface. Sven: will you create a patch for this or do i have to change it?

I can, but don't expect it this week - swamped with work right now. But I don't mind taking this on me if you have the patience ;-)

Wkr,
Sven Vermeulen

#14 lore raw

PATCH 5/8 Dontaudit getsched on all domains

In reply to Sven Vermeulen

The htop utility will attempt to get the scheduling information of all processes. This information however does not seem to be needed for its information (no difference in output when allowed or not).

---
 policy/modules/kernel/domain.if     |   18 ++++++++++++++++++
 policy/modules/system/userdomain.if |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
policy/modules/kernel/domain.if +18 -0
index 6a1e4d1..caceae0 100644
@@ -889,6 +889,24 @@ interface(`domain_getpgid_all_domains',`
 
 ########################################
 ## <summary>
+##	Do not audit getting the scheduler information of all domains.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain to not audit.
+##	</summary>
+## </param>
+#
+interface(`domain_dontaudit_getsched_all_domains',`
+	gen_require(`
+		attribute domain;
+	')
+
+	dontaudit $1 domain:process getsched;
+')
+
+########################################
+## <summary>
 ##	Get the scheduler information of all domains.
 ## </summary>
 ## <param name="domain">
policy/modules/system/userdomain.if +2 -0
index 6d4424b..99ab865 100644
@@ -523,6 +523,8 @@ template(`userdom_common_user_template',`
 	dev_read_sound_mixer($1_t)
 	dev_write_sound_mixer($1_t)
 
+	domain_dontaudit_getsched_all_domains($1_t)
+
 	files_exec_etc_files($1_t)
 	files_search_locks($1_t)
 	# Check to see if cdrom is mounted
Signature · 1 line
1.7.8.6
#15 lore raw

PATCH 5/8 Dontaudit getsched on all domains

Quoted 44 lines · Sven Vermeulen

The htop utility will attempt to get the scheduling information of all processes. This information however does not seem to be needed for its information (no difference in output when allowed or not).

---
 policy/modules/kernel/domain.if     |   18 ++++++++++++++++++
 policy/modules/system/userdomain.if |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
policy/modules/kernel/domain.if +18 -0
index 6a1e4d1..caceae0 100644
@@ -889,6 +889,24 @@ interface(`domain_getpgid_all_domains',`
 
 ########################################
 ## <summary>
+##	Do not audit getting the scheduler information of all domains.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain to not audit.
+##	</summary>
+## </param>
+#
+interface(`domain_dontaudit_getsched_all_domains',`
+	gen_require(`
+		attribute domain;
+	')
+
+	dontaudit $1 domain:process getsched;
+')
+
+########################################
+## <summary>
 ##	Get the scheduler information of all domains.
 ## </summary>
 ## <param name="domain">
policy/modules/system/userdomain.if +0 -0
index 6d4424b..99ab865 100644

policy/modules/system/userdomain.if template(`userdom_common_user_template',` · line 526

Quoted 4 lines
policy/modules/system/userdomain.if +1 -0
@@ -523,6 +523,8 @@ template(`userdom_common_user_template',`
 	dev_read_sound_mixer($1_t)
 	dev_write_sound_mixer($1_t)
 
+	domain_dontaudit_getsched_all_domains($1_t)

That is too coarse in my view.

This will also dontaudit legitimate access for processes needing this running in the user domain.

Lets say i have this app that depends on this permission for itself:

allow staff_t self:process { signal getsched };

Then this rule will silently hide that access

Quoted 4 lines
policy/modules/system/userdomain.if +1 -0
+
 	files_exec_etc_files($1_t)
 	files_search_locks($1_t)
 	# Check to see if cdrom is mounted
#16 lore raw

PATCH 5/8 Dontaudit getsched on all domains

Quoted 3 lines · grift
Quoted 3 lines

The htop utility will attempt to get the scheduling information of all processes. This information however does not seem to be needed for its information (no difference in output when allowed or not).

[...]

Quoted 7 lines
Quoted 7 lines
policy/modules/kernel/domain.if +7 -0
+interface(`domain_dontaudit_getsched_all_domains',`
+	gen_require(`
+		attribute domain;
+	')
+
+	dontaudit $1 domain:process getsched;
+')

[...]

Quoted 10 lines

policy/modules/system/userdomain.if template(`userdom_common_user_template',` · line 526

Quoted 7 lines
policy/modules/system/userdomain.if +1 -0
@@ -523,6 +523,8 @@ template(`userdom_common_user_template',`
 	dev_read_sound_mixer($1_t)
 	dev_write_sound_mixer($1_t)
 
+	domain_dontaudit_getsched_all_domains($1_t)

That is too coarse in my view.

Quoted 8 lines

This will also dontaudit legitimate access for processes needing this running in the user domain.

Lets say i have this app that depends on this permission for itself:

allow staff_t self:process { signal getsched };

Then this rule will silently hide that access

I understand that, but the other method would be to create *_dontaudit_getsched for each and every possible module, and add it in the user domain definition fully loaded with optional_policy() statements.

And if the user domain doesn't need getsched itself, then running htop will generate denials anyhow for self (i.e. in your above example, you'll get denials for staff_t getsched on itself) so eventually you'll add in a staff_dontaudit_getsched() for that too?

Another alternative could be to run htop in its own domain, but that doesn't make sense imo...

Wkr,
Sven Vermeulen

#17 lore raw

PATCH 5/8 Dontaudit getsched on all domains

Quoted 23 lines · Sven Vermeulen
Quoted 10 lines

policy/modules/system/userdomain.if template(`userdom_common_user_template',` · line 526

Quoted 7 lines
policy/modules/system/userdomain.if +1 -0
@@ -523,6 +523,8 @@ template(`userdom_common_user_template',`
 	dev_read_sound_mixer($1_t)
 	dev_write_sound_mixer($1_t)
 
+	domain_dontaudit_getsched_all_domains($1_t)

That is too coarse in my view.

Quoted 8 lines

This will also dontaudit legitimate access for processes needing this running in the user domain.

Lets say i have this app that depends on this permission for itself:

allow staff_t self:process { signal getsched };

Then this rule will silently hide that access

I understand that, but the other method would be to create *_dontaudit_getsched for each and every possible module, and add it in the user domain definition fully loaded with optional_policy() statements.

Quoted 7 lines

And if the user domain doesn't need getsched itself, then running htop will generate denials anyhow for self (i.e. in your above example, you'll get denials for staff_t getsched on itself) so eventually you'll add in a staff_dontaudit_getsched() for that too?

Another alternative could be to run htop in its own domain, but that doesn't make sense imo...

Chris, what is your take on this?

Wkr,
Sven Vermeulen

#18 lore raw

PATCH 5/8 Dontaudit getsched on all domains

Quoted 29 lines · Sven Vermeulen
Quoted 28 lines · Sven Vermeulen
Quoted 10 lines

policy/modules/system/userdomain.if template(`userdom_common_user_template',` · line 526

Quoted 7 lines
policy/modules/system/userdomain.if +1 -0
@@ -523,6 +523,8 @@ template(`userdom_common_user_template',`
 	dev_read_sound_mixer($1_t)
 	dev_write_sound_mixer($1_t)
 
+	domain_dontaudit_getsched_all_domains($1_t)

That is too coarse in my view.

Quoted 8 lines

This will also dontaudit legitimate access for processes needing this running in the user domain.

Lets say i have this app that depends on this permission for itself:

allow staff_t self:process { signal getsched };

Then this rule will silently hide that access

I understand that, but the other method would be to create *_dontaudit_getsched for each and every possible module, and add it in the user domain definition fully loaded with optional_policy() statements.

And if the user domain doesn't need getsched itself, then running htop will generate denials anyhow for self (i.e. in your above example, you'll get denials for staff_t getsched on itself) so eventually you'll add in a staff_dontaudit_getsched() for that too?

Quoted 4 lines
Quoted 2 lines

Another alternative could be to run htop in its own domain, but that doesn't make sense imo...

Chris, what is your take on this?

While I'm typically conservative on permissions, I'm not as concerned about this. True, it can cover up legitimate denials, but the dontaudits can always do that. Since this is due to a specific app, add a comment so we can remove the rule if/when htop gets fixed for all these superfluous getscheds.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#19 lore raw

PATCH 6/8 Allow initrc_t to read stunnel configuration

In reply to Sven Vermeulen

The stunnel init script reads the stunnel configuration to find out where to store and check for the PID file

---
 policy/modules/system/init.te |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
policy/modules/system/init.te +4 -0
index 5f2a36a..a8f385b 100644
@@ -837,6 +837,10 @@ optional_policy(`
 ')
 
 optional_policy(`
+	stunnel_read_config(initrc_t)
+')
+
+optional_policy(`
 	sysnet_read_dhcpc_state(initrc_t)
 ')
 
Signature · 1 line
1.7.8.6
#20 lore raw

PATCH 6/8 Allow initrc_t to read stunnel configuration

Quoted 13 lines · Sven Vermeulen

The stunnel init script reads the stunnel configuration to find out where to store and check for the PID file

---
 policy/modules/system/init.te |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
policy/modules/system/init.te +0 -0
index 5f2a36a..a8f385b 100644

policy/modules/system/init.te optional_policy(` · line 845

Quoted 9 lines
policy/modules/system/init.te +4 -0
@@ -837,6 +837,10 @@ optional_policy(`
 ')
 
 optional_policy(`
+	stunnel_read_config(initrc_t)
+')
+
+optional_policy(`
 	sysnet_read_dhcpc_state(initrc_t)
 ')

Merged.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#21 lore raw

PATCH 7/8 Introduce rw_inherited_file_perms definition

In reply to Sven Vermeulen

In many cases throughout the policy, domains require read/write privileges on inherited descriptors. In most cases, these are for files, where the domain needs the read-write permissions but of course no open privilege.

Instead of having to hard-code the permissions every time, this patch introduces the rw_inherited_file_perms to support simple calls for these inherited descriptors.

---
 policy/support/obj_perm_sets.spt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
policy/support/obj_perm_sets.spt +2 -1
index 6e91317..48f0c7a 100644
@@ -158,7 +158,8 @@ define(`mmap_file_perms',`{ getattr open read execute ioctl }')
 define(`exec_file_perms',`{ getattr open read execute ioctl execute_no_trans }')
 define(`append_file_perms',`{ getattr open append lock ioctl }')
 define(`write_file_perms',`{ getattr open write append lock ioctl }')
-define(`rw_file_perms',`{ getattr open read write append ioctl lock }')
+define(`rw_inherited_file_perms',`{ getattr read write append ioctl lock }')
+define(`rw_file_perms',`{ rw_inherited_file_perms open }')
 define(`create_file_perms',`{ getattr create open }')
 define(`rename_file_perms',`{ getattr rename }')
 define(`delete_file_perms',`{ getattr unlink }')
Signature · 1 line
1.7.8.6
#22 lore raw

PATCH 7/8 Introduce rw_inherited_file_perms definition

Quoted 18 lines · Sven Vermeulen

In many cases throughout the policy, domains require read/write privileges on inherited descriptors. In most cases, these are for files, where the domain needs the read-write permissions but of course no open privilege.

Instead of having to hard-code the permissions every time, this patch introduces the rw_inherited_file_perms to support simple calls for these inherited descriptors.

---
 policy/support/obj_perm_sets.spt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
policy/support/obj_perm_sets.spt +0 -0
index 6e91317..48f0c7a 100644

policy/support/obj_perm_sets.spt define(`mmap_file_perms',`{ getattr open read execute ioctl }') · line 165

Quoted 9 lines
policy/support/obj_perm_sets.spt +2 -1
@@ -158,7 +158,8 @@ define(`mmap_file_perms',`{ getattr open read execute ioctl }')
 define(`exec_file_perms',`{ getattr open read execute ioctl execute_no_trans }')
 define(`append_file_perms',`{ getattr open append lock ioctl }')
 define(`write_file_perms',`{ getattr open write append lock ioctl }')
-define(`rw_file_perms',`{ getattr open read write append ioctl lock }')
+define(`rw_inherited_file_perms',`{ getattr read write append ioctl lock }')
+define(`rw_file_perms',`{ rw_inherited_file_perms open }')
 define(`create_file_perms',`{ getattr create open }')
 define(`rename_file_perms',`{ getattr rename }')
 define(`delete_file_perms',`{ getattr unlink }')> 

Since the tide seems to be going against me on these inherited permissions, I can accept it, but the change needs to be done for all of the relevant file classes.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#23 lore raw

PATCH 8/8 Introduce exec-check interfaces for passwd binaries and useradd binaries

In reply to Sven Vermeulen
---
 policy/modules/admin/usermanage.if |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
policy/modules/admin/usermanage.if +36 -0
index 98b8b2d..99e3903 100644
@@ -140,6 +140,24 @@ interface(`usermanage_kill_passwd',`
 
 ########################################
 ## <summary>
+##	Check if the passwd binary is executable.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`usermanage_check_exec_passwd',`
+	gen_require(`
+		type passwd_exec_t;
+	')
+
+	allow $1 passwd_exec_t:file { execute getattr_file_perms };
+')
+
+########################################
+## <summary>
 ##	Execute passwd in the passwd domain, and
 ##	allow the specified role the passwd domain.
 ## </summary>
@@ -253,6 +271,24 @@ interface(`usermanage_domtrans_useradd',`
 
 ########################################
 ## <summary>
+##	Check if the useradd binaries are executable.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`usermanage_check_exec_useradd',`
+	gen_require(`
+		type useradd_exec_t;
+	')
+
+	allow $1 useradd_exec_t:file { execute getattr_file_perms };
+')
+
+########################################
+## <summary>
 ##	Execute useradd in the useradd domain, and
 ##	allow the specified role the useradd domain.
 ## </summary>
Signature · 1 line
1.7.8.6
#24 lore raw

PATCH 8/8 Introduce exec-check interfaces for passwd binaries and useradd binaries

Quoted 50 lines · Sven Vermeulen
---
 policy/modules/admin/usermanage.if |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
policy/modules/admin/usermanage.if +29 -0
index 98b8b2d..99e3903 100644
@@ -140,6 +140,24 @@ interface(`usermanage_kill_passwd',`
 
 ########################################
 ## <summary>
+##	Check if the passwd binary is executable.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`usermanage_check_exec_passwd',`
+	gen_require(`
+		type passwd_exec_t;
+	')
+
+	allow $1 passwd_exec_t:file { execute getattr_file_perms };
+')
+
+########################################
+## <summary>
 ##	Execute passwd in the passwd domain, and
 ##	allow the specified role the passwd domain.
 ## </summary>
@@ -253,6 +271,24 @@ interface(`usermanage_domtrans_useradd',`
 
 ########################################
 ## <summary>
+##	Check if the useradd binaries are executable.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`usermanage_check_exec_useradd',`
+	gen_require(`
+		type useradd_exec_t;

policy/modules/admin/usermanage.if interface(`usermanage_domtrans_useradd',` · line 294

Quoted 10 lines
policy/modules/admin/usermanage.if +7 -0
+	')
+
+	allow $1 useradd_exec_t:file { execute getattr_file_perms };
+')
+
+########################################
+## <summary>
 ##	Execute useradd in the useradd domain, and
 ##	allow the specified role the useradd domain.
 ## </summary>

Merged.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com