Skip to content

Commit

Permalink
SELinux policies for xendriverdomain.service
Browse files Browse the repository at this point in the history
Another step towards making Qubes OS work with SELinux enforcing.
  • Loading branch information
DemiMarie committed Dec 23, 2022
1 parent 8c712b9 commit f955f2f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ all:
$(MAKE) -C qubes-rpc
ifdef WITH_SELINUX
ifeq ($(WITH_SELINUX),1)
$(MAKE) -C selinux -f /usr/share/selinux/devel/Makefile qubes-qfile-unpacker.pp
$(MAKE) -C selinux -f /usr/share/selinux/devel/Makefile qubes-qfile-unpacker.pp qubes-xendriverdomain.pp

install-rh: install-selinux

install-selinux:
install -D -m 0644 -t $(DESTDIR)/usr/share/selinux/packages/targeted -- \
selinux/qubes-qfile-unpacker.pp
selinux/qubes-qfile-unpacker.pp selinux/qubes-xendriverdomain.pp
.PHONY: install-selinux
else ifneq ($(WITH_SELINUX),0)
$(error bad value for WITH_SELINUX)
Expand Down
3 changes: 2 additions & 1 deletion rpm_spec/core-agent.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ a VM with SELinux enforcing, as is the default on Red Hat-family distributions.

%files selinux
%_datadir/selinux/packages/targeted/qubes-qfile-unpacker.pp
%_datadir/selinux/packages/targeted/qubes-xendriverdomain.pp

%endif

Expand Down Expand Up @@ -614,7 +615,7 @@ fi
%if %{with selinux}
%post selinux

%selinux_modules_install %{_datadir}/selinux/packages/targeted/qubes-qfile-unpacker.pp
%selinux_modules_install %{_datadir}/selinux/packages/targeted/qubes-qfile-unpacker.pp %{_datadir}/selinux/packages/targeted/qubes-xendriverdomain.pp

contexts='### QUBES START ###\
/rw/home /home\
Expand Down
1 change: 1 addition & 0 deletions selinux/qubes-xendriverdomain.fc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Intentionally left blank
13 changes: 13 additions & 0 deletions selinux/qubes-xendriverdomain.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
policy_module(``qubes-xendriverdomain'', ``0.0.1'')

require {
type NetworkManager_t, initrc_t, virsh_exec_t, xend_t;
class dbus send_msg;
class file { entrypoint exec_file_perms };
}

allow xend_t virsh_exec_t:file { entrypoint exec_file_perms };
iptables_domtrans(xend_t)
dbus_system_bus_client(xend_t)
init_domtrans_script(xend_t)
allow xend_t NetworkManager_t:dbus send_msg;
1 change: 1 addition & 0 deletions vm-systemd/xendriverdomain.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ConditionVirtualization=xen
[Service]
Type=forking
ExecStart=/usr/sbin/xl devd
SELinuxContext=system_u:system_r:xend_t:s0-s0:c0.c1023

[Install]
WantedBy=multi-user.target

0 comments on commit f955f2f

Please sign in to comment.