shutdown.if 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ## <summary>System shutdown command.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Role access for shutdown.
  5. ## </summary>
  6. ## <param name="role">
  7. ## <summary>
  8. ## Role allowed access.
  9. ## </summary>
  10. ## </param>
  11. ## <param name="domain">
  12. ## <summary>
  13. ## User domain for the role.
  14. ## </summary>
  15. ## </param>
  16. #
  17. interface(`shutdown_role',`
  18. gen_require(`
  19. type shutdown_t;
  20. ')
  21. shutdown_run($2, $1)
  22. allow $2 shutdown_t:process { ptrace signal_perms };
  23. ps_process_pattern($2, shutdown_t)
  24. ')
  25. ########################################
  26. ## <summary>
  27. ## Execute a domain transition to run shutdown.
  28. ## </summary>
  29. ## <param name="domain">
  30. ## <summary>
  31. ## Domain allowed to transition.
  32. ## </summary>
  33. ## </param>
  34. #
  35. interface(`shutdown_domtrans',`
  36. gen_require(`
  37. type shutdown_t, shutdown_exec_t;
  38. ')
  39. corecmd_search_bin($1)
  40. domtrans_pattern($1, shutdown_exec_t, shutdown_t)
  41. ')
  42. ########################################
  43. ## <summary>
  44. ## Execute shutdown in the shutdown
  45. ## domain, and allow the specified role
  46. ## the shutdown domain.
  47. ## </summary>
  48. ## <param name="domain">
  49. ## <summary>
  50. ## Domain allowed to transition.
  51. ## </summary>
  52. ## </param>
  53. ## <param name="role">
  54. ## <summary>
  55. ## Role allowed access.
  56. ## </summary>
  57. ## </param>
  58. #
  59. interface(`shutdown_run',`
  60. gen_require(`
  61. attribute_role shutdown_roles;
  62. ')
  63. shutdown_domtrans($1)
  64. roleattribute $2 shutdown_roles;
  65. ')
  66. ########################################
  67. ## <summary>
  68. ## Send generic signals to shutdown.
  69. ## </summary>
  70. ## <param name="domain">
  71. ## <summary>
  72. ## Domain allowed access.
  73. ## </summary>
  74. ## </param>
  75. #
  76. interface(`shutdown_signal',`
  77. gen_require(`
  78. type shutdown_t;
  79. ')
  80. allow shutdown_t $1:process signal;
  81. ')
  82. ########################################
  83. ## <summary>
  84. ## Get attributes of shutdown executable files.
  85. ## </summary>
  86. ## <param name="domain">
  87. ## <summary>
  88. ## Domain allowed access.
  89. ## </summary>
  90. ## </param>
  91. #
  92. interface(`shutdown_getattr_exec_files',`
  93. gen_require(`
  94. type shutdown_exec_t;
  95. ')
  96. corecmd_search_bin($1)
  97. allow $1 shutdown_exec_t:file getattr_file_perms;
  98. ')