From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 868AFC433E0 for ; Wed, 6 Jan 2021 16:40:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B6882311E for ; Wed, 6 Jan 2021 16:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbhAFQk2 (ORCPT ); Wed, 6 Jan 2021 11:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726661AbhAFQk2 (ORCPT ); Wed, 6 Jan 2021 11:40:28 -0500 Received: from agnus.defensec.nl (agnus.defensec.nl [IPv6:2001:985:d55d::711]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D0BBC06134C for ; Wed, 6 Jan 2021 08:39:48 -0800 (PST) Received: from brutus (brutus.defensec.nl [IPv6:2001:985:d55d::438]) by agnus.defensec.nl (Postfix) with ESMTPSA id 8A9E82A0D7E; Wed, 6 Jan 2021 17:39:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 agnus.defensec.nl 8A9E82A0D7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=defensec.nl; s=default; t=1609951187; bh=fCpy8DYLVKwWHuXdc0uD1Kj+HoxOO3WoMK8uFet4lN0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=V8sTVcndXoHohqMOg8fCEuJiEP5cedu57aQI/bCkscdARtF7NvY1alzbjoQwzwZ3R 6vx9TbMjJH0dPO1KMsvj3nbBWiOE2XWXj4SAjPJS1ZBDrYXpBw0l2hSb+cVlu369+G NdpFpwevkOMUfL1G13+pU/x7rWPJvFOhac7IMyC8= From: Dominick Grift To: Ashish Mishra Cc: Ondrej Mosnacek , SElinux list , Paul Moore Subject: Re: Selinux context type is same for root & normal user both References: Date: Wed, 06 Jan 2021 17:39:43 +0100 In-Reply-To: (Ashish Mishra's message of "Wed, 6 Jan 2021 21:46:13 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Ashish Mishra writes: > Hi Dominick / Ondrej , > > Thanks for valuable inputs , I will try to evaluate them . > > Ashish We have a IRC channel on chat.freenode.net where we can have casual and more interactive conversations if youre interested in that https://freenode.net/kb/answer/chat > > On Wed, Jan 6, 2021 at 9:30 PM Ondrej Mosnacek wrote: >> >> On Wed, Jan 6, 2021 at 4:40 PM Dominick Grift >> wrote: >> > Ashish Mishra writes: >> > >> > > Hi Dominick , >> > > >> > > Will look at the re-labelling as you suggested. >> > > Is there any doc / blog / implementation etc to understand the >> > > sequence and commands to do this. >> > > To understand this step in a better way. >> > > >> > > We are working with such a setup freshly so any inputs / guidance will >> > > be helpful. >> > > >> > > Thanks for your time & inputs for this long thread . >> > >> > For docs i would suggest selinuxproject.org and >> > https://github.com/SELinuxProject/selinux-notebook/blob/main/src/toc.md >> > >> > For implementations i would suggest looking at how OpenWrt implemented >> > SELinux as this is a very simple implementation and the target seems to >> > be relatively similar to yours with the exception that OpenWrt does not >> > use a volatile root but instead uses a read-only squashfs and a overlay. >> > >> > You can also look at Fedora CoreOS for inspiration, and Googles SEAndroid. >> > >> > Implementing meaningful SELinux for exotic use cases like yours is not >> > trivial though IMHO. Using reference policy as a base-policy might not >> > be optimal for your use-case (to say the least) and it would probably be easier to create a >> > policy from scratch instead in the longer run. >> >> Well said. I'll just add that you'll at the very least need to remove >> the "genfscon" rule for "rootfs" from your policy and replace it with >> an appropriate "fs_use_xattr" one to be able to relabel the root >> filesystem. (Assuming it uses tmpfs under the hood (or supports >> xattrs), otherwise you may need to mount tmpfs somewhere and chroot >> into it at the beginning of your init script. Or something like >> that...) >> >> -- >> Ondrej Mosnacek >> Software Engineer, Platform Security - SELinux kernel >> Red Hat, Inc. >> -- gpg --locate-keys dominick.grift@defensec.nl Key fingerprint = FCD2 3660 5D6B 9D27 7FC6 E0FF DA7E 521F 10F6 4098 https://sks-keyservers.net/pks/lookup?op=get&search=0xDA7E521F10F64098 Dominick Grift