how to use require and gen_require properly
I'm writing a new policy for a special purpose and don't expect to submit it for refpolicy because it is just too domain specific and not useful for public domain. Therefore I cannot write a new interface which could be included in the default policy.
Here is my actual problem. I want to use filetrans because my daemon creates /dev/twa0 automatically. Therefore I have to write something like this:
filetrans_pattern(my_daemon_t, device_t, fixed_disk_device_t, chr_file)
Should I include the following require statement at the top of my te file:
require {
type device_t, fixed_disk_device_t;
}or should I use this one:
gen_require(`
type _device_t, fixed_disk_device_t;
')
What is the actual difference between require and gen_require? Is it allowed to write such statements at the top of the policy or in general is this good practice or not? What was the actual intention of having two require statements? I guess the gen_require was especially for interfaces. But which one should be used if no interface is used?
Some clarification would be really appreciated.
- 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.
Quoted 18 lines · Stefan Schulze Frielinghaus
I'm writing a new policy for a special purpose and don't expect to submit it for refpolicy because it is just too domain specific and not useful for public domain. Therefore I cannot write a new interface which could be included in the default policy.
Here is my actual problem. I want to use filetrans because my daemon creates
/dev/twa0automatically. Therefore I have to write something like this:
filetrans_pattern(my_daemon_t, device_t, fixed_disk_device_t, chr_file)Should I include the following require statement at the top of my te file:
require { type device_t, fixed_disk_device_t; }
Quoted 5 lines
or should I use this one:
gen_require(`
type _device_t, fixed_disk_device_t;')
Either one is fine.
Quoted 5 lines
What is the actual difference between require and
gen_require? Is it allowed to write such statements at the top of the policy or in general is this good practice or not? What was the actual intention of having two require statements? I guess thegen_requirewas especially for interfaces. But which one should be used if no interface is used?
gen_require() is just a require{} block. The only difference is that it disappears in the global scope of the base module or the global scope of the monolithic policy since require{} blocks are not allowed in those places. If you are using a loadable module, using either require{} or gen_require() is fine.
Signature · 13 lines
Chris PeBenito <[email protected]> Developer, Hardened Gentoo Linux Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243 Key fingerprint = B0E6 877A 883F A57A 8E6A CB00 BC8E E42D E6AF 9243 -- 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.
On Fri, 2009-09-11 at 08:16 -0400, Chris PeBenito wrote:
[...]
Quoted 11 lines
Quoted 5 lines
What is the actual difference between require and
gen_require? Is it allowed to write such statements at the top of the policy or in general is this good practice or not? What was the actual intention of having two require statements? I guess thegen_requirewas especially for interfaces. But which one should be used if no interface is used?
gen_require()is just a require{} block. The only difference is that it disappears in the global scope of the base module or the global scope of the monolithic policy since require{} blocks are not allowed in those places. If you are using a loadable module, using either require{} orgen_require()is fine.
Ah, OK, this explains a lot. Thanks! Now I know what to do ;-)
--
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.