|
| 1 | +policy_module(sway) |
| 2 | + |
| 3 | +######################################## |
| 4 | +# |
| 5 | +# Declarations |
| 6 | +# |
| 7 | + |
| 8 | +type sway_t; |
| 9 | +type sway_exec_t; |
| 10 | +userdom_user_application_domain(sway_t, sway_exec_t) |
| 11 | +wayland_compositor_domain(sway_t) |
| 12 | + |
| 13 | +type sway_tmpfs_t; |
| 14 | +userdom_user_tmpfs_file(sway_tmpfs_t) |
| 15 | +wayland_compositor_tmpfs(sway_tmpfs_t) |
| 16 | + |
| 17 | +type sway_etc_t; |
| 18 | +files_config_file(sway_etc_t) |
| 19 | + |
| 20 | +type sway_xdg_config_t; |
| 21 | +xdg_config_content(sway_xdg_config_t) |
| 22 | + |
| 23 | +type sway_runtime_t; |
| 24 | +files_runtime_file(sway_runtime_t) |
| 25 | + |
| 26 | +######################################## |
| 27 | +# |
| 28 | +# Local policy |
| 29 | +# |
| 30 | + |
| 31 | +# https://github.com/swaywm/sway/blob/master/sway/realtime.c |
| 32 | +allow sway_t self:process { getsched setsched }; |
| 33 | + |
| 34 | +read_files_pattern(sway_t, sway_etc_t, sway_etc_t) |
| 35 | + |
| 36 | +# No transition or creation: sway only ever reads the config. |
| 37 | +read_files_pattern(sway_t, sway_xdg_config_t, sway_xdg_config_t) |
| 38 | + |
| 39 | +manage_sock_files_pattern(sway_t, sway_runtime_t, sway_runtime_t) |
| 40 | +# sway-ipc: Wayland display socket is handled by the implied transitions in |
| 41 | +# wayland_compositor_domain(). |
| 42 | +files_runtime_filetrans(sway_t, sway_runtime_t, sock_file) |
| 43 | + |
| 44 | +manage_files_pattern(sway_t, sway_tmpfs_t, sway_tmpfs_t) |
| 45 | +allow sway_t sway_tmpfs_t:file map; |
| 46 | +fs_tmpfs_filetrans(sway_t, sway_tmpfs_t, file) |
| 47 | + |
| 48 | +# os-release/lsb-release information, /etc/fonts/fonts.conf |
| 49 | +files_read_etc_files(sway_t) |
| 50 | + |
| 51 | +# pixmaps and icons for xcursor. |
| 52 | +files_read_usr_files(sway_t) |
| 53 | + |
| 54 | +# /dev/udmabuf allocator. |
| 55 | +dev_rw_dma_dev(sway_t) |
| 56 | + |
| 57 | +# XXX: mesa tries to read boot_vga when using i915, and also attempts to read |
| 58 | +# the various cpu_capacity sysfiles - should this be moved into the wayland |
| 59 | +# modules? |
| 60 | +dev_read_sysfs(sway_t) |
| 61 | + |
| 62 | +# XXX: /proc/meminfo, seems to be mesa related - should this be moved into the |
| 63 | +# wayland module? |
| 64 | +kernel_read_system_state(sway_t) |
| 65 | + |
| 66 | +# No need for corecmd_bin_domtrans(), sway executes everything with /bin/sh: |
| 67 | +# https://github.com/swaywm/sway/blob/055be4ec35eec4eaaf066a18ccbf5132ebed0694/sway/commands/exec_always.c#L64 |
| 68 | +# Other things that are executed (e.g. swaybar, swaybg, and swaynag) are done |
| 69 | +# so specially by sway, and require specific policy. Those modules should add |
| 70 | +# domain transitions as needed instead. |
| 71 | +# TODO: this should be in the sway_role/sway_role_template interface such that |
| 72 | +# it can be called with the userdomain. |
| 73 | +# corecmd_shell_domtrans(sway_t) |
0 commit comments