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: 9552527 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 05A9E602F0 for ; Thu, 2 Feb 2017 17:05:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE4712849C for ; Thu, 2 Feb 2017 17:05:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E22C7284A3; Thu, 2 Feb 2017 17:05:58 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 2306F2849C for ; Thu, 2 Feb 2017 17:05:57 +0000 (UTC) Received: (qmail 30713 invoked by uid 550); 2 Feb 2017 17:05:53 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 30271 invoked from network); 2 Feb 2017 17:05:48 -0000 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=j5beCVhuyPSfXgQ2aus9obDcLIj410PCWiOJdW+aWAgc4ht1GUfq1v9Vb6ANUxbD/X KCtP/YYvvIaVOilysWvSONor9nSiI14fBeFkZuF1+ivfDOUkZIwbJ5DK8TEnnRNaIicA 5buYVO4tQ0KkGpePMdDKCBtDK1R2dREFeGZUYzHoFyAYxKqJXpcBbI8/NKXIKJSNPWlw ZSssGCskZaaOatEw2aiTGbJO+2zmkhE8zLF1ieDMs4qo7ABm2b2pk/5g3XkAMFBcYaV8 ChqAMBFck2MeGwbgXdJQt/X8ncz6yl4zGsc6CfhPtG3X3kX4wMTecqFJMO+rHltBdQG2 WSsQ== X-Gm-Message-State: AIkVDXJWWcDIbvyWpBtSYAAIeP48em8LBIWjS0QM2CfiWjkVBk/Kt4XoAkQkqriY3tblKg== X-Received: by 10.28.60.66 with SMTP id j63mr8752509wma.74.1486055136755; 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 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> Subject: [kernel-hardening] [RFC/PATCH 3/3] doc: add Timgad LSM documentation 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' + +==============================================================