Received: by 10.213.65.68 with SMTP id h4csp131094imn; Thu, 15 Mar 2018 11:46:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELvK+wmEZiZLJOjqk7Ul1VPhywr6Jsaw00ybOuyBzUXdzkyBZHC6ewyPH7DMvkHyrg0U+Fbu X-Received: by 2002:a17:902:b943:: with SMTP id h3-v6mr5157649pls.1.1521139602791; Thu, 15 Mar 2018 11:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521139602; cv=none; d=google.com; s=arc-20160816; b=ASLNkLDNmyfkRzutHZ+f6Ukt5upEyyIibnxJYVaAmZbStIOhahr9fY7aL6DDaRpW0P f3NzYTqgyU/teqaSQj0ETwsGfg4hjnVo5AxjNPB6kE/4h4R68Hwiz/69bDzMxves2KE5 AFj8cFIHAgQFStgolE3CNTgIqgGyY9o8HFbmc4t8hvsKPEAdV7jXedzV9fUQxRLcY/T4 UNutAgAN7ZKleJReeMbI7G3cXtKwkguEBklw284j8ybGc/7C/z5Ag5AhKe3RAgiyK3QZ MGOe9s+T3k1lxnlIWAZHJUMduXbJzK2m81O16I/QmwpWWWniEjJNY4nuC1JmZsrt0cjI LZxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=eDp3iJMn0zQ+XI64FwtnNq351/Hg9X/LKuyrFARFGFI=; b=vUvHk0ple7XZo+DVESNBW++QUYmPtNWSfCkhnAUA6bLo0CzFGB1v1lycACgIcvZvpb rrUAAl8tM2vg27yJBQVOKu41lcHAPRVBTIakuGaJxAqf/yVNdfPLF28algmEVx1CfqDi ZtwR8PGMXgBeV7O4v/1siR1ZbXNi6XTM64JgiDoVq1TKFo7P/JpnKw030j2vPkdELuvF frh/W7wevzgSxYe/RdcKRcxwHP5XOyBMHPwAEhGw61BaEMPfAjmRUAzR6zF8NVVz4ejy 2M9XI0l6bZFkBxhWzKZO8pcpnzjbWZlx/sZ/D1+Q9l58euHedlKdgEk9f3jv8cIzCmSO 5cOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=gjVl6tOz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si4549518plg.650.2018.03.15.11.46.28; Thu, 15 Mar 2018 11:46:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=gjVl6tOz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbeCOSpj (ORCPT + 99 others); Thu, 15 Mar 2018 14:45:39 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:39660 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbeCOSph (ORCPT ); Thu, 15 Mar 2018 14:45:37 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id C3A148EE139; Thu, 15 Mar 2018 11:45:36 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hGcUYeGKpnsv; Thu, 15 Mar 2018 11:45:36 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.35.65.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 1B82A8EE0C7; Thu, 15 Mar 2018 11:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1521139536; bh=B5VZ9AMJqClEjP2vNCbf4mL+TPMxLiiYXr1nqtfW+D4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=gjVl6tOzJx7fXgCmY63Iqc8lksaD/NWSz4UWZL7pVLEMg9ugJCFbY47hu1sUd6IaT 2cyctWXGCvbOEcPQAbyRSdpQHt2JDqsr2maCNYnmeve2ANtUVCKVObLAC0mFhSsA04 Cf55ot11ZcQ2ZriIAfYPJLkF/lWiXwpn8YT7JRPw= Message-ID: <1521139535.5348.89.camel@HansenPartnership.com> Subject: Re: [RFC PATCH v2 1/3] ima: extend clone() with IMA namespace support From: James Bottomley To: Stefan Berger , "Eric W. Biederman" Cc: mkayaalp@cs.binghamton.edu, Mehmet Kayaalp , sunyuqiong1988@gmail.com, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, david.safford@ge.com, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, zohar@linux.vnet.ibm.com Date: Thu, 15 Mar 2018 11:45:35 -0700 In-Reply-To: <2183a3b4-6270-d2e9-70ad-a7399eb1681c@linux.vnet.ibm.com> References: <20180309201421.6150-1-stefanb@linux.vnet.ibm.com> <20180309201421.6150-2-stefanb@linux.vnet.ibm.com> <87vadxfwqj.fsf@xmission.com> <1521135192.5348.64.camel@HansenPartnership.com> <2183a3b4-6270-d2e9-70ad-a7399eb1681c@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-03-15 at 14:26 -0400, Stefan Berger wrote: > On 03/15/2018 01:33 PM, James Bottomley wrote: > > > > On Thu, 2018-03-15 at 11:26 -0400, Stefan Berger wrote: [...] > > > > > > IMA measures the files described by these paths. The files also > > > may hold signatures (security.ima xattr) needed for IMA > > > appraisal. > > The xattr is an inode property, which isn't namespaced by the > > mount_ns. > > > > When we had this discussion last year, we talked about possibly > > using the user_ns instead.  It makes sense because for IMA > > signatures you're > > 'using the user_ns' I suppose means hooking IMA namespace to it... Yes, making it belong to the user ns instead of the mnt ns. I'm not saying it has to, but I equally don't see a good reason IMA has to have its own namespace, especially as the keyrings are tied to the user_ns. > > going to need some type of keyring namespace and there's already > > one hanging off the user_ns: > > > > commit f36f8c75ae2e7d4da34f4c908cebdb4aa42c977e > > Author: David Howells > > Date:   Tue Sep 24 10:35:19 2013 +0100 > > > >      KEYS: Add per-user_namespace registers for persistent per-UID > > kerberos caches > > The benefit for IMA would be that this would then tie the keys needed > for appraising to the IMA namespace's policy. > However, if you have an appraise policy in your IMA namespace, which > is now hooked to the user namespace, and you join that user namespace > but your files don't have signatures, nothing will execute anymore. > That's now a side effect of joining this user namespace unless we > have a magic  exception. My feeling is, people may not like that... Agree, but I think the magic might be to populate the ima keyring with the parent on user_ns creation.  That way the user_ns owner can delete the parent keys if they don't like them, but by default the parent appraisal policy should just work. > > > > I saw that Serge even recently mentioned that you need to take > > > > this aspect of the changes back to the drawing board.  With my > > > > namespace maintainer hat on I repeat that. > > > Drawing board is here now (tuning on the text...): > > > > > > http://kernsec.org/wiki/index.php/IMA_Namespacing_design_consider > > > ations > > You mention an abuse case here which is basically a way of relaxing > > security policy.  Cannot we fix that by making policy hierarchical, > > so a child namespace must have the same or a more strict policy > > than the parent? > > I updated the page now with a hopefully better idea. So that root > cannot escape IMA-appraisal by spawning IMA namespaces and setting an > IMA NULL policy, root's activities will *always* be evaluated against > the init_ima_ns policy with keys found in the init_user_ns. In other > word, if there is an appraisal policy (rule) on the host's > init_ima_ns and root does something as uid 0 in any namespace, file > activity for appraising purposes must pass signature checking. So > just spawning a MNT namespace, mounting a filesystem with unknown > apps won't execute any of them unless the stuff is signed. So this would mean that most orchestration systems' ideas of privileged containers (i.e. containers which run real root) would be unable to have their own IMA namespace ... that's also going to be surprising. James