Skip to contentSkip to conversation

runcon in enforcing mode

DISCUSSION Ian Pilcher 2 participants 2 messages Jan 30, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

Does $SUBJECT ever work?

I am trying to figure out why a script is failing when run by certmonger (system_u:system_r:certmonger_t:s0), but attempting to run any executable is giving me a denial.

$ sudo runcon system_u:system_r:certmonger_t:s0 /bin/true
runcon: ‘/bin/true’: Permission denied

type=AVC msg=audit(1548883146.502:300): avc: denied { entrypoint } for
pid=12697 comm="runcon" path="/usr/bin/true" dev="dm-3" ino=2190
scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Am I doing something wrong?

Signature · 4 lines
========================================================================
Ian Pilcher                                         [email protected]
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
#1 lore raw
Quoted 6 lines · Ian Pilcher

Does $SUBJECT ever work?

I am trying to figure out why a script is failing when run by certmonger (system_u:system_r:certmonger_t:s0), but attempting to run any executable is giving me a denial.

Quoted 8 lines
$ sudo runcon system_u:system_r:certmonger_t:s0 /bin/true
runcon: ‘/bin/true’: Permission denied

type=AVC msg=audit(1548883146.502:300): avc:  denied  { entrypoint } for
 pid=12697 comm="runcon" path="/usr/bin/true" dev="dm-3" ino=2190
scontext=system_u:system_r:certmonger_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Am I doing something wrong?

A key aspect of type enforcement is ensuring that a given domain can only be entered via an approved executable and can only execute authorized code. Hence, the entrypoint check. This means that if you want to experiment with running some other program in a domain, you must do one of the following:

1) Label the file in question with the authorized type, e.g. cp /bin/true .
chcon -t certmonger_exec_t true
runcon system_u:system_r:certmonger_t:s0 ./true

2) Create and insert a local policy module allowing entrypoint to the type of the file,

-or-

3) Make the domain permissive or set the global enforcing mode to permissive.

You may also encounter other denials related to the transition since normally certmonger wouldn't be started this way.