public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: Laine Stump <laine@redhat.com>
Subject: [PATCH 2/6] selinux: Define interfaces for libvirt and similar frameworks
Date: Tue, 21 Feb 2023 19:39:11 +0100	[thread overview]
Message-ID: <20230221183915.3740123-3-sbrivio@redhat.com> (raw)
In-Reply-To: <20230221183915.3740123-1-sbrivio@redhat.com>

Services running passt will commonly need to transition to its
domain, terminate it, connect and write to its socket.

The init_daemon_domain() macro now defines the default transition to
the passt_t domain, using the passt_exec_t type.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 contrib/selinux/passt.if | 26 ++++++++++++++++++++++++++
 contrib/selinux/passt.te |  1 +
 2 files changed, 27 insertions(+)

diff --git a/contrib/selinux/passt.if b/contrib/selinux/passt.if
index f689a99..893395b 100644
--- a/contrib/selinux/passt.if
+++ b/contrib/selinux/passt.if
@@ -15,3 +15,29 @@ interface(`passt_read_data',`
 	allow $1 passt_t:dir { search add_name };
 	allow $1 passt_t:file { open read getattr };
 ')
+
+interface(`passt_domtrans',`
+	gen_require(`
+		type passt_t, passt_exec_t;
+	')
+
+	corecmd_search_bin($1)
+	domtrans_pattern($1, passt_exec_t, passt_t)
+')
+
+interface(`passt_socket',`
+	gen_require(`
+		type passt_t;
+	')
+
+	allow $1 user_tmp_t:sock_file write;
+	allow $1 passt_t:unix_stream_socket connectto;
+')
+
+interface(`passt_kill',`
+	gen_require(`
+		type passt_t;
+	')
+
+	allow $1 passt_t:process { signal sigkill };
+')
diff --git a/contrib/selinux/passt.te b/contrib/selinux/passt.te
index b38304b..1f45fcd 100644
--- a/contrib/selinux/passt.te
+++ b/contrib/selinux/passt.te
@@ -56,6 +56,7 @@ type passt_t;
 domain_type(passt_t);
 type passt_exec_t;
 files_type(passt_exec_t);
+init_daemon_domain(passt_t, passt_exec_t)
 type passt_log_t;
 logging_log_file(passt_log_t);
 type passt_pid_t;
-- 
@@ -56,6 +56,7 @@ type passt_t;
 domain_type(passt_t);
 type passt_exec_t;
 files_type(passt_exec_t);
+init_daemon_domain(passt_t, passt_exec_t)
 type passt_log_t;
 logging_log_file(passt_log_t);
 type passt_pid_t;
-- 
2.39.1


  parent reply	other threads:[~2023-02-21 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 18:39 [PATCH 0/6] selinux: Assorted fixes, libvirt support Stefano Brivio
2023-02-21 18:39 ` [PATCH 1/6] selinux/passt.if: Fix typo in passt_read_data interface definition Stefano Brivio
2023-02-21 18:39 ` Stefano Brivio [this message]
2023-02-21 18:39 ` [PATCH 3/6] selinux: Switch to a more reasonable model for PID and socket files Stefano Brivio
2023-02-21 18:39 ` [PATCH 4/6] selinux/passt.te: Allow setcap on the process itself Stefano Brivio
2023-02-21 18:39 ` [PATCH 5/6] selinux/passt.te: Allow /etc/resolv.conf symlinks to be followed Stefano Brivio
2023-02-21 18:39 ` [PATCH 6/6] selinux/passt.te: Allow setting socket option on routing netlink socket Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230221183915.3740123-3-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=laine@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).