From 7cf2858e4a096e09c43c0666923b9f9ce04a0909 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Mon, 1 Mar 2010 10:53:50 -0500 Subject: [PATCH] Improve the documentation of files interfaces: files_pid_file() files_config_file() files_tmp_file() files_read_etc_runtime_files() files_read_usr_files() files_search_var_lib() files_pid_filetrans() --- policy/modules/kernel/files.if | 165 ++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 3 deletions(-) diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if index 7fa830931..cf82911a9 100644 --- a/policy/modules/kernel/files.if +++ b/policy/modules/kernel/files.if @@ -58,6 +58,14 @@ ##
  • logging_log_file()
  • ##
  • userdom_user_home_content()
  • ## +##

    +## Example: +##

    +##

    +## type myfile_t; +## files_type(myfile_t) +## allow mydomain_t myfile_t:file read_file_perms; +##

    ## ## ## @@ -160,11 +168,39 @@ interface(`files_security_mountpoint',` ## Make the specified type usable for ## runtime process ID files. ## +## +##

    +## Make the specified type usable for runtime process ID files, +## typically found in /var/run. +## This will also make the type usable for files, making +## calls to files_type() redundant. Failure to use this interface +## for a PID file type may result in problems with starting +## or stopping services. +##

    +##

    +## Related interfaces: +##

    +## +##

    +## Example usage with a domain that can create and +## write its PID file with a private PID file type in the +## /var/run directory: +##

    +##

    +## type mypidfile_t; +## files_pid_file(mypidfile_t) +## allow mydomain_t mypidfile_t:file { create_file_perms write_file_perms }; +## files_pid_filetrans(mydomain_t, mypidfile_t, file) +##

    +##
    ## ## ## Type to be used for PID files. ## ## +## # interface(`files_pid_file',` gen_require(` @@ -180,11 +216,31 @@ interface(`files_pid_file',` ## Make the specified type a ## configuration file. ## +## +##

    +## Make the specified type usable for configuration files. +## This will also make the type usable for files, making +## calls to files_type() redundant. Failure to use this interface +## for a temporary file may result in problems with +## configuration management tools. +##

    +##

    +## Example usage with a domain that can read +## its configuration file /etc: +##

    +##

    +## type myconffile_t; +## files_config_file(myconffile_t) +## allow mydomain_t myconffile_t:file read_file_perms; +## files_search_etc(mydomain_t) +##

    +##
    ## ## ## Type to be used as a configuration file. ## ## +## # interface(`files_config_file',` gen_require(` @@ -288,12 +344,39 @@ interface(`files_poly_member_tmp',` ## Make the specified type a file ## used for temporary files. ## +## +##

    +## Make the specified type usable for temporary files. +## This will also make the type usable for files, making +## calls to files_type() redundant. Failure to use this interface +## for a temporary file may result in problems with +## purging temporary files. +##

    +##

    +## Related interfaces: +##

    +##
      +##
    • files_tmp_filetrans()
    • +##
    +##

    +## Example usage with a domain that can create and +## write its temporary file in the system temporary file +## directories (/tmp or /var/tmp): +##

    +##

    +## type mytmpfile_t; +## files_tmp_file(mytmpfile_t) +## allow mydomain_t mytmpfile_t:file { create_file_perms write_file_perms }; +## files_tmp_filetrans(mydomain_t, mytmpfile_t, file) +##

    +##
    ## ## ## Type of the file to be used as a ## temporary file. ## ## +## # interface(`files_tmp_file',` gen_require(` @@ -2178,7 +2261,7 @@ interface(`files_manage_etc_dirs',` ##
  • auth_read_shadow()
  • ##
  • files_read_etc_runtime_files()
  • ##
  • seutil_read_config()
  • -## +## ## ## ## @@ -2410,11 +2493,29 @@ interface(`files_create_boot_flag',` ## Read files in /etc that are dynamically ## created on boot, such as mtab. ## +## +##

    +## Allow the specified domain to read dynamically created +## configuration files in /etc. These files are typically +## general system configuration files that do +## not have more specific SELinux types. Some +## examples of these files are: +##

    +##
      +##
    • /etc/motd
    • +##
    • /etc/mtab
    • +##
    • /etc/nologin
    • +##
    +##

    +## This interface does not include access to /etc/shadow. +##

    +##
    ## ## ## Domain allowed access. ## ## +## ## # interface(`files_read_etc_runtime_files',` @@ -3930,11 +4031,29 @@ interface(`files_getattr_usr_files',` ## ## Read generic files in /usr. ## +## +##

    +## Allow the specified domain to read generic +## files in /usr. These files are various program +## files that do not have more specific SELinux types. +## Some examples of these files are: +##

    +##
      +##
    • /usr/include/*
    • +##
    • /usr/share/doc/*
    • +##
    • /usr/share/info/*
    • +##
    +##

    +## Generally, it is safe for many domains to have +## this access. +##

    +##
    ## ## ## Domain allowed access. ## ## +## # interface(`files_read_usr_files',` gen_require(` @@ -4491,11 +4610,25 @@ interface(`files_getattr_var_lib_dirs',` ## ## Search the /var/lib directory. ## +## +##

    +## Search the /var/lib directory. This is +## necessary to access files or directories under +## /var/lib that have a private type. For example, a +## domain accessing a private library file in the +## /var/lib directory: +##

    +##

    +## allow mydomain_t mylibfile_t:file read_file_perms; +## files_search_var_lib(mydomain_t) +##

    +##
    ## ## ## Domain allowed access. ## ## +## # interface(`files_search_var_lib',` gen_require(` @@ -4938,9 +5071,34 @@ interface(`files_read_generic_pids',` ######################################## ## -## Create an object in the process ID directory, with a private -## type using a type transition. +## Create an object in the process ID directory, with a private type. ## +## +##

    +## Create an object in the process ID directory (e.g., /var/run) +## with a private type. Typically this is used for creating +## private PID files in /var/run with the private type instead +## of the general PID file type. To accomplish this goal, +## either the program must be SELinux-aware, or use this interface. +##

    +##

    +## Related interfaces: +##

    +##
      +##
    • files_pid_file()
    • +##
    +##

    +## Example usage with a domain that can create and +## write its PID file with a private PID file type in the +## /var/run directory: +##

    +##

    +## type mypidfile_t; +## files_pid_file(mypidfile_t) +## allow mydomain_t mypidfile_t:file { create_file_perms write_file_perms }; +## files_pid_filetrans(mydomain_t, mypidfile_t, file) +##

    +##
    ## ## ## Domain allowed access. @@ -4956,6 +5114,7 @@ interface(`files_read_generic_pids',` ## The object class of the object being created. ## ## +## # interface(`files_pid_filetrans',` gen_require(`