Received: by 10.192.165.156 with SMTP id m28csp560142imm; Tue, 17 Apr 2018 15:17:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+vcgeAL0WZ8gK851sYZsqouTMT4NUcscbMPrT1QsrMu48woksd/cYB6EJvjjUloXXmWeQI X-Received: by 10.99.119.73 with SMTP id s70mr3201244pgc.208.1524003432629; Tue, 17 Apr 2018 15:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524003432; cv=none; d=google.com; s=arc-20160816; b=vfVhfe4fjoIQ5gRIljAed/c2z+3nmTiEsjA+K7rMwMeakmWvtJGZajXv/tIwJRDH+D VzroUd8voSat71r8Dh0k+y/vOM1N4DEx0r3IObFvx0uFvuIM1oQXMbdza9LszUtBKR0/ W/JV/odo9B2X10ChxaplG10o760ZrqDI4gmbrg4w2iDOyhWVhXMMKKPee9mxTR7WubHC mYtZjH9qwc4jWTmMHfT8cree0Wq7DcTRHzDqIpV4m+DnkfUld0eTNVInq4+wSJ8wx9Hh 1EjLPqo90b516Rivil1KOSbsw0iTs0eM8B6gFD6ZIP8IOPcwCukgJCSHWNpJwYBnyJ8m vRUw== 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=CMGFhuaP+ItLY9bfFPpWqVcSGTi88ZcytauCKmPqeB4=; b=GrtIXdkXhxb/qtK2qNtCzdb4ZzH8Z679t0vKYUrbBLwICYfye48m4I6vv9+I8CvwkS iPKS5KHrwyDF7yjIP+agLbvNIWPVyxEPoXvq/RAxKZkRX3tjaCQDDAnaTHGkUK0UYsw5 wMk5Ge32rVSns5ogFYlqM1c42iYlySBnGiJNx7PinKqqL6ZLcax9BbAtE5CfLASTxKbH fSw1V4NHiELInWBTFIwPDVoIQYM7TdH5jyzNz+R++7clW1UJ/J+vp9ECQEAyamw0bf+8 WMQXvVSlze8wizGAzD+moJT/XPbhOGrAr0ysAZm135ROhxgvFFxAFc+cRxrcp2PwSkhs HN1w== 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 h5-v6si15160927plt.109.2018.04.17.15.16.58; Tue, 17 Apr 2018 15:17:12 -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 S1752800AbeDQWPu (ORCPT + 99 others); Tue, 17 Apr 2018 18:15:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47218 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752619AbeDQWPp (ORCPT ); Tue, 17 Apr 2018 18:15:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FDED4023112; Tue, 17 Apr 2018 22:15:45 +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 1CDA7111CB8C; Tue, 17 Apr 2018 22:15:38 +0000 (UTC) Date: Tue, 17 Apr 2018 18:09:47 -0400 From: Richard Guy Briggs To: Paul Moore Cc: Linux-Audit Mailing List , LKML , SElinux list , Linux Security Module list , Eric Paris , Steve Grubb Subject: Re: [PATCH ghak46 V1] audit: normalize MAC_STATUS record Message-ID: <20180417220947.vyq4dd3ah2mvwgjf@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.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 17 Apr 2018 22:15:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 17 Apr 2018 22:15:45 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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-17 17:59, Paul Moore wrote: > On Wed, Apr 11, 2018 at 5:08 PM, Paul Moore wrote: > > On Mon, Apr 9, 2018 at 7:34 PM, Richard Guy Briggs wrote: > >> 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", > >> 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); > > > > This looks fine. > > > >> 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, > >> from_kuid(&init_user_ns, audit_get_loginuid(current)), > >> - audit_get_sessionid(current)); > >> + audit_get_sessionid(current), 0, 1); > > > > It needs to be said again that I'm opposed to changes like this: > > inserting new fields, removing fields, or otherwise changing the > > format in ways that aren't strictly the addition of new fields to the > > end of a record is a Bad Thing. However, there are exceptions (there > > are *always* exceptions), and this seems like a reasonable change that > > shouldn't negatively affect anyone. > > > > I'll merge this once the merge window comes to a close (we are going > > to need to base selinux/next on v4.17-rc1). > > Merged into selinux/next, although I should mention that there were > some actual code changes because of the SELinux state consolidation > patches that went into v4.17. The changes were small but please take > a look and make sure everything still looks okay to you. Ok, that was a bit disruptive, but looks ok to me. > >> } > >> > >> length = count; > >> -- > >> 1.8.3.1 > > -- > paul moore > www.paul-moore.com - 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