Skip to contentSkip to conversation

Sudo file context specification did not catch paths

PATCH New Dominick Grift 2 participants 4 messages Aug 26, 2013 – Sep 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Sudo file context specification did not catch paths

policy/modules/system/authlogin.fc +1 -1
index 28ad538..5d0f398 100644
@@ -46,4 +46,4 @@
 /var/run/sepermit(/.*)? 	gen_context(system_u:object_r:pam_var_run_t,s0)
 /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|lib|adm)/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)
+/var/((db)|(lib)|(adm))/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)
#1 lore raw

PATCH 1/1 Sudo file context specification did not catch paths

policy/modules/system/authlogin.fc line 49

Quoted 12 lines · Dominick Grift
policy/modules/system/authlogin.fc +1 -1
index 28ad538..5d0f398 100644
@@ -46,4 +46,4 @@
 /var/run/sepermit(/.*)? 	gen_context(system_u:object_r:pam_var_run_t,s0)
 /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|lib|adm)/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)
+/var/((db)|(lib)|(adm))/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)

Odd. It seems to work fine for me. Maybe it is some sort of fc sort problem on your system?

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

#2 lore raw

PATCH 1/1 Sudo file context specification did not catch paths

Quoted 16 lines · Christopher J. PeBenito

policy/modules/system/authlogin.fc line 49

Quoted 12 lines · Dominick Grift
policy/modules/system/authlogin.fc +1 -1
index 28ad538..5d0f398 100644
@@ -46,4 +46,4 @@
 /var/run/sepermit(/.*)? 	gen_context(system_u:object_r:pam_var_run_t,s0)
 /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|lib|adm)/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)
+/var/((db)|(lib)|(adm))/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)

Odd. It seems to work fine for me. Maybe it is some sort of fc sort problem on your system?

see if it catches /var/lib/sudo. It does catch the first and the last, just not the one in the middle if i remember correctly

its not just on my system. this bug was reported by the debian guys i believe

Quoted 5 lines

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

#3 lore raw

PATCH 1/1 Sudo file context specification did not catch paths

Quoted 18 lines · Dominick Grift
Quoted 16 lines · Christopher J. PeBenito

policy/modules/system/authlogin.fc line 49

Quoted 12 lines · Dominick Grift
policy/modules/system/authlogin.fc +1 -1
index 28ad538..5d0f398 100644
@@ -46,4 +46,4 @@
 /var/run/sepermit(/.*)? 	gen_context(system_u:object_r:pam_var_run_t,s0)
 /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|lib|adm)/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)
+/var/((db)|(lib)|(adm))/sudo(/.*)?	gen_context(system_u:object_r:pam_var_run_t,s0)

Odd. It seems to work fine for me. Maybe it is some sort of fc sort problem on your system?

Quoted 5 lines

see if it catches /var/lib/sudo. It does catch the first and the last, just not the one in the middle if i remember correctly

its not just on my system. this bug was reported by the debian guys i believe

Looks like a fc sorting problem:

# matchpathcon /var/db/sudo
/var/db/sudo	system_u:object_r:pam_var_run_t
# matchpathcon /var/lib/sudo
/var/lib/sudo	system_u:object_r:var_lib_t
# matchpathcon /var/adm/sudo
/var/adm/sudo	system_u:object_r:pam_var_run_t
# egrep -n 'sudo.*var_run_t' /etc/selinux/targeted/contexts/files/file_contexts
54:/var/(db|lib|adm)/sudo(/.*)?	system_u:object_r:pam_var_run_t
# egrep -n '^/var/lib.*:var_lib_t' /etc/selinux/strict/contexts/files/file_contexts
135:/var/lib(/.*)?	system_u:object_r:var_lib_t

I'd rather break it into two lines, one for /var/lib/sudo and one for /var/(db|adm)/sudo to work around this.

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