Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4443978pxb; Mon, 21 Feb 2022 21:48:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzluiaRCFHHGU+AilQXa+39ZJKqtnTRaCIw9yRHEFDNQo2+/rpunS+/YqjmWTihATywYIj/ X-Received: by 2002:a17:902:7d81:b0:14f:e18b:2b9e with SMTP id a1-20020a1709027d8100b0014fe18b2b9emr941950plm.160.1645508923873; Mon, 21 Feb 2022 21:48:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645508923; cv=none; d=google.com; s=arc-20160816; b=0MxptJRWN/LJAnPyzHYD0Me8xGsHuel0tUUlMoaihjwV7+PdlZGxmaw/9Br2/OXU38 K+0l42phAam3Munh/CUeisIdFaup6x0J+Gl3ckHVpOOJSrYlyawvdpMVKzdkbsgowDPe aMhj+BaoZN1eR3GKlFv2sxras00STm/hpV53+AV86TCmabaumsj76U//mqtVTo0UI9/M Ro9a55hvZ3THvomjdIyNbvlD3A72XQoD7jn5C52mXVoUQecnZe3IFp5goRx0aY21ff7n eXWS9MSZPnTqG3vFOMHbwCuwh39j5ZnNrOq0/MlUkME5x6wUaqIwWzIVvhfa1/LkiVND mgmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RP2EEkWy0sBc5ZjrF/F84IDBVl9YU6TUTsOTc/mEYmc=; b=lCPH/9k+GrCeJr0jx4kxoM0gNm5pnM8A+Fs2BZ/Rpmvs+lR7dM/Zq5gL+EV+yu7+3N o0vRSP5OVOZ8GF5OIiclWVxchmcEpKtRsH9+wWgMtsc0910pH2/sVK4QXcdQiiX46bVq 52bmeKcyPGrnoX8bwyhHSx0fa5Uzzln6rasbpA7OApvS7L6waDB/s/8Fye8zcW2le+TO Cv7VN6Ws7DquIzUzWqggU3XkVB6iKACzTl3gr6k6GRTgwKKopjrot+Vwmj3sImfmwv1y XUMImxGpYFduddl2l4BLRy6Ketldf4ajlhleZJ6yAHbp9oSggg5gexmTRgSmRjG3Ao9o 2GlA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j72si18662608pge.724.2022.02.21.21.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:48:43 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5838ED8863; Mon, 21 Feb 2022 21:12:46 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234603AbiBUVQj (ORCPT + 99 others); Mon, 21 Feb 2022 16:16:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234394AbiBUVPs (ORCPT ); Mon, 21 Feb 2022 16:15:48 -0500 Received: from smtp-190f.mail.infomaniak.ch (smtp-190f.mail.infomaniak.ch [IPv6:2001:1600:3:17::190f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A077423BEA for ; Mon, 21 Feb 2022 13:15:20 -0800 (PST) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4K2Znx0KrTzMqHj1; Mon, 21 Feb 2022 22:15:17 +0100 (CET) Received: from localhost (unknown [23.97.221.149]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4K2Znw5mBSzljTgD; Mon, 21 Feb 2022 22:15:16 +0100 (CET) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: James Morris , "Serge E . Hallyn" Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Al Viro , Jann Horn , Kees Cook , Konstantin Meskhidze , Paul Moore , Shuah Khan , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= Subject: [PATCH v1 10/11] landlock: Document good practices about filesystem policies Date: Mon, 21 Feb 2022 22:25:21 +0100 Message-Id: <20220221212522.320243-11-mic@digikod.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221212522.320243-1-mic@digikod.net> References: <20220221212522.320243-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mickaël Salaün Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20220221212522.320243-11-mic@digikod.net --- Documentation/userspace-api/landlock.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/userspace-api/landlock.rst b/Documentation/userspace-api/landlock.rst index 97db09d36a5c..cc3b52f65f99 100644 --- a/Documentation/userspace-api/landlock.rst +++ b/Documentation/userspace-api/landlock.rst @@ -156,6 +156,27 @@ ruleset. Full working code can be found in `samples/landlock/sandboxer.c`_. +Good practices +-------------- + +It is recommended setting access rights to file hierarchy leaves as much as +possible. For instance, it is better to be able to have ``~/doc/`` as a +read-only hierarchy and ``~/tmp/`` as a read-write hierarchy, compared to +``~/`` as a read-only hierarchy and ``~/tmp/`` as a read-write hierarchy. +Following this good practice leads to self-sufficient hierarchies that don't +depend on their location (i.e. parent directories). This is particularly +relevant when we want to allow linking or renaming. Indeed, having consistent +access rights per directory enables to change the location of such directory +without relying on the destination directory access rights (except those that +are required for this operation, see `LANDLOCK_ACCESS_FS_REFER` documentation). +Having self-sufficient hierarchies also helps to tighten the required access +rights to the minimal set of data. This also helps avoid sinkhole directories, +i.e. directories where data can be linked to but not linked from. However, +this depends on data organization, which might not be controlled by developers. +In this case, granting read-write access to ``~/tmp/``, instead of write-only +access, would potentially allow to move ``~/tmp/`` to a non-readable directory +and still keep the ability to list the content of ``~/tmp/``. + Layers of file path access rights --------------------------------- -- 2.35.1