From patchwork Thu Feb 2 17:04:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Djalal Harouni X-Patchwork-Id: 9552535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 115B960424 for ; Thu, 2 Feb 2017 17:06:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 064741FFC9 for ; Thu, 2 Feb 2017 17:06:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEEC6284BA; Thu, 2 Feb 2017 17:06:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CBB31FFC9 for ; Thu, 2 Feb 2017 17:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751477AbdBBRFk (ORCPT ); Thu, 2 Feb 2017 12:05:40 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34234 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174AbdBBRFi (ORCPT ); Thu, 2 Feb 2017 12:05:38 -0500 Received: by mail-wm0-f68.google.com with SMTP id c85so5307379wmi.1; Thu, 02 Feb 2017 09:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mm7kPggA633vbqzzK+Oe5mCijsmRp39UozOfGEygr4g=; b=lxjHswfutYBmEtapYe3St2OngcPcb45ZG8Bx3braHndCVpTdQbCtHtvOveEg/l96NS 6Kh80sHvtCXj9OpslpiZBvMsCH5882nAG7Kl+IeFxWZrmhXU5Rw7lzPh7qSQamateyp2 DKupYL2s07hgkXXNuHh67y4SzcNhHOO8fQXhyBeujX9z9lAUG3rhy/8V2HoAkOKthzF7 yxKzXk9HpSNSb4puFSzBfBYd8dcn6y9F8zRAhcqrRiXK9R5gJq0nNvj3rVjOwcnePdyG u1VkQNKsoeN0W71xfpB0mv6ba8COJ87fHL4YiIBNpEfRZCNJF+jlHnbu7C9fHYOYzAmP eM2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mm7kPggA633vbqzzK+Oe5mCijsmRp39UozOfGEygr4g=; b=aHXMUvxZPIr2dk6p+eu/pwDIe03wQ93TGhFdTSYymz8m6TE5vuVhM2QPF4wvTvC/C+ vhmLli2lCsd0Z5zn0v384Y1Z49JN1oRzsK2EfAw+1ZxC2sAYlIoxEAdP+/uXN6QnczZa Gz9gbCfQgA/xOEMDFzH1KAYSdAb0qO7T8b7RS9RirpE1yJNHQrjQqd7B+C+cfxC0nXYZ 2EYMZ4bEbzGmlA1URaUX83r0OWYV5cE+dFgugMXBCrj3FuMjFm+0zMvnRHHJ6lU3gJud z975cJTsL3zvXuKgo9NNdFWO/KWMZsbQq/KL2WLOYc7dd9dU5uoHusF9qRmeEDl363E3 +BNg== X-Gm-Message-State: AIkVDXJ6glLdGJkXnl6ReJqFMu2nMGeqn5tfm8vfYP1gI0Sxghru7qmEB9XHwkDZDsG0LA== X-Received: by 10.28.60.66 with SMTP id j63mr8752509wma.74.1486055136755; Thu, 02 Feb 2017 09:05:36 -0800 (PST) Received: from dztty2.localdomain (ip5b41f4e7.dynamic.kabel-deutschland.de. [91.65.244.231]) by smtp.gmail.com with ESMTPSA id 8sm4805059wmg.1.2017.02.02.09.05.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2017 09:05:36 -0800 (PST) From: Djalal Harouni X-Google-Original-From: Djalal Harouni To: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-security-module@vger.kernel.org, Kees Cook Cc: Andrew Morton , Lafcadio Wluiki , Djalal Harouni , Dongsu Park , Andy Lutomirski , James Morris , , Al Viro , Daniel Mack , Jann Horn , Elena Reshetova Subject: [RFC/PATCH 3/3] doc: add Timgad LSM documentation Date: Thu, 2 Feb 2017 18:04:54 +0100 Message-Id: <1486055094-4532-4-git-send-email-djalal@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1486055094-4532-1-git-send-email-djalal@gmail.com> References: <1486055094-4532-1-git-send-email-djalal@gmail.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Djalal Harouni Cc: Kees Cook Signed-off-by: Djalal Harouni --- Documentation/security/Timgad.txt | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/security/Timgad.txt diff --git a/Documentation/security/Timgad.txt b/Documentation/security/Timgad.txt new file mode 100644 index 0000000..1ae1e7c --- /dev/null +++ b/Documentation/security/Timgad.txt @@ -0,0 +1,61 @@ +Timgad is a Linux Security Module that collects per process and +system-wide security protections that are not handled by the core kernel +itself. + +This is selectable at build-time with CONFIG_SECURITY_TIMGAD, and can be +controlled at run-time through sysctls in /proc/sys/kernel/timgad: +or prctl() interface. + + +- module_restrict + +============================================================== + +Linux containers need robust settings to control if modules are allowed to +be loaded or unloaded globally or per process/container policy. +Automatic loading of kernel modules using the "auto-load" feature is also +covered. + +This adds global sysctl settings to indicate if modules are allowed +to be loaded or unloaded, at same time it also supports a +per-process/container settings based on prctl(2) interface. The prctl(2) +settings are inherited by children created by fork(2) and clone(2), and +preserved across execve(2). + + +*) The per-process prctl() settings are: + prctl(PR_TIMGAD_OPTS, PR_TIGMAD_SET_MOD_RESTRICT, value, 0, 0) + + Where value means: + +0 - Classic module load and unload permissions, nothing changes. + +1 - The current process must have CAP_SYS_MODULE to be able to load and + unload modules. CAP_NET_ADMIN should allow the current process to + load and unload only netdev aliased modules. + +2 - Current process can not loaded nor unloaded modules. + + +*) The sysctl settings (writable only with CAP_SYS_MODULE) are: + /proc/sys/kernel/timgad/module_restrict + +0 - Classic module load and unload permissions, nothing changes. + +1 - Only processes with CAP_SYS_MODULE should be able to load and + unload modules. Processes with CAP_NET_ADMIN should be able to + load and unload only netdev aliased modules. + +2 - Modules can not be loaded nor unloaded. Once set, this sysctl value + cannot be changed. + + +Rules: +First the prctl() settings are checked, if the access is not denied +then the global sysctl settings are checked. + + +The original idea and inspiration is from grsecurity +'GRKERNSEC_MODHARDEN' + +==============================================================