logrotate.if 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. ## <summary>Rotates, compresses, removes and mails system log files.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Execute logrotate in the logrotate domain.
  5. ## </summary>
  6. ## <param name="domain">
  7. ## <summary>
  8. ## Domain allowed to transition.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`logrotate_domtrans',`
  13. gen_require(`
  14. type logrotate_t, logrotate_exec_t;
  15. ')
  16. corecmd_search_bin($1)
  17. domtrans_pattern($1, logrotate_exec_t, logrotate_t)
  18. ')
  19. ########################################
  20. ## <summary>
  21. ## Execute logrotate in the logrotate
  22. ## domain, and allow the specified
  23. ## role the logrotate domain.
  24. ## </summary>
  25. ## <param name="domain">
  26. ## <summary>
  27. ## Domain allowed to transition.
  28. ## </summary>
  29. ## </param>
  30. ## <param name="role">
  31. ## <summary>
  32. ## Role allowed access.
  33. ## </summary>
  34. ## </param>
  35. ## <rolecap/>
  36. #
  37. interface(`logrotate_run',`
  38. gen_require(`
  39. attribute_role logrotate_roles;
  40. ')
  41. logrotate_domtrans($1)
  42. roleattribute $2 logrotate_roles;
  43. ')
  44. ########################################
  45. ## <summary>
  46. ## Execute logrotate in the caller domain.
  47. ## </summary>
  48. ## <param name="domain">
  49. ## <summary>
  50. ## Domain allowed access.
  51. ## </summary>
  52. ## </param>
  53. #
  54. interface(`logrotate_exec',`
  55. gen_require(`
  56. type logrotate_exec_t;
  57. ')
  58. corecmd_search_bin($1)
  59. can_exec($1, logrotate_exec_t)
  60. ')
  61. ########################################
  62. ## <summary>
  63. ## Inherit and use logrotate file descriptors.
  64. ## </summary>
  65. ## <param name="domain">
  66. ## <summary>
  67. ## Domain allowed access.
  68. ## </summary>
  69. ## </param>
  70. #
  71. interface(`logrotate_use_fds',`
  72. gen_require(`
  73. type logrotate_t;
  74. ')
  75. allow $1 logrotate_t:fd use;
  76. ')
  77. ########################################
  78. ## <summary>
  79. ## Do not audit attempts to inherit
  80. ## logrotate file descriptors.
  81. ## </summary>
  82. ## <param name="domain">
  83. ## <summary>
  84. ## Domain to not audit.
  85. ## </summary>
  86. ## </param>
  87. #
  88. interface(`logrotate_dontaudit_use_fds',`
  89. gen_require(`
  90. type logrotate_t;
  91. ')
  92. dontaudit $1 logrotate_t:fd use;
  93. ')
  94. ########################################
  95. ## <summary>
  96. ## Read logrotate temporary files.
  97. ## </summary>
  98. ## <param name="domain">
  99. ## <summary>
  100. ## Domain allowed access.
  101. ## </summary>
  102. ## </param>
  103. #
  104. interface(`logrotate_read_tmp_files',`
  105. gen_require(`
  106. type logrotate_tmp_t;
  107. ')
  108. files_search_tmp($1)
  109. allow $1 logrotate_tmp_t:file read_file_perms;
  110. ')