unconfined.if 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. ## <summary>The unconfined domain.</summary>
  2. ########################################
  3. ## <summary>
  4. ## Make the specified domain unconfined.
  5. ## </summary>
  6. ## <param name="domain">
  7. ## <summary>
  8. ## Domain to make unconfined.
  9. ## </summary>
  10. ## </param>
  11. #
  12. interface(`unconfined_domain_noaudit',`
  13. gen_require(`
  14. type unconfined_t;
  15. class dbus all_dbus_perms;
  16. class nscd all_nscd_perms;
  17. class passwd all_passwd_perms;
  18. ')
  19. # Use most Linux capabilities
  20. allow $1 self:capability ~sys_module;
  21. allow $1 self:fifo_file manage_fifo_file_perms;
  22. # Transition to myself, to make get_ordered_context_list happy.
  23. allow $1 self:process transition;
  24. # Write access is for setting attributes under /proc/self/attr.
  25. allow $1 self:file rw_file_perms;
  26. # Userland object managers
  27. allow $1 self:nscd *;
  28. allow $1 self:dbus *;
  29. allow $1 self:passwd *;
  30. allow $1 self:association *;
  31. kernel_unconfined($1)
  32. corenet_unconfined($1)
  33. dev_unconfined($1)
  34. domain_unconfined($1)
  35. domain_dontaudit_read_all_domains_state($1)
  36. domain_dontaudit_ptrace_all_domains($1)
  37. files_unconfined($1)
  38. fs_unconfined($1)
  39. selinux_unconfined($1)
  40. tunable_policy(`allow_execheap',`
  41. # Allow making the stack executable via mprotect.
  42. allow $1 self:process execheap;
  43. ')
  44. tunable_policy(`allow_execmem',`
  45. # Allow making anonymous memory executable, e.g.
  46. # for runtime-code generation or executable stack.
  47. allow $1 self:process execmem;
  48. ')
  49. tunable_policy(`allow_execstack',`
  50. # Allow making the stack executable via mprotect;
  51. # execstack implies execmem;
  52. allow $1 self:process { execstack execmem };
  53. # auditallow $1 self:process execstack;
  54. ')
  55. optional_policy(`
  56. auth_unconfined($1)
  57. ')
  58. optional_policy(`
  59. dbus_unconfined($1)
  60. ')
  61. optional_policy(`
  62. ipsec_setcontext_default_spd($1)
  63. ipsec_match_default_spd($1)
  64. ')
  65. optional_policy(`
  66. nscd_unconfined($1)
  67. ')
  68. optional_policy(`
  69. postgresql_unconfined($1)
  70. ')
  71. optional_policy(`
  72. seutil_create_bin_policy($1)
  73. seutil_relabelto_bin_policy($1)
  74. ')
  75. optional_policy(`
  76. storage_unconfined($1)
  77. ')
  78. optional_policy(`
  79. xserver_unconfined($1)
  80. ')
  81. ')
  82. ########################################
  83. ## <summary>
  84. ## Make the specified domain unconfined and
  85. ## audit executable heap usage.
  86. ## </summary>
  87. ## <desc>
  88. ## <p>
  89. ## Make the specified domain unconfined and
  90. ## audit executable heap usage. With exception
  91. ## of memory protections, usage of this interface
  92. ## will result in the level of access the domain has
  93. ## is like SELinux was not being used.
  94. ## </p>
  95. ## <p>
  96. ## Only completely trusted domains should use this interface.
  97. ## </p>
  98. ## </desc>
  99. ## <param name="domain">
  100. ## <summary>
  101. ## Domain to make unconfined.
  102. ## </summary>
  103. ## </param>
  104. #
  105. interface(`unconfined_domain',`
  106. unconfined_domain_noaudit($1)
  107. tunable_policy(`allow_execheap',`
  108. auditallow $1 self:process execheap;
  109. ')
  110. ')
  111. ########################################
  112. ## <summary>
  113. ## Add an alias type to the unconfined domain. (Deprecated)
  114. ## </summary>
  115. ## <desc>
  116. ## <p>
  117. ## Add an alias type to the unconfined domain. (Deprecated)
  118. ## </p>
  119. ## <p>
  120. ## This is added to support targeted policy. Its
  121. ## use should be limited. It has no effect
  122. ## on the strict policy.
  123. ## </p>
  124. ## </desc>
  125. ## <param name="domain">
  126. ## <summary>
  127. ## New alias of the unconfined domain.
  128. ## </summary>
  129. ## </param>
  130. #
  131. interface(`unconfined_alias_domain',`
  132. refpolicywarn(`$0($1) has been deprecated.')
  133. ')
  134. ########################################
  135. ## <summary>
  136. ## Add an alias type to the unconfined execmem
  137. ## program file type. (Deprecated)
  138. ## </summary>
  139. ## <desc>
  140. ## <p>
  141. ## Add an alias type to the unconfined execmem
  142. ## program file type. (Deprecated)
  143. ## </p>
  144. ## <p>
  145. ## This is added to support targeted policy. Its
  146. ## use should be limited. It has no effect
  147. ## on the strict policy.
  148. ## </p>
  149. ## </desc>
  150. ## <param name="domain">
  151. ## <summary>
  152. ## New alias of the unconfined execmem program type.
  153. ## </summary>
  154. ## </param>
  155. #
  156. interface(`unconfined_execmem_alias_program',`
  157. refpolicywarn(`$0($1) has been deprecated.')
  158. ')
  159. ########################################
  160. ## <summary>
  161. ## Transition to the unconfined domain.
  162. ## </summary>
  163. ## <param name="domain">
  164. ## <summary>
  165. ## Domain allowed to transition.
  166. ## </summary>
  167. ## </param>
  168. #
  169. interface(`unconfined_domtrans',`
  170. gen_require(`
  171. type unconfined_t, unconfined_exec_t;
  172. ')
  173. domtrans_pattern($1, unconfined_exec_t, unconfined_t)
  174. ')
  175. ########################################
  176. ## <summary>
  177. ## Execute specified programs in the unconfined domain.
  178. ## </summary>
  179. ## <param name="domain">
  180. ## <summary>
  181. ## Domain allowed to transition.
  182. ## </summary>
  183. ## </param>
  184. ## <param name="role">
  185. ## <summary>
  186. ## The role to allow the unconfined domain.
  187. ## </summary>
  188. ## </param>
  189. #
  190. interface(`unconfined_run',`
  191. gen_require(`
  192. type unconfined_t;
  193. ')
  194. unconfined_domtrans($1)
  195. role $2 types unconfined_t;
  196. ')
  197. ########################################
  198. ## <summary>
  199. ## Transition to the unconfined domain by executing a shell.
  200. ## </summary>
  201. ## <param name="domain">
  202. ## <summary>
  203. ## Domain allowed to transition.
  204. ## </summary>
  205. ## </param>
  206. #
  207. interface(`unconfined_shell_domtrans',`
  208. gen_require(`
  209. type unconfined_t;
  210. ')
  211. corecmd_shell_domtrans($1, unconfined_t)
  212. allow unconfined_t $1:fd use;
  213. allow unconfined_t $1:fifo_file rw_file_perms;
  214. allow unconfined_t $1:process sigchld;
  215. ')
  216. ########################################
  217. ## <summary>
  218. ## Allow unconfined to execute the specified program in
  219. ## the specified domain.
  220. ## </summary>
  221. ## <desc>
  222. ## <p>
  223. ## Allow unconfined to execute the specified program in
  224. ## the specified domain.
  225. ## </p>
  226. ## <p>
  227. ## This is a interface to support third party modules
  228. ## and its use is not allowed in upstream reference
  229. ## policy.
  230. ## </p>
  231. ## </desc>
  232. ## <param name="domain">
  233. ## <summary>
  234. ## Domain to execute in.
  235. ## </summary>
  236. ## </param>
  237. ## <param name="entry_file">
  238. ## <summary>
  239. ## Domain entry point file.
  240. ## </summary>
  241. ## </param>
  242. #
  243. interface(`unconfined_domtrans_to',`
  244. gen_require(`
  245. type unconfined_t;
  246. ')
  247. domtrans_pattern(unconfined_t,$2,$1)
  248. ')
  249. ########################################
  250. ## <summary>
  251. ## Allow unconfined to execute the specified program in
  252. ## the specified domain. Allow the specified domain the
  253. ## unconfined role and use of unconfined user terminals.
  254. ## </summary>
  255. ## <desc>
  256. ## <p>
  257. ## Allow unconfined to execute the specified program in
  258. ## the specified domain. Allow the specified domain the
  259. ## unconfined role and use of unconfined user terminals.
  260. ## </p>
  261. ## <p>
  262. ## This is a interface to support third party modules
  263. ## and its use is not allowed in upstream reference
  264. ## policy.
  265. ## </p>
  266. ## </desc>
  267. ## <param name="domain">
  268. ## <summary>
  269. ## Domain to execute in.
  270. ## </summary>
  271. ## </param>
  272. ## <param name="entry_file">
  273. ## <summary>
  274. ## Domain entry point file.
  275. ## </summary>
  276. ## </param>
  277. #
  278. interface(`unconfined_run_to',`
  279. gen_require(`
  280. type unconfined_t;
  281. role unconfined_r;
  282. ')
  283. domtrans_pattern(unconfined_t,$2,$1)
  284. role unconfined_r types $1;
  285. userdom_use_user_terminals($1)
  286. ')
  287. ########################################
  288. ## <summary>
  289. ## Inherit file descriptors from the unconfined domain.
  290. ## </summary>
  291. ## <param name="domain">
  292. ## <summary>
  293. ## Domain allowed access.
  294. ## </summary>
  295. ## </param>
  296. #
  297. interface(`unconfined_use_fds',`
  298. gen_require(`
  299. type unconfined_t;
  300. ')
  301. allow $1 unconfined_t:fd use;
  302. ')
  303. ########################################
  304. ## <summary>
  305. ## Send a SIGCHLD signal to the unconfined domain.
  306. ## </summary>
  307. ## <param name="domain">
  308. ## <summary>
  309. ## Domain allowed access.
  310. ## </summary>
  311. ## </param>
  312. #
  313. interface(`unconfined_sigchld',`
  314. gen_require(`
  315. type unconfined_t;
  316. ')
  317. allow $1 unconfined_t:process sigchld;
  318. ')
  319. ########################################
  320. ## <summary>
  321. ## Send a SIGNULL signal to the unconfined domain.
  322. ## </summary>
  323. ## <param name="domain">
  324. ## <summary>
  325. ## Domain allowed access.
  326. ## </summary>
  327. ## </param>
  328. #
  329. interface(`unconfined_signull',`
  330. gen_require(`
  331. type unconfined_t;
  332. ')
  333. allow $1 unconfined_t:process signull;
  334. ')
  335. ########################################
  336. ## <summary>
  337. ## Send generic signals to the unconfined domain.
  338. ## </summary>
  339. ## <param name="domain">
  340. ## <summary>
  341. ## Domain allowed access.
  342. ## </summary>
  343. ## </param>
  344. #
  345. interface(`unconfined_signal',`
  346. gen_require(`
  347. type unconfined_t;
  348. ')
  349. allow $1 unconfined_t:process signal;
  350. ')
  351. ########################################
  352. ## <summary>
  353. ## Read unconfined domain unnamed pipes.
  354. ## </summary>
  355. ## <param name="domain">
  356. ## <summary>
  357. ## Domain allowed access.
  358. ## </summary>
  359. ## </param>
  360. #
  361. interface(`unconfined_read_pipes',`
  362. gen_require(`
  363. type unconfined_t;
  364. ')
  365. allow $1 unconfined_t:fifo_file read_fifo_file_perms;
  366. ')
  367. ########################################
  368. ## <summary>
  369. ## Do not audit attempts to read unconfined domain unnamed pipes.
  370. ## </summary>
  371. ## <param name="domain">
  372. ## <summary>
  373. ## Domain to not audit.
  374. ## </summary>
  375. ## </param>
  376. #
  377. interface(`unconfined_dontaudit_read_pipes',`
  378. gen_require(`
  379. type unconfined_t;
  380. ')
  381. dontaudit $1 unconfined_t:fifo_file read;
  382. ')
  383. ########################################
  384. ## <summary>
  385. ## Read and write unconfined domain unnamed pipes.
  386. ## </summary>
  387. ## <param name="domain">
  388. ## <summary>
  389. ## Domain allowed access.
  390. ## </summary>
  391. ## </param>
  392. #
  393. interface(`unconfined_rw_pipes',`
  394. gen_require(`
  395. type unconfined_t;
  396. ')
  397. allow $1 unconfined_t:fifo_file rw_fifo_file_perms;
  398. ')
  399. ########################################
  400. ## <summary>
  401. ## Do not audit attempts to read and write
  402. ## unconfined domain unnamed pipes.
  403. ## </summary>
  404. ## <param name="domain">
  405. ## <summary>
  406. ## Domain to not audit.
  407. ## </summary>
  408. ## </param>
  409. #
  410. interface(`unconfined_dontaudit_rw_pipes',`
  411. gen_require(`
  412. type unconfined_t;
  413. ')
  414. dontaudit $1 unconfined_t:fifo_file rw_file_perms;
  415. ')
  416. ########################################
  417. ## <summary>
  418. ## Connect to the unconfined domain using
  419. ## a unix domain stream socket.
  420. ## </summary>
  421. ## <param name="domain">
  422. ## <summary>
  423. ## Domain allowed access.
  424. ## </summary>
  425. ## </param>
  426. #
  427. interface(`unconfined_stream_connect',`
  428. gen_require(`
  429. type unconfined_t;
  430. ')
  431. allow $1 unconfined_t:unix_stream_socket connectto;
  432. ')
  433. ########################################
  434. ## <summary>
  435. ## Do not audit attempts to read or write
  436. ## unconfined domain tcp sockets.
  437. ## </summary>
  438. ## <desc>
  439. ## <p>
  440. ## Do not audit attempts to read or write
  441. ## unconfined domain tcp sockets.
  442. ## </p>
  443. ## <p>
  444. ## This interface was added due to a broken
  445. ## symptom in ldconfig.
  446. ## </p>
  447. ## </desc>
  448. ## <param name="domain">
  449. ## <summary>
  450. ## Domain to not audit.
  451. ## </summary>
  452. ## </param>
  453. #
  454. interface(`unconfined_dontaudit_rw_tcp_sockets',`
  455. gen_require(`
  456. type unconfined_t;
  457. ')
  458. dontaudit $1 unconfined_t:tcp_socket { read write };
  459. ')
  460. ########################################
  461. ## <summary>
  462. ## Create keys for the unconfined domain.
  463. ## </summary>
  464. ## <param name="domain">
  465. ## <summary>
  466. ## Domain allowed access.
  467. ## </summary>
  468. ## </param>
  469. #
  470. interface(`unconfined_create_keys',`
  471. gen_require(`
  472. type unconfined_t;
  473. ')
  474. allow $1 unconfined_t:key create;
  475. ')
  476. ########################################
  477. ## <summary>
  478. ## Send messages to the unconfined domain over dbus.
  479. ## </summary>
  480. ## <param name="domain">
  481. ## <summary>
  482. ## Domain allowed access.
  483. ## </summary>
  484. ## </param>
  485. #
  486. interface(`unconfined_dbus_send',`
  487. gen_require(`
  488. type unconfined_t;
  489. class dbus send_msg;
  490. ')
  491. allow $1 unconfined_t:dbus send_msg;
  492. ')
  493. ########################################
  494. ## <summary>
  495. ## Send and receive messages from
  496. ## unconfined_t over dbus.
  497. ## </summary>
  498. ## <param name="domain">
  499. ## <summary>
  500. ## Domain allowed access.
  501. ## </summary>
  502. ## </param>
  503. #
  504. interface(`unconfined_dbus_chat',`
  505. gen_require(`
  506. type unconfined_t;
  507. class dbus send_msg;
  508. ')
  509. allow $1 unconfined_t:dbus send_msg;
  510. allow unconfined_t $1:dbus send_msg;
  511. ')
  512. ########################################
  513. ## <summary>
  514. ## Connect to the the unconfined DBUS
  515. ## for service (acquire_svc).
  516. ## </summary>
  517. ## <param name="domain">
  518. ## <summary>
  519. ## Domain allowed access.
  520. ## </summary>
  521. ## </param>
  522. #
  523. interface(`unconfined_dbus_connect',`
  524. gen_require(`
  525. type unconfined_t;
  526. class dbus acquire_svc;
  527. ')
  528. allow $1 unconfined_t:dbus acquire_svc;
  529. ')
  530. ########################################
  531. ## <summary>
  532. ## Do not audit attempts to read and write
  533. ## unconfined domain stream.
  534. ## </summary>
  535. ## <param name="domain">
  536. ## <summary>
  537. ## Domain to not audit.
  538. ## </summary>
  539. ## </param>
  540. #
  541. interface(`unconfined_dontaudit_rw_stream',`
  542. gen_require(`
  543. type unconfined_t;
  544. ')
  545. dontaudit $1 unconfined_t:unix_stream_socket rw_socket_perms;
  546. ')