public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Andrea Bolognani <abologna@redhat.com>
Cc: Prafulla Giri <prafulla.giri@protonmail.com>,
	"passt-dev@passt.top" <passt-dev@passt.top>
Subject: Re: Apparmor (and other) Issues
Date: Tue, 4 Feb 2025 23:34:41 +0100	[thread overview]
Message-ID: <20250204233441.6cda8c64@elisabeth> (raw)
In-Reply-To: <CABJz62PU05v7PEasddd_nevEkNeugJ1qYsu0Xj000parQqtm4g@mail.gmail.com>

On Tue, 4 Feb 2025 14:19:34 -0800
Andrea Bolognani <abologna@redhat.com> wrote:

> On Tue, Feb 04, 2025 at 08:14:48PM +0100, Stefano Brivio wrote:
> > On Tue, 4 Feb 2025 18:46:37 +0000 Andrea Bolognani <abologna@redhat.com> wrote:  
> > > > 2. (most reasonable I think) don't use per-VM profiles for the rootless
> > > >    case. Define a single "libvirt-user" (or "libvirt-session") profile
> > > >    and use that. We could copy it from the existing ones I suppose.  
> > >
> > > Sounds to me like this would require granting the QEMU process access
> > > to roughly the entire filesystem? The disk image could live anywhere
> > > after all, and if we can't dynamically add a rule for the exact path
> > > the only way out is a free-for-all approach.  
> >
> > Right. That's what we did for libguestfs as well, the image can be
> > *almost* anywhere. But it's not free-for-all: you're just granting
> > *limited* filesystem access (not to sysfs, not to /etc, and so on).
> >
> > And I had to build a *very* loose profile for libguestfs because that
> > applies to root as well, but for rootless libvirtd, it might even make
> > sense to restrict access to just @{HOME}/** and /tmp/** (that's what I
> > did for stand-alone passt, for example).  
> 
> That could work, I suppose. Needs to be discussed upstream, making
> sure to involve those who are more experienced with AppArmor than I
> am

Sure, that makes sense of course.

> especially since it's not just a matter of updating the policy
> but fundamentally changing how the driver works when operating in
> unprivileged mode.

Well, right now it runs unconfined, and (at least with passt) networking
doesn't work. Pretty much any change would be good. :)

I've been disabling AppArmor when I start guests for quite a while now,
thinking that I just broke something on my setup while developing
stuff (I reported that to you but I wasn't sure how the whole thing
worked...). Oops.

> > I'll try to submit a pull request at least for Debian in a couple of
> > days.  
> 
> Be aware that I will emphatically refuse to introduce changes to the
> Debian package unless they have been merged upstream first. AppArmor
> support lives in the upstream repository, and all fixes and
> improvements have to go through it.

Then never mind. I can help filing a Debian issue if needed, let me
know. Or let me know how I can help otherwise.

I would consider a workaround for passt for the moment, say, the whole
block:

    /usr/bin/passt r,

    signal (receive) set=("term") peer=/usr/sbin/libvirtd,
    signal (receive) set=("term") peer=libvirtd,
    signal (receive) set=("term") peer=virtqemud,

    owner @{run}/user/[0-9]*/libvirt/qemu/run/passt/* rw,
    owner @{run}/libvirt/qemu/passt/* rw,

as part of the profile for usr.bin.passt. If you don't see issues with
it, I'll go ahead with that. I still need to check openSUSE though (I
haven't tried for a while there).

-- 
Stefano


  reply	other threads:[~2025-02-04 22:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <gfnJ5_aKhxXif2AlacEZIAO3UgiyKhgfDhlg7-FWBbkXttL891Y9k0zClSeYZiLN8JkMF9Z_pprz9f3w88cjZTkHL42cjar9boCCIuS6B08=@protonmail.com>
2025-01-29  9:41 ` Apparmor (and other) Issues Stefano Brivio
2025-01-29 18:10   ` Prafulla Giri
2025-01-29 18:48     ` Stefano Brivio
2025-01-30 10:05       ` Prafulla Giri
2025-01-31 20:20         ` Stefano Brivio
     [not found]           ` <NNMPy6qrSrpU0VFxOsd8tUnJFDsz_Ychl7WAxOB1aYfyRCjzTG4uzNEGZLkHUa_NnxCEAL_X1lhnySdZ_1i2ZMxuVK0zDHa-YLex3O5fhRw=@protonmail.com>
2025-02-02 14:40             ` Prafulla Giri
2025-02-03  8:35             ` Stefano Brivio
     [not found]               ` <0gHPSAbajW7n2zyIE-8k2vez7nkpAHQOnP4p6yfc6i5v948AExss0zBAYKF-92Yqf90DhAg3Xx9u19aw4TtSQLnpNgvCEa--wkPTL0PDdnM=@protonmail.com>
2025-02-04  8:50                 ` Stefano Brivio
2025-02-04  9:50                   ` Andrea Bolognani
2025-02-04 10:17                     ` Stefano Brivio
2025-02-04 15:50                       ` Andrea Bolognani
2025-02-04 16:22                         ` Stefano Brivio
2025-02-04 18:46                           ` Andrea Bolognani
2025-02-04 19:14                             ` Stefano Brivio
2025-02-04 22:19                               ` Andrea Bolognani
2025-02-04 22:34                                 ` Stefano Brivio [this message]
2025-02-05  7:40                                   ` Prafulla Giri
2025-02-05 10:16                                     ` Stefano Brivio
2025-02-07  6:49                                       ` Prafulla Giri
2025-02-07  9:16                                         ` 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=20250204233441.6cda8c64@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=abologna@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=prafulla.giri@protonmail.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).