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=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 6EFE0C48BDF for ; Tue, 15 Jun 2021 21:15:51 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1705C61350 for ; Tue, 15 Jun 2021 21:15:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1705C61350 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=linux-audit-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623791750; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EpYULoBssb9BBX+XPhh4zp+gQiZ2808yIT4UcJCQmhQ=; b=f051wNDZpNP6cb5ow41WaxRoPHiniRJ6PZlXpbAUZtrp3QPLmrfpy7xMOT9FztbogzG0Nm G5YkWTPIBeunkxllwj2kzbQt7RaK2P0AYdodjn+C2JLB2tj+HNp9/A3d8DfoOnfi8C5aG6 Ehk50Pi79mUpAU7F27vECnFObHgefDI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-KqRLO4qXMJ2Huvvds2lU5w-1; Tue, 15 Jun 2021 17:15:48 -0400 X-MC-Unique: KqRLO4qXMJ2Huvvds2lU5w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB22B19200C1; Tue, 15 Jun 2021 21:15:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82F0310023AB; Tue, 15 Jun 2021 21:15:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5CBD11809CAD; Tue, 15 Jun 2021 21:15:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15FLFVL6017120 for ; Tue, 15 Jun 2021 17:15:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id C4FD91007606; Tue, 15 Jun 2021 21:15:31 +0000 (UTC) Received: from x2.localnet (ovpn-113-100.rdu2.redhat.com [10.10.113.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4402210023AB; Tue, 15 Jun 2021 21:15:31 +0000 (UTC) From: Steve Grubb To: Casey Schaufler Subject: Re: Adding support for MAC_TASK_CONTEXTS and MAC_OBJ_CONTEXTS to userspace. Date: Tue, 15 Jun 2021 17:15:30 -0400 Message-ID: <2584754.mvXUDI8C0e@x2> Organization: Red Hat In-Reply-To: <30449857-fb74-4203-d464-7ff09c909663@schaufler-ca.com> References: <7967755.NyiUUSuA9g@x2> <30449857-fb74-4203-d464-7ff09c909663@schaufler-ca.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: linux-audit@redhat.com Cc: "linux-audit@redhat.com" X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Tuesday, June 15, 2021 1:01:18 PM EDT Casey Schaufler wrote: > On 6/14/2021 2:13 PM, Steve Grubb wrote: > > Hello, > > > > On Monday, June 14, 2021 3:34:33 PM EDT Casey Schaufler wrote: > >> I'm looking at the audit userspace implications of adding two > >> new kernel audit records. AUDIT_MAC_TASK_CONTEXTS and > >> AUDIT_MAC_OBJ_CONTEXTS are used when there are multiple security > >> modules with a "security context" active on the system. This > >> design has been discussed here at length. The records will look > >> > >> like: > >> AUDIT_MAC_TASK_CONTEXTS > >> subj_=value > >> subj_=value > >> ... > >> > >> Looking at the audit user-space code I see several things > >> that have me concerned. The first is the use of WITH_APPARMOR. > >> Going forward what behavior would we want if subj_apparmor=something > >> shows up on a system that has not got WITH_APPARMOR defined? > > > > I think it should be ignored. > > > >> The code is inconsistent in that it does not use WITH_SELINUX, > >> but that's hardly a surprise given its origins. There is also no > >> WITH_SMACK, but that's unlikely to be an issue since Smack's use > >> of audit is very much like SELinux's. > > > > We can add those WITH_* if you like. > > > >> The question is what to > >> do about filtering when subj=foo is specified. I suggest that if > >> any of subj_selinux, subj_smack or subj_something is "foo", it is > >> a match. > > > > I think that's how we already treat things. There is a linked list for > > AVC's and we match on any of. > > > >> But the SELinux components of a label (level, user, ...) > >> are also available for filtering. If someone wrote a simple Bell & > >> LaPadula LSM filtering by some of those fields could be useful > >> there, too. > >> > >> I would like guidance on whether I ought to go the route of > >> more extensive use of WITH_APPARMOR (and WITH_SMACK, WITH_MUMBLE) > >> or take the path of greater generalization. Or, whether I should > >> treat each case individually and give it my best whack. > > > > To be honest, I have no idea how well the audit system works with any MAC > > system except SE Linux. > > Understood. Part of what I'm looking at is ensuring that as multiple > concurrent LSMs come in that the audit user-space isn't mucked up. > ausearch has these options: > > -o,--object > -se,--context > -su,--subject > > Without multiple LSMs we can easily ignore "SE Linux" in these > options and use whatever kind of "context" is available. If I > have SELinux and AppArmor, the implication is that you can't > search on AppArmor information. Should we be adding > > -aa,--apparmorcontext > -as,--apparmorsubject > > or should we change -se to look at all "contexts", and change > the description to reflect that? Basicaly, I'm asking whether you'd > rather add options for other LSMs or remove descriptions that > specify SELinux. I'd say any/all contexts available by default. Then we can maybe make a restriction to specific LSM's later. -Steve > > I don't really know if its doing the right thing. > > > > Ausearch and report share a parser. It is time sensitive. I usually test > > it on 4 or 5 Gb of logs. We also have the ausearch-test program which > > can be used to test any changes to the parser. > > > > http://people.redhat.com/sgrubb/audit/ausearch-test-0.6.tar.gz > > > > Once that is squared away, there is the auparse library. It has a table > > that classifies a field name into what it is for interpretation > > purposes. You will find a #ifdef WITH_APPARMOR. I don't know if that > > table is complete or if it needs to be extended for any other MAC > > system. > > > > That then leads to the auparse normalizer. I don't know if we need to > > make > > any changes there. You can trigger its code with ausearch --format csv or > > -- format text. > > > > Also, we have some size limits in user space. How big can an event record > > be if the file is MAX_PATH name length and it has a space in its name or > > directory and each context is it's maximum size? We may need to think > > about how this might change the whole userspace ecosystem's size > > definition, MAX_AUDIT_MESSAGE_LENGTH, since this is part of the ABI. And > > the kernel also has AUDIT_MESSAGE_TEXT_MAX. What would you get with: > > > > # /usr/sbin/auditctl -m `perl -e 'print "A"x8880'` > > > > And last...what about auditctl? Is the syscall filter going to allow > > filtering on these other subject/object components? > > > > -Steve -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit