Received: by 10.192.165.156 with SMTP id m28csp696935imm; Mon, 16 Apr 2018 07:19:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx48dw1LDSVE9L/pCaKLtnWkBWPIBu0MpGMdpj4LeBRm+970Qj5agYFrwkH/NePYWE8sb0khr X-Received: by 2002:a17:902:8f96:: with SMTP id z22-v6mr7206129plo.200.1523888343308; Mon, 16 Apr 2018 07:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523888343; cv=none; d=google.com; s=arc-20160816; b=Vyow8vnY4BmI8YuN4TUdgh/Z4Gwy6CVjCsIfC8Wr4oeBTZRufqcelr4WAIK+VvUMpz vmxdvGYQqdOQDNTw4bQmdy6xDL8okhIL0ht7qmOhWGO7lmQtw1Vo69C4qmnEmXLbL8Nw dhYHTNKRp942JQaB8yTL4cls7P/g3Da00H4QpK2Iz7tz5P0LoBqE+CmPv4bpHukrbYl3 jbMAlrXShdTRNs7BIBM7S1MRPYQQ3tkRtKAUphI+zDZtfgf4OqfbAt+lxx/y0K6o2hYG gkTemZlNIRa3zYTMBjek1BksJ+dp7rj6KNfILfXcAmg53v3OvR/se9CyUmbjE/ZXAVH1 8pyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=n+5sHoCGBnL3ltKFkIs0IAUVoxfGvS4S2By1C7v1x9Y=; b=mQ5B8/DL/mFDyIN/ctk4+tW0sR66Y9H2RXqFmlpfu7rWvF/YWpY40LMuxgecl0Qo1n M4ZyUP3lfIhZR97ZeCk/30mz9HG4C8w4YYYYmqLrSoTqZVOGYbKAfSbYgABERbsOAojM fzP3e8DvB7ZQDpw2M53akA/cnrUeaHXb4gxTQIMfej3t+sZtwFN9rWQZyR4D6rZ8mz9w 3/Xrg5qb6TMfbVNYiVpPWMvrx0AxbvO5unor0Qn/AwVz4+mFUzwCc93jk/MgOyu5QFPU fD+bZg5GiOJEs6QAZF9ko/pIhUqNfrQ8vJVg0tQZvNlJX8KCjdCuPZK50idAQic4yxIr C2vw== ARC-Authentication-Results: i=1; mx.google.com; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a98-v6si695109pla.239.2018.04.16.07.18.49; Mon, 16 Apr 2018 07:19:03 -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; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754066AbeDPOQy (ORCPT + 99 others); Mon, 16 Apr 2018 10:16:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59000 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750996AbeDPOQv (ORCPT ); Mon, 16 Apr 2018 10:16:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 465A3E44B5; Mon, 16 Apr 2018 14:16:51 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-12.rdu2.redhat.com [10.10.112.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A631A2140624; Mon, 16 Apr 2018 14:16:49 +0000 (UTC) Date: Mon, 16 Apr 2018 10:11:01 -0400 From: Richard Guy Briggs To: Ondrej Mosnacek Cc: Linux-Audit Mailing List , LKML , SElinux list , Linux Security Module list Subject: Re: [PATCH ghak46 V1] audit: normalize MAC_STATUS record Message-ID: <20180416141101.zcovkknupxcgiwf2@madcap2.tricolour.ca> References: <6b939250a519668af109adf877d85ff018b217d7.1523316267.git.rgb@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171027 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 16 Apr 2018 14:16:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 16 Apr 2018 14:16:51 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rgb@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-16 09:26, Ondrej Mosnacek wrote: > 2018-04-10 1:34 GMT+02:00 Richard Guy Briggs : > > There were two formats of the audit MAC_STATUS record, one of which was more > > standard than the other. One listed enforcing status changes and the > > other listed enabled status changes with a non-standard label. In > > addition, the record was missing information about which LSM was > > responsible and the operation's completion status. While this record is > > only issued on success, the parser expects the res= field to be present. > > > > old enforcing/permissive: > > type=MAC_STATUS msg=audit(1523312831.378:24514): enforcing=0 old_enforcing=1 auid=0 ses=1 > > old enable/disable: > > type=MAC_STATUS msg=audit(1523312831.378:24514): selinux=0 auid=0 ses=1 > > > > List both sets of status and old values and add the lsm= field and the > > res= field. > > > > Here is the new format: > > type=MAC_STATUS msg=audit(1523293828.657:891): enforcing=0 old_enforcing=1 auid=0 ses=1 enabled=1 old-enabled=1 lsm=selinux res=1 > > > > This record already accompanied a SYSCALL record. > > > > See: https://github.com/linux-audit/audit-kernel/issues/46 > > Signed-off-by: Richard Guy Briggs > > --- > > security/selinux/selinuxfs.c | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c > > index 00eed84..00b21b2 100644 > > --- a/security/selinux/selinuxfs.c > > +++ b/security/selinux/selinuxfs.c > > @@ -145,10 +145,11 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf, > > if (length) > > goto out; > > audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS, > > - "enforcing=%d old_enforcing=%d auid=%u ses=%u", > > + "enforcing=%d old_enforcing=%d auid=%u ses=%u" > > + " enabled=%d old-enabled=%d lsm=selinux res=1", > > This is just a tiny nit but why does "old_enforcing" use an underscore > and "old-enabled" a dash? Shouldn't the style be consistent across > fields? Yes, but my understanding is a preference for underscore, and not to change existing field names. Steve? > Just my two cents... These details are worth noticing, thank you. > > new_value, selinux_enforcing, > > from_kuid(&init_user_ns, audit_get_loginuid(current)), > > - audit_get_sessionid(current)); > > + audit_get_sessionid(current), selinux_enabled, selinux_enabled); > > selinux_enforcing = new_value; > > if (selinux_enforcing) > > avc_ss_reset(0); > > @@ -272,9 +273,11 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf, > > if (length) > > goto out; > > audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS, > > - "selinux=0 auid=%u ses=%u", > > + "enforcing=%d old_enforcing=%d auid=%u ses=%u" > > + " enabled=%d old-enabled=%d lsm=selinux res=1", > > + selinux_enforcing, selinux_enforcing, > > ^ also here > > > from_kuid(&init_user_ns, audit_get_loginuid(current)), > > - audit_get_sessionid(current)); > > + audit_get_sessionid(current), 0, 1); > > } > > > > length = count; > > Ondrej Mosnacek - RGB -- Richard Guy Briggs Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635