From 6bb0da317452e621ac2199322df8f0a661a6e8c5 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Wed, 1 Feb 2006 13:09:09 +0000 Subject: [PATCH] add example module. --- refpolicy/doc/example.fc | 6 +++++ refpolicy/doc/example.if | 55 ++++++++++++++++++++++++++++++++++++++++ refpolicy/doc/example.te | 29 +++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 refpolicy/doc/example.fc create mode 100644 refpolicy/doc/example.if create mode 100644 refpolicy/doc/example.te diff --git a/refpolicy/doc/example.fc b/refpolicy/doc/example.fc new file mode 100644 index 00000000..9cf7c4c1 --- /dev/null +++ b/refpolicy/doc/example.fc @@ -0,0 +1,6 @@ +# myapp executable will have: +# label: system_u:object_r:myapp_exec_t +# MLS sensitivity: s0 +# MCS categories: + +/usr/sbin/myapp -- gen_context(system_u:object_r:myapp_exec_t,s0) diff --git a/refpolicy/doc/example.if b/refpolicy/doc/example.if new file mode 100644 index 00000000..8e9591b1 --- /dev/null +++ b/refpolicy/doc/example.if @@ -0,0 +1,55 @@ +## Myapp example policy +## +##

+## More descriptive text about myapp. The +## tag can also use

,

    , and
      +## html tags for formatting. +##

      +##

      +## This policy supports the following myapp features: +##

        +##
      • Feature A
      • +##
      • Feature B
      • +##
      • Feature C
      • +##
      +##

      +## +# + +######################################## +## +## Execute a domain transition to run myapp. +## +## +## Domain allowed to transition. +## +# +interface(`myapp_domtrans',` + gen_requires(` + type myapp_t, myapp_exec_t; + ') + + domain_auto_trans($1,myapp_exec_t,myapp_t) + + allow $1 myapp_t:fd use; + allow myapp_t $1:fd use; + allow $1 myapp_t:fifo_file rw_file_perms; + allow $1 myapp_t:process sigchld; +') + +######################################## +## +## Read myapp log files. +## +## +## Domain allowed to read the log files. +## +# +interface(`myapp_read_log',` + gen_requires(` + type myapp_log_t; + ') + + logging_search_logs($1) + allow $1 myapp_log_t:file r_file_perms; +') diff --git a/refpolicy/doc/example.te b/refpolicy/doc/example.te new file mode 100644 index 00000000..7d4581bf --- /dev/null +++ b/refpolicy/doc/example.te @@ -0,0 +1,29 @@ + +policy_module(myapp,1.0.0) + +######################################## +# +# Declarations +# + +type myapp_t; +type myapp_exec_t; +domain_type(myapp_t) +domain_entry_file(myapp_t, myapp_exec_t) + +type myapp_log_t; +logging_log_file(myapp_log_t) + +type myapp_tmp_t; +files_tmp_file(myapp_tmp_t) + +######################################## +# +# Myapp local policy +# + +allow myapp_t myapp_log_t:file ra_file_perms; + +allow myapp_t myapp_tmp_t:file manage_file_perms; +files_filetrans_tmp(myapp_t,myapp_tmp_t,file) +