From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <s.ivanov@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id B49C565268
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 14:15:32 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id AB56E2066D
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 14:15:32 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id E31002065E
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 14:15:30 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id A6CCB431A8
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 14:15:30 +0200 (CEST)
Date: Wed, 22 Jul 2020 14:15:26 +0200
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Message-ID: <20200722141526.44fcc27e@rosa.proxmox.com>
In-Reply-To: <b578da18-2964-5a75-3b05-5c16bfef3982@proxmox.com>
References: <20200722110505.8210-1-s.ivanov@proxmox.com>
 <20200722110505.8210-3-s.ivanov@proxmox.com>
 <10fc8465-d599-ce50-4273-60610e5e8b57@proxmox.com>
 <20200722135949.0db62e1e@rosa.proxmox.com>
 <b578da18-2964-5a75-3b05-5c16bfef3982@proxmox.com>
X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [start-container.in]
Subject: Re: [pve-devel] [PATCH lxc 2/2] apparmor: add rule for allowing
 remount of boot_id
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 22 Jul 2020 12:15:32 -0000

On Wed, 22 Jul 2020 14:09:09 +0200
Thomas Lamprecht <t.lamprecht@proxmox.com> wrote:

> On 22.07.20 13:59, Stoiko Ivanov wrote:
> > On Wed, 22 Jul 2020 13:51:19 +0200
> > Thomas Lamprecht <t.lamprecht@proxmox.com> wrote:
> >   
> >> On 22.07.20 13:05, Stoiko Ivanov wrote:  
> >>> commit 863845075d3f77d27c91bd9f47d2f8ddc4867bd5 in upstream only partially
> >>> fixes the apparmor deny for mounting boot_id (used for example for identifying
> >>> different boots with `journalctl`) inside the container.
> >>>
> >>> Tested by editing the profile and replacing it disregarding the cache:
> >>> `apparmor_parser -W -T -r /etc/apparmor.d/usr.bin.lxc-start`
> >>>     
> >>
> >> was this proposed to upstream as pull request? Did not found it on the
> >> LXC GitHub page.  
> > 
> > sorry my phrasing in the cover-letter was misleading: I want to make a
> > pull request upstream for this patch, after somebody else sanity-checks it  
> > -> if it looks ok to you - I'll open the PR.  
> >   
> 
> Haha, and I wanted the reverse: get upstream to review it with their
> in-depth knowledge so that I can rely on that check ;-P
aye - makes sense - https://github.com/lxc/lxc/pull/3495 :)

> 
> >   
> >>  
> >>> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> >>> ---
> >>>  ...apparmor-Allow-ro-remount-of-boot_id.patch | 26 +++++++++++++++++++
> >>>  debian/patches/series                         |  1 +
> >>>  2 files changed, 27 insertions(+)
> >>>  create mode 100644 debian/patches/pve/0004-apparmor-Allow-ro-remount-of-boot_id.patch
> >>>
> >>> diff --git a/debian/patches/pve/0004-apparmor-Allow-ro-remount-of-boot_id.patch b/debian/patches/pve/0004-apparmor-Allow-ro-remount-of-boot_id.patch
> >>> new file mode 100644
> >>> index 0000000..fefc586
> >>> --- /dev/null
> >>> +++ b/debian/patches/pve/0004-apparmor-Allow-ro-remount-of-boot_id.patch
> >>> @@ -0,0 +1,26 @@
> >>> +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
> >>> +From: Stoiko Ivanov <s.ivanov@proxmox.com>
> >>> +Date: Wed, 22 Jul 2020 12:17:24 +0200
> >>> +Subject: [PATCH lxc] apparmor: Allow ro remount of boot_id
> >>> +
> >>> +The rule added in 863845075d3f77d27c91bd9f47d2f8ddc4867bd5 did not cover all
> >>> +necessary mount calls for /proc/sys/kernel/random/boot_id
> >>> +(in src/lxc/conf.c: lxc_setup_boot_id) - the ro remount is missing.
> >>> +
> >>> +Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> >>> +---
> >>> + config/apparmor/abstractions/start-container.in | 1 +
> >>> + 1 file changed, 1 insertion(+)
> >>> +
> >>> +diff --git a/config/apparmor/abstractions/start-container.in b/config/apparmor/abstractions/start-container.in
> >>> +index 9998f1121..9f64c2727 100644
> >>> +--- a/config/apparmor/abstractions/start-container.in
> >>> ++++ b/config/apparmor/abstractions/start-container.in
> >>> +@@ -22,6 +22,7 @@
> >>> +   mount -> /var/lib/lxc/{**,},
> >>> + 
> >>> +   mount /dev/.lxc-boot-id -> /proc/sys/kernel/random/boot_id,
> >>> ++  mount options=(ro, nosuid, nodev, noexec, remount, bind) -> /proc/sys/kernel/random/boot_id,
> >>> + 
> >>> +   # required for some pre-mount hooks
> >>> +   mount fstype=overlayfs,
> >>> diff --git a/debian/patches/series b/debian/patches/series
> >>> index ee20ef5..f588081 100644
> >>> --- a/debian/patches/series
> >>> +++ b/debian/patches/series
> >>> @@ -1,3 +1,4 @@
> >>>  pve/0001-PVE-Config-lxc.service-start-after-a-potential-syslo.patch
> >>>  pve/0002-PVE-Config-deny-rw-mounting-of-sys-and-proc.patch
> >>>  pve/0003-PVE-Config-attach-always-use-getent.patch
> >>> +pve/0004-apparmor-Allow-ro-remount-of-boot_id.patch
> >>>     
> >>  
> >   
>