ssh.if 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. ## <summary>Secure shell client and server policy.</summary>
  2. #######################################
  3. ## <summary>
  4. ## Basic SSH client template.
  5. ## </summary>
  6. ## <desc>
  7. ## <p>
  8. ## This template creates a derived domains which are used
  9. ## for ssh client sessions. A derived
  10. ## type is also created to protect the user ssh keys.
  11. ## </p>
  12. ## <p>
  13. ## This template was added for NX.
  14. ## </p>
  15. ## </desc>
  16. ## <param name="userdomain_prefix">
  17. ## <summary>
  18. ## The prefix of the domain (e.g., user
  19. ## is the prefix for user_t).
  20. ## </summary>
  21. ## </param>
  22. ## <param name="user_domain">
  23. ## <summary>
  24. ## The type of the domain.
  25. ## </summary>
  26. ## </param>
  27. ## <param name="user_role">
  28. ## <summary>
  29. ## The role associated with the user domain.
  30. ## </summary>
  31. ## </param>
  32. #
  33. template(`ssh_basic_client_template',`
  34. gen_require(`
  35. attribute ssh_server;
  36. type ssh_exec_t, sshd_key_t, sshd_tmp_t;
  37. ')
  38. ##############################
  39. #
  40. # Declarations
  41. #
  42. type $1_ssh_t;
  43. application_domain($1_ssh_t, ssh_exec_t)
  44. role $3 types $1_ssh_t;
  45. type $1_ssh_home_t;
  46. files_type($1_ssh_home_t)
  47. typealias $1_ssh_home_t alias $1_home_ssh_t;
  48. ##############################
  49. #
  50. # Client local policy
  51. #
  52. allow $1_ssh_t self:capability { setuid setgid dac_override dac_read_search };
  53. allow $1_ssh_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
  54. allow $1_ssh_t self:fd use;
  55. allow $1_ssh_t self:fifo_file rw_fifo_file_perms;
  56. allow $1_ssh_t self:unix_dgram_socket { create_socket_perms sendto };
  57. allow $1_ssh_t self:unix_stream_socket { create_stream_socket_perms connectto };
  58. allow $1_ssh_t self:shm create_shm_perms;
  59. allow $1_ssh_t self:sem create_sem_perms;
  60. allow $1_ssh_t self:msgq create_msgq_perms;
  61. allow $1_ssh_t self:msg { send receive };
  62. allow $1_ssh_t self:tcp_socket create_stream_socket_perms;
  63. # for rsync
  64. allow $1_ssh_t $2:unix_stream_socket rw_socket_perms;
  65. allow $1_ssh_t $2:unix_stream_socket connectto;
  66. # Read the ssh key file.
  67. allow $1_ssh_t sshd_key_t:file read_file_perms;
  68. # Access the ssh temporary files.
  69. allow $1_ssh_t sshd_tmp_t:dir manage_dir_perms;
  70. allow $1_ssh_t sshd_tmp_t:file manage_file_perms;
  71. files_tmp_filetrans($1_ssh_t, sshd_tmp_t, { file dir })
  72. # Transition from the domain to the derived domain.
  73. domtrans_pattern($2, ssh_exec_t, $1_ssh_t)
  74. # inheriting stream sockets is needed for "ssh host command" as no pty
  75. # is allocated
  76. # cjp: should probably fix target to be an attribute for ssh servers
  77. # or "regular" (not special like sshd_extern_t) servers
  78. allow $2 ssh_server:unix_stream_socket rw_stream_socket_perms;
  79. # allow ps to show ssh
  80. ps_process_pattern($2, $1_ssh_t)
  81. # user can manage the keys and config
  82. manage_files_pattern($2, $1_ssh_home_t, $1_ssh_home_t)
  83. manage_lnk_files_pattern($2, $1_ssh_home_t, $1_ssh_home_t)
  84. manage_sock_files_pattern($2, $1_ssh_home_t, $1_ssh_home_t)
  85. # ssh client can manage the keys and config
  86. manage_files_pattern($1_ssh_t, $1_ssh_home_t, $1_ssh_home_t)
  87. read_lnk_files_pattern($1_ssh_t, $1_ssh_home_t, $1_ssh_home_t)
  88. # ssh servers can read the user keys and config
  89. allow ssh_server $1_ssh_home_t:dir list_dir_perms;
  90. read_files_pattern(ssh_server, $1_ssh_home_t, $1_ssh_home_t)
  91. read_lnk_files_pattern(ssh_server, $1_ssh_home_t, $1_ssh_home_t)
  92. kernel_read_kernel_sysctls($1_ssh_t)
  93. kernel_read_system_state($1_ssh_t)
  94. corenet_all_recvfrom_unlabeled($1_ssh_t)
  95. corenet_all_recvfrom_netlabel($1_ssh_t)
  96. corenet_tcp_sendrecv_generic_if($1_ssh_t)
  97. corenet_tcp_sendrecv_generic_node($1_ssh_t)
  98. corenet_tcp_sendrecv_all_ports($1_ssh_t)
  99. corenet_tcp_connect_ssh_port($1_ssh_t)
  100. corenet_sendrecv_ssh_client_packets($1_ssh_t)
  101. dev_read_urand($1_ssh_t)
  102. fs_getattr_all_fs($1_ssh_t)
  103. fs_search_auto_mountpoints($1_ssh_t)
  104. # run helper programs - needed eg for x11-ssh-askpass
  105. corecmd_exec_shell($1_ssh_t)
  106. corecmd_exec_bin($1_ssh_t)
  107. domain_use_interactive_fds($1_ssh_t)
  108. files_list_home($1_ssh_t)
  109. files_read_usr_files($1_ssh_t)
  110. files_read_etc_runtime_files($1_ssh_t)
  111. files_read_etc_files($1_ssh_t)
  112. files_read_var_files($1_ssh_t)
  113. auth_use_nsswitch($1_ssh_t)
  114. logging_send_syslog_msg($1_ssh_t)
  115. logging_read_generic_logs($1_ssh_t)
  116. miscfiles_read_localization($1_ssh_t)
  117. seutil_read_config($1_ssh_t)
  118. optional_policy(`
  119. kerberos_use($1_ssh_t)
  120. ')
  121. ')
  122. #######################################
  123. ## <summary>
  124. ## The template to define a ssh server.
  125. ## </summary>
  126. ## <desc>
  127. ## <p>
  128. ## This template creates a domains to be used for
  129. ## creating a ssh server. This is typically done
  130. ## to have multiple ssh servers of different sensitivities,
  131. ## such as for an internal network-facing ssh server, and
  132. ## a external network-facing ssh server.
  133. ## </p>
  134. ## </desc>
  135. ## <param name="userdomain_prefix">
  136. ## <summary>
  137. ## The prefix of the server domain (e.g., sshd
  138. ## is the prefix for sshd_t).
  139. ## </summary>
  140. ## </param>
  141. #
  142. template(`ssh_server_template', `
  143. type $1_t, ssh_server;
  144. auth_login_pgm_domain($1_t)
  145. type $1_devpts_t;
  146. term_login_pty($1_devpts_t)
  147. type $1_tmpfs_t;
  148. files_tmpfs_file($1_tmpfs_t)
  149. type $1_var_run_t;
  150. files_pid_file($1_var_run_t)
  151. allow $1_t self:capability { kill sys_chroot sys_nice sys_resource chown dac_override fowner fsetid setgid setuid sys_tty_config };
  152. allow $1_t self:fifo_file rw_fifo_file_perms;
  153. allow $1_t self:process { signal getsched setsched setrlimit setexec setkeycreate };
  154. allow $1_t self:tcp_socket create_stream_socket_perms;
  155. allow $1_t self:udp_socket create_socket_perms;
  156. # ssh agent connections:
  157. allow $1_t self:unix_stream_socket create_stream_socket_perms;
  158. allow $1_t self:shm create_shm_perms;
  159. allow $1_t $1_devpts_t:chr_file { rw_chr_file_perms setattr getattr relabelfrom };
  160. term_create_pty($1_t, $1_devpts_t)
  161. manage_files_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t)
  162. fs_tmpfs_filetrans($1_t, $1_tmpfs_t, file)
  163. allow $1_t $1_var_run_t:dir search_dir_perms;
  164. allow $1_t $1_var_run_t:file manage_file_perms;
  165. files_pid_filetrans($1_t, $1_var_run_t, file)
  166. can_exec($1_t, sshd_exec_t)
  167. # Access key files
  168. allow $1_t sshd_key_t:file read_file_perms;
  169. kernel_read_kernel_sysctls($1_t)
  170. kernel_read_network_state($1_t)
  171. corenet_all_recvfrom_unlabeled($1_t)
  172. corenet_all_recvfrom_netlabel($1_t)
  173. corenet_tcp_sendrecv_generic_if($1_t)
  174. corenet_udp_sendrecv_generic_if($1_t)
  175. corenet_raw_sendrecv_generic_if($1_t)
  176. corenet_tcp_sendrecv_generic_node($1_t)
  177. corenet_udp_sendrecv_generic_node($1_t)
  178. corenet_raw_sendrecv_generic_node($1_t)
  179. corenet_udp_sendrecv_all_ports($1_t)
  180. corenet_tcp_sendrecv_all_ports($1_t)
  181. corenet_tcp_bind_generic_node($1_t)
  182. corenet_udp_bind_generic_node($1_t)
  183. corenet_tcp_bind_ssh_port($1_t)
  184. corenet_tcp_connect_all_ports($1_t)
  185. corenet_sendrecv_ssh_server_packets($1_t)
  186. fs_dontaudit_getattr_all_fs($1_t)
  187. auth_rw_login_records($1_t)
  188. auth_rw_faillog($1_t)
  189. corecmd_read_bin_symlinks($1_t)
  190. corecmd_getattr_bin_files($1_t)
  191. # for sshd subsystems, such as sftp-server.
  192. corecmd_getattr_bin_files($1_t)
  193. domain_interactive_fd($1_t)
  194. files_read_etc_files($1_t)
  195. files_read_etc_runtime_files($1_t)
  196. files_read_usr_files($1_t)
  197. logging_search_logs($1_t)
  198. miscfiles_read_localization($1_t)
  199. userdom_create_all_users_keys($1_t)
  200. userdom_dontaudit_relabelfrom_user_ptys($1_t)
  201. userdom_search_user_home_dirs($1_t)
  202. # Allow checking users mail at login
  203. optional_policy(`
  204. mta_getattr_spool($1_t)
  205. ')
  206. tunable_policy(`use_nfs_home_dirs',`
  207. fs_read_nfs_files($1_t)
  208. fs_read_nfs_symlinks($1_t)
  209. ')
  210. tunable_policy(`use_samba_home_dirs',`
  211. fs_read_cifs_files($1_t)
  212. ')
  213. optional_policy(`
  214. kerberos_use($1_t)
  215. kerberos_manage_host_rcache($1_t)
  216. ')
  217. optional_policy(`
  218. files_read_var_lib_symlinks($1_t)
  219. nx_spec_domtrans_server($1_t)
  220. ')
  221. ')
  222. ########################################
  223. ## <summary>
  224. ## Role access for ssh
  225. ## </summary>
  226. ## <param name="role_prefix">
  227. ## <summary>
  228. ## The prefix of the role (e.g., user
  229. ## is the prefix for user_r).
  230. ## </summary>
  231. ## </param>
  232. ## <param name="role">
  233. ## <summary>
  234. ## Role allowed access
  235. ## </summary>
  236. ## </param>
  237. ## <param name="domain">
  238. ## <summary>
  239. ## User domain for the role
  240. ## </summary>
  241. ## </param>
  242. #
  243. template(`ssh_role_template',`
  244. gen_require(`
  245. attribute ssh_server, ssh_agent_type;
  246. type ssh_t, ssh_exec_t, ssh_tmpfs_t, ssh_home_t;
  247. type ssh_agent_exec_t, ssh_keysign_t, ssh_tmpfs_t;
  248. type ssh_agent_tmp_t;
  249. ')
  250. ##############################
  251. #
  252. # Declarations
  253. #
  254. role $2 types ssh_t;
  255. type $1_ssh_agent_t, ssh_agent_type;
  256. userdom_user_application_domain($1_ssh_agent_t, ssh_agent_exec_t)
  257. domain_interactive_fd($1_ssh_agent_t)
  258. role $2 types $1_ssh_agent_t;
  259. ##############################
  260. #
  261. # Local policy
  262. #
  263. # Transition from the domain to the derived domain.
  264. domtrans_pattern($3, ssh_exec_t, ssh_t)
  265. # inheriting stream sockets is needed for "ssh host command" as no pty
  266. # is allocated
  267. allow $3 ssh_server:unix_stream_socket rw_stream_socket_perms;
  268. # allow ps to show ssh
  269. ps_process_pattern($3, ssh_t)
  270. allow $3 ssh_t:process signal;
  271. # for rsync
  272. allow ssh_t $3:unix_stream_socket rw_socket_perms;
  273. allow ssh_t $3:unix_stream_socket connectto;
  274. # user can manage the keys and config
  275. manage_files_pattern($3, ssh_home_t, ssh_home_t)
  276. manage_lnk_files_pattern($3, ssh_home_t, ssh_home_t)
  277. manage_sock_files_pattern($3, ssh_home_t, ssh_home_t)
  278. userdom_search_user_home_dirs($1_t)
  279. ##############################
  280. #
  281. # SSH agent local policy
  282. #
  283. allow $1_ssh_agent_t self:process { setrlimit signal };
  284. allow $1_ssh_agent_t self:capability setgid;
  285. allow $1_ssh_agent_t self:fifo_file rw_file_perms;
  286. allow $1_ssh_agent_t { $1_ssh_agent_t $3 }:process signull;
  287. allow $1_ssh_agent_t self:unix_stream_socket { create_stream_socket_perms connectto };
  288. manage_dirs_pattern($1_ssh_agent_t, ssh_agent_tmp_t, ssh_agent_tmp_t)
  289. manage_sock_files_pattern($1_ssh_agent_t, ssh_agent_tmp_t, ssh_agent_tmp_t)
  290. files_tmp_filetrans($1_ssh_agent_t, ssh_agent_tmp_t, { dir sock_file })
  291. # for ssh-add
  292. stream_connect_pattern($3, ssh_agent_tmp_t, ssh_agent_tmp_t, $1_ssh_agent_t)
  293. # Allow the user shell to signal the ssh program.
  294. allow $3 $1_ssh_agent_t:process signal;
  295. # allow ps to show ssh
  296. ps_process_pattern($3, $1_ssh_agent_t)
  297. domtrans_pattern($3, ssh_agent_exec_t, $1_ssh_agent_t)
  298. userdom_append_inherited_user_home_content_files($1_ssh_agent_t)
  299. kernel_read_kernel_sysctls($1_ssh_agent_t)
  300. dev_read_urand($1_ssh_agent_t)
  301. dev_read_rand($1_ssh_agent_t)
  302. fs_search_auto_mountpoints($1_ssh_agent_t)
  303. # transition back to normal privs upon exec
  304. corecmd_shell_domtrans($1_ssh_agent_t, $3)
  305. corecmd_bin_domtrans($1_ssh_agent_t, $3)
  306. domain_use_interactive_fds($1_ssh_agent_t)
  307. files_read_etc_files($1_ssh_agent_t)
  308. files_read_etc_runtime_files($1_ssh_agent_t)
  309. files_search_home($1_ssh_agent_t)
  310. libs_read_lib_files($1_ssh_agent_t)
  311. logging_send_syslog_msg($1_ssh_agent_t)
  312. miscfiles_read_localization($1_ssh_agent_t)
  313. miscfiles_read_generic_certs($1_ssh_agent_t)
  314. seutil_dontaudit_read_config($1_ssh_agent_t)
  315. # Write to the user domain tty.
  316. userdom_use_user_terminals($1_ssh_agent_t)
  317. # for the transition back to normal privs upon exec
  318. userdom_search_user_home_content($1_ssh_agent_t)
  319. userdom_user_home_domtrans($1_ssh_agent_t, $3)
  320. allow $3 $1_ssh_agent_t:fd use;
  321. allow $3 $1_ssh_agent_t:fifo_file rw_file_perms;
  322. allow $3 $1_ssh_agent_t:process sigchld;
  323. tunable_policy(`use_nfs_home_dirs',`
  324. fs_manage_nfs_files($1_ssh_agent_t)
  325. # transition back to normal privs upon exec
  326. fs_nfs_domtrans($1_ssh_agent_t, $3)
  327. ')
  328. tunable_policy(`use_samba_home_dirs',`
  329. fs_manage_cifs_files($1_ssh_agent_t)
  330. # transition back to normal privs upon exec
  331. fs_cifs_domtrans($1_ssh_agent_t, $3)
  332. ')
  333. optional_policy(`
  334. nis_use_ypbind($1_ssh_agent_t)
  335. ')
  336. optional_policy(`
  337. tunable_policy(`ssh_use_gpg_agent',`
  338. # for ssh-add
  339. gpg_stream_connect_agent($3)
  340. ')
  341. ')
  342. optional_policy(`
  343. xserver_use_xdm_fds($1_ssh_agent_t)
  344. xserver_rw_xdm_pipes($1_ssh_agent_t)
  345. xdm_sigchld($1_ssh_agent_t)
  346. ')
  347. ')
  348. ########################################
  349. ## <summary>
  350. ## Send a SIGCHLD signal to the ssh server.
  351. ## </summary>
  352. ## <param name="domain">
  353. ## <summary>
  354. ## Domain allowed access.
  355. ## </summary>
  356. ## </param>
  357. #
  358. interface(`ssh_sigchld',`
  359. gen_require(`
  360. type sshd_t;
  361. ')
  362. allow $1 sshd_t:process sigchld;
  363. ')
  364. ########################################
  365. ## <summary>
  366. ## Send a generic signal to the ssh server.
  367. ## </summary>
  368. ## <param name="domain">
  369. ## <summary>
  370. ## Domain allowed access.
  371. ## </summary>
  372. ## </param>
  373. #
  374. interface(`ssh_signal',`
  375. gen_require(`
  376. type sshd_t;
  377. ')
  378. allow $1 sshd_t:process signal;
  379. ')
  380. ########################################
  381. ## <summary>
  382. ## Send a null signal to sshd processes.
  383. ## </summary>
  384. ## <param name="domain">
  385. ## <summary>
  386. ## Domain allowed access.
  387. ## </summary>
  388. ## </param>
  389. #
  390. interface(`ssh_signull',`
  391. gen_require(`
  392. type sshd_t;
  393. ')
  394. allow $1 sshd_t:process signull;
  395. ')
  396. ########################################
  397. ## <summary>
  398. ## Read a ssh server unnamed pipe.
  399. ## </summary>
  400. ## <param name="domain">
  401. ## <summary>
  402. ## Domain allowed access.
  403. ## </summary>
  404. ## </param>
  405. #
  406. interface(`ssh_read_pipes',`
  407. gen_require(`
  408. type sshd_t;
  409. ')
  410. allow $1 sshd_t:fifo_file { getattr read };
  411. ')
  412. ########################################
  413. ## <summary>
  414. ## Read and write a ssh server unnamed pipe.
  415. ## </summary>
  416. ## <param name="domain">
  417. ## <summary>
  418. ## Domain allowed access.
  419. ## </summary>
  420. ## </param>
  421. #
  422. interface(`ssh_rw_pipes',`
  423. gen_require(`
  424. type sshd_t;
  425. ')
  426. allow $1 sshd_t:fifo_file { write read getattr ioctl };
  427. ')
  428. ########################################
  429. ## <summary>
  430. ## Read and write ssh server unix domain stream sockets.
  431. ## </summary>
  432. ## <param name="domain">
  433. ## <summary>
  434. ## Domain allowed access.
  435. ## </summary>
  436. ## </param>
  437. #
  438. interface(`ssh_rw_stream_sockets',`
  439. gen_require(`
  440. type sshd_t;
  441. ')
  442. allow $1 sshd_t:unix_stream_socket rw_stream_socket_perms;
  443. ')
  444. ########################################
  445. ## <summary>
  446. ## Read and write ssh server TCP sockets.
  447. ## </summary>
  448. ## <param name="domain">
  449. ## <summary>
  450. ## Domain allowed access.
  451. ## </summary>
  452. ## </param>
  453. #
  454. interface(`ssh_rw_tcp_sockets',`
  455. gen_require(`
  456. type sshd_t;
  457. ')
  458. allow $1 sshd_t:tcp_socket rw_stream_socket_perms;
  459. ')
  460. ########################################
  461. ## <summary>
  462. ## Do not audit attempts to read and write
  463. ## ssh server TCP sockets.
  464. ## </summary>
  465. ## <param name="domain">
  466. ## <summary>
  467. ## Domain to not audit.
  468. ## </summary>
  469. ## </param>
  470. #
  471. interface(`ssh_dontaudit_rw_tcp_sockets',`
  472. gen_require(`
  473. type sshd_t;
  474. ')
  475. dontaudit $1 sshd_t:tcp_socket { read write };
  476. ')
  477. ########################################
  478. ## <summary>
  479. ## Connect to SSH daemons over TCP sockets. (Deprecated)
  480. ## </summary>
  481. ## <param name="domain">
  482. ## <summary>
  483. ## Domain allowed access.
  484. ## </summary>
  485. ## </param>
  486. #
  487. interface(`ssh_tcp_connect',`
  488. refpolicywarn(`$0($*) has been deprecated.')
  489. ')
  490. ########################################
  491. ## <summary>
  492. ## Execute the ssh daemon sshd domain.
  493. ## </summary>
  494. ## <param name="domain">
  495. ## <summary>
  496. ## Domain allowed to transition.
  497. ## </summary>
  498. ## </param>
  499. #
  500. interface(`ssh_domtrans',`
  501. gen_require(`
  502. type sshd_t, sshd_exec_t;
  503. ')
  504. domtrans_pattern($1, sshd_exec_t, sshd_t)
  505. ')
  506. ########################################
  507. ## <summary>
  508. ## Execute the ssh client in the caller domain.
  509. ## </summary>
  510. ## <param name="domain">
  511. ## <summary>
  512. ## Domain allowed access.
  513. ## </summary>
  514. ## </param>
  515. #
  516. interface(`ssh_exec',`
  517. gen_require(`
  518. type ssh_exec_t;
  519. ')
  520. corecmd_search_bin($1)
  521. can_exec($1, ssh_exec_t)
  522. ')
  523. ########################################
  524. ## <summary>
  525. ## Set the attributes of sshd key files.
  526. ## </summary>
  527. ## <param name="domain">
  528. ## <summary>
  529. ## Domain allowed access.
  530. ## </summary>
  531. ## </param>
  532. #
  533. interface(`ssh_setattr_key_files',`
  534. gen_require(`
  535. type sshd_key_t;
  536. ')
  537. allow $1 sshd_key_t:file setattr;
  538. files_search_pids($1)
  539. ')
  540. ########################################
  541. ## <summary>
  542. ## Execute the ssh agent client in the caller domain.
  543. ## </summary>
  544. ## <param name="domain">
  545. ## <summary>
  546. ## Domain allowed access.
  547. ## </summary>
  548. ## </param>
  549. #
  550. interface(`ssh_agent_exec',`
  551. gen_require(`
  552. type ssh_agent_exec_t;
  553. ')
  554. corecmd_search_bin($1)
  555. can_exec($1, ssh_agent_exec_t)
  556. ')
  557. ########################################
  558. ## <summary>
  559. ## Read ssh home directory content
  560. ## </summary>
  561. ## <param name="domain">
  562. ## <summary>
  563. ## Domain allowed access.
  564. ## </summary>
  565. ## </param>
  566. #
  567. interface(`ssh_read_user_home_files',`
  568. gen_require(`
  569. type ssh_home_t;
  570. ')
  571. allow $1 ssh_home_t:dir list_dir_perms;
  572. read_files_pattern($1, ssh_home_t, ssh_home_t)
  573. read_lnk_files_pattern($1, ssh_home_t, ssh_home_t)
  574. userdom_search_user_home_dirs($1)
  575. ')
  576. ########################################
  577. ## <summary>
  578. ## Execute the ssh key generator in the ssh keygen domain.
  579. ## </summary>
  580. ## <param name="domain">
  581. ## <summary>
  582. ## Domain allowed to transition.
  583. ## </summary>
  584. ## </param>
  585. #
  586. interface(`ssh_domtrans_keygen',`
  587. gen_require(`
  588. type ssh_keygen_t, ssh_keygen_exec_t;
  589. ')
  590. domtrans_pattern($1, ssh_keygen_exec_t, ssh_keygen_t)
  591. ')
  592. ########################################
  593. ## <summary>
  594. ## Read ssh server keys
  595. ## </summary>
  596. ## <param name="domain">
  597. ## <summary>
  598. ## Domain to not audit.
  599. ## </summary>
  600. ## </param>
  601. #
  602. interface(`ssh_dontaudit_read_server_keys',`
  603. gen_require(`
  604. type sshd_key_t;
  605. ')
  606. dontaudit $1 sshd_key_t:file { getattr read };
  607. ')
  608. ######################################
  609. ## <summary>
  610. ## Manage ssh home directory content
  611. ## </summary>
  612. ## <param name="domain">
  613. ## <summary>
  614. ## Domain allowed access.
  615. ## </summary>
  616. ## </param>
  617. #
  618. interface(`ssh_manage_home_files',`
  619. gen_require(`
  620. type ssh_home_t;
  621. ')
  622. manage_files_pattern($1, ssh_home_t, ssh_home_t)
  623. userdom_search_user_home_dirs($1)
  624. ')
  625. #######################################
  626. ## <summary>
  627. ## Delete from the ssh temp files.
  628. ## </summary>
  629. ## <param name="domain">
  630. ## <summary>
  631. ## Domain allowed access.
  632. ## </summary>
  633. ## </param>
  634. #
  635. interface(`ssh_delete_tmp',`
  636. gen_require(`
  637. type sshd_tmp_t;
  638. ')
  639. files_search_tmp($1)
  640. delete_files_pattern($1, sshd_tmp_t, sshd_tmp_t)
  641. ')