Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp344662imm; Thu, 28 Jun 2018 21:47:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzw2Fn1Aj98ohmpGIKQY8K+VnyQRqlxnkJ4AYc40vqIGccRxeRwObDedFbR1cllArXwQUq X-Received: by 2002:a17:902:5a0c:: with SMTP id q12-v6mr13117495pli.300.1530247672644; Thu, 28 Jun 2018 21:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530247672; cv=none; d=google.com; s=arc-20160816; b=qV5uBsjLLKU8Ve9D3KUlEVM3ujbw5XKcr3mQDR7WQfrYJ3l3i1Lwvwt+2sFsJsyLiM /Vrvly9M+vpeWpl7o2XTrjGCXBMOmgQ2YM6I76gJfjlDefQCHlFMB+a90ont/4JbgVru SkLK5Ua5cF7b0nggPfm0rt0sVuYS+WgxIuJKoImLnsSJ5LZr8o+KScceKJSIp6HYLibb FggD83Q/OBX0HGi0BaqCHsL0I1NiImMdjuQb4T0oXYU5JvZQ6ia2d/v+XWAnOlL/Ug9l stCP2WeLUetUemWxa9CNaLxcug2HjnSGjdLy6iP7oWAR/8kQsb1LA0pVcRmzBGSiopQO xy6A== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=w5P0hZ5qeVerJPWSrkgklM7HL5mxKSLKR1TKQ5TC19I=; b=QMGI4H3ewUOn4vwEecOVPqDKHsburSg7EvBDse+S8HcV0x3dDwwaNOM+i06qWC6KYx 2xZlcPLh9qP5Cb4WLpQLSkfUHPojeMTtQGJsjDK83lP7QxEDCaLZrAxS8DeFSRv4gpLq hNXw22EmH0S4ROoXfkCPu7FuNgTvp1gGga8vIIhIOabZcpytXOVLH6ctiXZZVdRtCZPX 91KaS9dmyJlEcslFn2gEK3AKNgn45I/+T22J2uDY/c2dzd5YlQkXAaeG9Lvbg5IRZNM/ 8aDR0vzW1RtoxhP09XgW7RTp5AqW0YF+o87FhLiAi75vkGDA10XuQ9NzQDump0mz37w5 8GPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=1ibThO7f; 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 e128-v6si5053582pfg.35.2018.06.28.21.47.38; Thu, 28 Jun 2018 21:47:52 -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=1ibThO7f; 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 S934832AbeF1Tln (ORCPT + 99 others); Thu, 28 Jun 2018 15:41:43 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:41996 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934012AbeF1Tlm (ORCPT ); Thu, 28 Jun 2018 15:41:42 -0400 Received: by mail-lf0-f68.google.com with SMTP id u202-v6so5074812lff.9 for ; Thu, 28 Jun 2018 12:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w5P0hZ5qeVerJPWSrkgklM7HL5mxKSLKR1TKQ5TC19I=; b=1ibThO7fdp5K48/2Ar4DIOZH0cPD0VBs9XA0WRQDtpYZWpcv/KSz0dvO+CGzur9MuB osYWtWiw/prpeE1hPxjLUs5cC8TNg0ekBAi9+zob/g53QT3PARnuwA8+lp+slqQP4TNy hGrxkOOyqrqoIFcacaKSZ5jQqmUuTBmm0Q9Iw72EEvUGRDCT++3+lH9MC9B9LRQi0uMy bSI0ZqM4HADl4sfryxybsgESySwP2mntdCY4iijPspIBP/bsY2Lz9gEvo8YidvQdJ1KZ EXPt/R3OH0bPML2Z27Mu9TmOKOBbHHr62TLX2n6NaTgVnc5kuKAlkJwzZIOQ3rspPPP0 8BcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w5P0hZ5qeVerJPWSrkgklM7HL5mxKSLKR1TKQ5TC19I=; b=BUgyUi4BQswpthnP9r1a/1CjhIJD5b+SNqUfvTBGUAhubVlQj1LucKmTaIG5tSg7Hx GlcW9w6g6AkamIQYDuwIv1LhWzKLERFg/1RjTz3JSxKxF+sXj7yd+TW92TLT9I78TJZk Bq4SvF78UpYxo7lUxTWSeCoE/d7+DwYniflbVhtGbtthtij/s1qm900ktpYVYrSCwINp cib0MHmxwSHOEcOnL/Zgct+CwlDcI6wuBkg+Al12UzG/j9XMgASTg13/ceR+SFAH/BFf wexMVqVEm3BGg4buJcRJNysiTRCOSsWfOX0FUXxP0JSXYqQ2YXoggkZLOVB/71Wez7Mv odcg== X-Gm-Message-State: APt69E2FDz2EdkhpS23ISKcLHm4NaRVy0LWIPOeBOoZFYlhVYw6o346I m3tLM91W15E2y8A4Ez+6/1dpNKGgYdOSlenWw/Wd X-Received: by 2002:a19:d754:: with SMTP id o81-v6mr7569956lfg.124.1530214900195; Thu, 28 Jun 2018 12:41:40 -0700 (PDT) MIME-Version: 1.0 References: <17f22b579c28c6cd9475a57e792b5d4fb4dde1dc.1529003588.git.rgb@redhat.com> In-Reply-To: <17f22b579c28c6cd9475a57e792b5d4fb4dde1dc.1529003588.git.rgb@redhat.com> From: Paul Moore Date: Thu, 28 Jun 2018 15:41:28 -0400 Message-ID: Subject: Re: [RFC PATCH ghak59 V1 1/6] audit: give a clue what CONFIG_CHANGE op was involved To: rgb@redhat.com Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org, Eric Paris , sgrubb@redhat.com, aviro@redhat.com 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 Thu, Jun 14, 2018 at 4:23 PM Richard Guy Briggs wrote: > The failure to add an audit rule due to audit locked gives no clue > what CONFIG_CHANGE operation failed. > Similarly the set operation is the only other operation that doesn't > give the "op=" field to indicate the action. > All other CONFIG_CHANGE records include an op= field to give a clue as > to what sort of configuration change is being executed. > > Since these are the only CONFIG_CHANGE records that that do not have an > op= field, add them to bring them in line with the rest. Normally this would be an immediate reject because this patch inserts a field into an existing record, but the CONFIG_CHANGE record is so variable (supposedly bad in its own right) that I don't this really matters. With that out of the way, I think this patch is fine, but I don't think it is complete. At the very least there is another CONFIG_CHANGE record in audit_watch_log_rule_change() that doesn't appear to include an "op" field. If we want to make sure we have an "op" field in every CONFIG_CHANGE record, let's actually add them all :) There appears to be another one in audit_mark_log_rule_change() ... and one more in audit_receive_msg(). There may be more. > Old records: > type=CONFIG_CHANGE msg=audit(1519812997.781:374): pid=610 uid=0 auid=0 ses=1 subj=... audit_enabled=2 res=0 > type=CONFIG_CHANGE msg=audit(2018-06-14 14:55:04.507:47) : audit_enabled=1 old=1 auid=unset ses=unset subj=... res=yes > > New records: > type=CONFIG_CHANGE msg=audit(1520958477.855:100): pid=610 uid=0 auid=0 ses=1 subj=... op=add_rule audit_enabled=2 res=0 > > type=CONFIG_CHANGE msg=audit(2018-06-14 14:55:04.507:47) : op=set audit_enabled=1 old=1 auid=unset ses=unset subj=... res=yes > > See: https://github.com/linux-audit/audit-kernel/issues/59 > Signed-off-by: Richard Guy Briggs > --- > kernel/audit.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/kernel/audit.c b/kernel/audit.c > index e7478cb..ad54339 100644 > --- a/kernel/audit.c > +++ b/kernel/audit.c > @@ -403,7 +403,7 @@ static int audit_log_config_change(char *function_name, u32 new, u32 old, > ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); > if (unlikely(!ab)) > return rc; > - audit_log_format(ab, "%s=%u old=%u", function_name, new, old); > + audit_log_format(ab, "op=set %s=%u old=%u", function_name, new, old); > audit_log_session_info(ab); > rc = audit_log_task_context(ab); > if (rc) > @@ -1365,7 +1365,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) > return -EINVAL; > if (audit_enabled == AUDIT_LOCKED) { > audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE); > - audit_log_format(ab, " audit_enabled=%d res=0", audit_enabled); > + audit_log_format(ab, " op=%s_rule audit_enabled=%d res=0", > + msg_type == AUDIT_ADD_RULE ? "add" : "remove", > + audit_enabled); > audit_log_end(ab); > return -EPERM; > } > -- > 1.8.3.1 -- paul moore www.paul-moore.com