Skip to content

Commit 55254f3

Browse files
authored
Merge pull request #146 from vmojzis/udica_templates
Add udica policy templates
2 parents aebd24d + 6190140 commit 55254f3

10 files changed

+201
-0
lines changed

contrib/container-selinux.spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ install -d %{buildroot}%{_datadir}/selinux/packages
7878
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/services
7979
install -p -m 644 container.if %{buildroot}%{_datadir}/selinux/devel/include/services
8080
install -m 0644 $MODULES %{buildroot}%{_datadir}/selinux/packages
81+
install -d %{buildroot}%{_datadir}/udica/templates
82+
install -m 0644 udica-templates/*.cil %{buildroot}%{_datadir}/udica/templates
8183

8284
# remove spec file
8385
rm -rf container-selinux.spec
@@ -112,6 +114,7 @@ fi
112114
%files
113115
%doc README.md
114116
%{_datadir}/selinux/*
117+
%{_datadir}/udica/templates/*
115118

116119
%changelog
117120
* Fri Jan 06 2017 Dan Walsh <[email protected]> - 2:2.1-1

udica-templates/base_container.cil

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(block container
2+
(type process)
3+
(type socket)
4+
(roletype system_r process)
5+
(typeattributeset domain (process ))
6+
(typeattributeset container_domain (process ))
7+
(typeattributeset svirt_sandbox_domain (process ))
8+
(typeattributeset mcs_constrained_type (process ))
9+
(typeattributeset file_type (socket ))
10+
(allow process socket (sock_file (create open getattr setattr read write rename link unlink ioctl lock append)))
11+
(allow process proc_type (file (getattr open read)))
12+
(allow process cpu_online_t (file (getattr open read)))
13+
(allow container_runtime_t process (key (create link read search setattr view write)))
14+
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(block config_container
2+
(optional config_container_optional
3+
(allow process configfile (dir (ioctl read getattr lock search open)))
4+
(allow process configfile (file (ioctl read getattr lock open)))
5+
(allow process configfile (lnk_file (read getattr)))
6+
)
7+
)
8+
9+
(block config_rw_container
10+
(blockinherit config_container)
11+
(optional config_rw_container_optional
12+
(allow process configfile (dir (ioctl read write getattr lock append open)))
13+
(allow process configfile (file (ioctl read write getattr lock append open)))
14+
(allow process configfile (lnk_file (ioctl read write getattr lock append open)))
15+
)
16+
)
17+
18+
(block config_manage_container
19+
(optional config_manage_container_optional
20+
(allow process configfile (dir (ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open)))
21+
(allow process configfile (file (ioctl read write create getattr setattr lock append unlink link rename open)))
22+
(allow process configfile (lnk_file (ioctl read write create getattr setattr lock append unlink link rename open)))
23+
)
24+
)

udica-templates/home_container.cil

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
(block home_container
2+
(optional home_container_optional
3+
(allow process process (capability (dac_override )))
4+
5+
(allow process user_home_dir_t (dir (getattr search open read lock ioctl)))
6+
(allow process home_root_t (dir (getattr search open read lock ioctl)))
7+
(allow process user_home_t (dir (getattr search open read lock ioctl)))
8+
9+
(allow process user_home_dir_t (file (getattr ioctl lock open read)))
10+
(allow process user_home_t (file (getattr ioctl lock open read)))
11+
)
12+
)
13+
14+
15+
(block home_rw_container
16+
(blockinherit home_container)
17+
(optional home_rw_container_optional
18+
(allow process user_home_dir_t (dir (open getattr setattr read write link search add_name remove_name reparent lock ioctl)))
19+
(allow process home_root_t (dir (open getattr setattr read write link search add_name remove_name reparent lock ioctl)))
20+
(allow process user_home_t (dir (open getattr setattr read write link search add_name remove_name reparent lock ioctl)))
21+
22+
(allow process user_home_t (file (open getattr read write append ioctl lock)))
23+
(allow process user_home_dir_t (file (open getattr read write append ioctl lock)))
24+
)
25+
)
26+
27+
(block home_manage_container
28+
(blockinherit home_rw_container)
29+
(optional home_manage_container_optional
30+
(allow process user_home_dir_t (dir (create unlink rename rmdir )))
31+
(allow process home_root_t (dir (create unlink rename rmdir )))
32+
(allow process user_home_t (dir (create unlink rename rmdir )))
33+
34+
(allow process user_home_t (file (create rename link unlink )))
35+
(allow process user_home_dir_t (file (create rename link unlink )))
36+
)
37+
)

udica-templates/log_container.cil

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(block log_container
2+
(optional log_container_optional
3+
(allow process var_t (dir (getattr search open)))
4+
(allow process logfile (dir (ioctl read getattr lock search open)))
5+
(allow process logfile (file (ioctl read getattr lock open map)))
6+
(allow process auditd_log_t (dir (ioctl read getattr lock search open)))
7+
(allow process auditd_log_t (file (ioctl read getattr lock open)))
8+
)
9+
)
10+
11+
12+
(block log_rw_container
13+
(blockinherit log_container)
14+
15+
(optional log_rw_container_optional
16+
(allow process logfile (dir (ioctl read write create getattr setattr lock add_name search open)))
17+
(allow process logfile (file (ioctl read write create getattr setattr lock append open)))
18+
(allow process logfile (lnk_file (ioctl read write getattr lock append open)))
19+
(allow process var_t (dir (getattr search open)))
20+
(allow process auditd_log_t (dir (ioctl read getattr lock search open)))
21+
(allow process auditd_log_t (file (ioctl read getattr lock open)))
22+
)
23+
)
24+
25+
(block log_manage_container
26+
(blockinherit log_rw_container)
27+
28+
(optional log_manage_container_optional
29+
(allow process logfile (dir (ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open)))
30+
(allow process logfile (file (ioctl read write create getattr setattr lock append unlink link rename open)))
31+
(allow process logfile (lnk_file (ioctl read write create getattr setattr lock append unlink link rename)))
32+
(allow process auditd_log_t (dir (ioctl read write getattr lock search open)))
33+
(allow process auditd_log_t (file (ioctl read write getattr lock open)))
34+
)
35+
)

udica-templates/net_container.cil

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(block net_container
2+
(optional net_container_optional
3+
(typeattributeset sandbox_net_domain (process))
4+
)
5+
)
6+
7+
(block restricted_net_container
8+
(optional restricted_net_container_optional
9+
(allow process process (tcp_socket (ioctl read getattr lock write setattr append bind connect getopt setopt shutdown create listen accept)))
10+
(allow process process (udp_socket (ioctl read getattr lock write setattr append bind connect getopt setopt shutdown create)))
11+
(allow process process (sctp_socket (ioctl read getattr lock write setattr append bind connect getopt setopt shutdown create)))
12+
13+
(allow process proc_t (lnk_file (read)))
14+
15+
(allow process node_t (node (tcp_recv tcp_send recvfrom sendto)))
16+
(allow process node_t (node (udp_recv recvfrom)))
17+
(allow process node_t (node (udp_send sendto)))
18+
19+
(allow process node_t (udp_socket (node_bind)))
20+
(allow process node_t (tcp_socket (node_bind)))
21+
22+
(allow process http_port_t (tcp_socket (name_connect)))
23+
(allow process http_port_t (tcp_socket (recv_msg send_msg)))
24+
)
25+
)

udica-templates/tmp_container.cil

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(block tmp_container
2+
(optional tmp_container_optional
3+
(allow process tmpfile (dir (getattr search open)))
4+
(allow process tmpfile (file (ioctl read getattr lock open)))
5+
)
6+
)
7+
8+
(block tmp_rw_container
9+
(blockinherit tmp_container)
10+
11+
(optional tmp_rw_container_optional
12+
(allow process tmpfile (file (ioctl read write getattr lock append open)))
13+
(allow process tmpfile (dir (ioctl read write getattr lock append open)))
14+
)
15+
)

udica-templates/tty_container.cil

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(block tty_container
2+
(optional tty_container_optional
3+
(allow process device_t (dir (getattr search open)))
4+
(allow process device_t (dir (ioctl read getattr lock search open)))
5+
(allow process device_t (lnk_file (read getattr)))
6+
7+
(allow process devtty_t (chr_file (ioctl read write getattr lock append open)))
8+
)
9+
)

udica-templates/virt_container.cil

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(block virt_container
2+
(optional virt_container_optional
3+
(allow process var_t (dir (getattr search open)))
4+
(allow process var_t (lnk_file (read getattr)))
5+
6+
(allow process var_run_t (dir (getattr search open)))
7+
(allow process var_run_t (lnk_file (read getattr)))
8+
9+
(allow process virt_var_run_t (dir (getattr search open)))
10+
(allow process virt_var_run_t (sock_file (write getattr append open)))
11+
12+
(allow process virtd_t (unix_stream_socket (connectto)))
13+
)
14+
)

udica-templates/x_container.cil

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(block x_container
2+
(optional x_container_optional
3+
(allow xserver_t process (shm (getattr read write associate unix_read unix_write lock)))
4+
5+
(allow process xserver_t (unix_stream_socket (connectto)))
6+
7+
(allow process device_t (dir (getattr search open)))
8+
9+
(allow process dri_device_t (chr_file (ioctl read write getattr lock append open map)))
10+
11+
(allow process xserver_misc_device_t (chr_file (ioctl read write getattr lock append open map)))
12+
13+
(allow process urandom_device_t (chr_file (open read)))
14+
15+
(allow process tmpfs_t (dir (getattr search open)))
16+
17+
(allow process tmp_t (dir (getattr search open)))
18+
(allow process tmp_t (lnk_file (read getattr)))
19+
20+
(allow process xserver_tmp_t (dir (getattr search open)))
21+
(allow process xserver_tmp_t (sock_file (write getattr append open)))
22+
23+
(allow process xserver_exec_t (file (ioctl read getattr lock map execute execute_no_trans open)))
24+
)
25+
)

0 commit comments

Comments
 (0)