Received: by 10.192.165.156 with SMTP id m28csp709852imm; Tue, 17 Apr 2018 18:53:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+0NAtPurjl5fmMqozF7F5fBfNcAXeZe1O+ef8peE736LYsr0jO8azGp+vO+fIqxWY8xg3R X-Received: by 10.98.231.10 with SMTP id s10mr144748pfh.141.1524016436152; Tue, 17 Apr 2018 18:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524016436; cv=none; d=google.com; s=arc-20160816; b=fvYkvhzeRiAcl10c3Nz9udgHqRW441cGly3y1PTaqIXo5UtV5b0dXa832wt0ityRYi QT7+2mSSq0nQc3fv3GmgpkC1co4Xlom+sRZRHNl18UDi7k+iwKArCJRJYe7rR4bcu+ZO XH0anh62VfXu1ey+0sH7dNGqXu/BPwG2TMDS9dVkQNXvwHt2kT0W7rC5WwYPfrc4O6DX m1laLKmCdfCEXPe4lA6h2nWbXIIRC6TsT1o3e2UPjaj1a3ybfRzlSXr4FD+I8x0UlAJl YLGkVnbQtn6IdunXWZYhVnJKvd5xoCSxlgYikSoeCGDi+PDXiaZv6FPOkiCfcNK8NrTn cO0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=W1JYHAu5x33tJh9CweOGDIs3ufFtJA1e7KonNoGgioQ=; b=vOguEx5iyk9k3SoxhQc3kzBifqtccmBdumlrD27spsZiXHqYCVvWcDGwpZxMpjcJSY yOzdYiLMjqUVn9A3gpXdJf7LXY5iqkPhYPGE7AN4KkG8PFwgj8SvhCenwSCJ7K+4Kftw bst/CsZ0L2uwg7aK3yeGVFISOb3Bcq8OgR6fE5insGaw5+lRp+7LJ5BI2N5/nu7xwsNF muqE5TrX8/2UyaeZFV6oRxVuzQD2r0tPOUum7hy/zGJCTBWLWPXY72ts2gveS7WHG2My amGlM7v22Jb156AcYDscuBhExXWlCY5HA3QBscghHGro7Hdv/WBKH5WrR+f50AmtUiKa +ejQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=zZtB/67H; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si109240pgu.655.2018.04.17.18.53.31; Tue, 17 Apr 2018 18:53:56 -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=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=zZtB/67H; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbeDRBvb (ORCPT + 99 others); Tue, 17 Apr 2018 21:51:31 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36301 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752800AbeDRBva (ORCPT ); Tue, 17 Apr 2018 21:51:30 -0400 Received: by mail-lf0-f67.google.com with SMTP id d20-v6so224810lfe.3 for ; Tue, 17 Apr 2018 18:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=W1JYHAu5x33tJh9CweOGDIs3ufFtJA1e7KonNoGgioQ=; b=zZtB/67HXlhDXNnlHNdSmrd25/me5oOr/y83zV2YSyPc1kqCcChQJB6Rk0/myzn4bT aTLuDfI1PUX9XCnL4JcDUV+3YW3n4i+82OECqmGtmpdnCNCTFIQFbOugZC0G1hZBDjWN EHNQsfL+0e4U2Ed0TXPlFzM3ypBu+tqXwZQIgEN5sjejM+3v1Jw9YiJSan8xn2uqJjSz nrr9Hdd3Z4gvTCleREurz1QZOlbv681zTRSZbV4J/nxqLUWOkevcZ+soo2qwi8ORMFsN nq84KSK3c7B4ClsdBi86rqnP57sx3qsS8YTVJXOR1JzzJbmJoAU/GfYK4HINKZaYM993 Usww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=W1JYHAu5x33tJh9CweOGDIs3ufFtJA1e7KonNoGgioQ=; b=WkAhYl3o8DlOJp8KGrpIIyXSO8NQo0pCtki3YY9DImwb766AS2SnM2u6f30lV96ukb H//PUuNrPOylcQBtxtfzucjEkLJFkeEuoNq5s9A0t+JtbBkb8/tOiQkMfkLw2HRwcewR 2o15//+dTWImN6cZOcJ8vFFzzXsg590RpLmvFXKLXDTqPPTEEDBe6XAxxfBEaWewe11G vyIw0Ne8GRdTOnZrPCo949mv1ODEkvlPex4FVRbbBq1V0qhlf3UyX08sj/5yYk3iGhi8 /Bpv4BfNV8SRyygVfC3qzfA0NB1bBPvZd3/IMJk7M2fU4Zglewj7jdHm/7uESv9GBut3 tQjg== X-Gm-Message-State: ALQs6tDl4moMZHOV4bODCOZw2W9FCWxmmvthDa4kcGqzo4uKl4E81g4C D8KhsLpw1VWLrXuD/RcK66AWTGFTJ5n/HKYnoIKn X-Received: by 2002:a19:1f4a:: with SMTP id f71-v6mr80466lff.12.1524016288557; Tue, 17 Apr 2018 18:51:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:a5c3:0:0:0:0:0 with HTTP; Tue, 17 Apr 2018 18:51:27 -0700 (PDT) X-Originating-IP: [108.20.156.165] In-Reply-To: <20180417220947.vyq4dd3ah2mvwgjf@madcap2.tricolour.ca> References: <6b939250a519668af109adf877d85ff018b217d7.1523316267.git.rgb@redhat.com> <20180417220947.vyq4dd3ah2mvwgjf@madcap2.tricolour.ca> From: Paul Moore Date: Tue, 17 Apr 2018 21:51:27 -0400 Message-ID: Subject: Re: [PATCH ghak46 V1] audit: normalize MAC_STATUS record To: Richard Guy Briggs Cc: Linux-Audit Mailing List , LKML , SElinux list , Linux Security Module list , Eric Paris , Steve Grubb Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 17, 2018 at 6:09 PM, Richard Guy Briggs wrote: > 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. Yes, it was a pretty big change, but it sets the stage for a few things we are trying to do with SELinux. Regardless, thanks for giving the merge a quick look. -- paul moore www.paul-moore.com