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: Paul Holzinger <pholzing@redhat.com>
Subject: [PATCH] selinux: Access to netns for podman-build, read access for netns in general
Date: Fri, 10 Jul 2026 23:30:02 +0200	[thread overview]
Message-ID: <20260710213002.3176510-1-sbrivio@redhat.com> (raw)

A few additional rules are needed when pasta is started by Podman in
particular cases:

- with podman-build or Buildah, pasta needs to access the target
  namespace reference using a procfs namespace link entry, instead of
  the usual directory under /run or /var/run. For that, we have a
  rule enabling access to container_t:lnk_file.

  On some systems, though, the class is 'dir' instead of 'lnk_file'.
  I don't have a concrete way to reproduce this or a full explanation,
  but in any case, an additional rule for that is obviously harmless:
  allow pasta_t to open, read, and search a container_t:dir

- with custom networks, pasta needs to write PID files to a location
  indicated by Podman. If the PID file already exists, the existing
  permissions aren't sufficient: we also need a 'read' rule. Add that,
  for 'dir' and 'file' objects labeled as either container_var_run_t
  or ifconfig_var_run_t (this depends on the installed Podman and
  container-selinux versions)

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 contrib/selinux/pasta.te | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/contrib/selinux/pasta.te b/contrib/selinux/pasta.te
index ff74dd7..9394f97 100644
--- a/contrib/selinux/pasta.te
+++ b/contrib/selinux/pasta.te
@@ -175,6 +175,7 @@ allow pasta_t container_runtime_t:fifo_file { getattr write };
 allow pasta_t container_runtime_t:file read;
 allow pasta_t container_runtime_t:lnk_file read;
 allow pasta_t container_t:lnk_file read;
+allow pasta_t container_t:dir { open read search };
 allow pasta_t pasta_port_t:tcp_socket { name_bind name_connect };
 allow pasta_t pasta_port_t:udp_socket { name_bind };
 allow pasta_t http_port_t:tcp_socket { name_bind name_connect };
@@ -249,10 +250,10 @@ type_transition container_runtime_t user_tmp_t : dir ifconfig_var_run_t "netns";
 type_transition container_runtime_t container_var_run_t : dir ifconfig_var_run_t "netns";
 type_transition container_runtime_t user_tmp_t : dir ifconfig_var_run_t "rootless-netns";
 type_transition container_runtime_t container_var_run_t : dir ifconfig_var_run_t "rootless-netns";
-allow pasta_t container_var_run_t:dir { add_name open rmdir write };
-allow pasta_t ifconfig_var_run_t:dir { add_name open rmdir write };
-allow pasta_t container_var_run_t:file { create open write };
-allow pasta_t ifconfig_var_run_t:file { create open write };
+allow pasta_t container_var_run_t:dir { add_name open read rmdir write };
+allow pasta_t ifconfig_var_run_t:dir { add_name open read rmdir write };
+allow pasta_t container_var_run_t:file { create open read write };
+allow pasta_t ifconfig_var_run_t:file { create open read write };
 allow pasta_t container_var_run_t:sock_file { getattr create open read write };
 allow pasta_t ifconfig_var_run_t:sock_file { getattr create open read write };
 allow systemd_user_runtimedir_t ifconfig_var_run_t:dir rmdir;
-- 
2.43.0


                 reply	other threads:[~2026-07-10 21:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260710213002.3176510-1-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=pholzing@redhat.com \
    /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).