Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1874227imm; Thu, 19 Jul 2018 09:11:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6kcbCR5XwAtxYw1M1dQfWA0va7ACVuCpc8OWoU8/Qb8wLPp2eu0XGhGU9SFCnJog7mLz6 X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr10607630pll.343.1532016704031; Thu, 19 Jul 2018 09:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532016704; cv=none; d=google.com; s=arc-20160816; b=brd9HAY8Vl+FYKAegiRxYUzyngQh2Y8R7TivI9NNkXwISq6QaTwkhUB6uc+7H5cOoW e6WjhuCQn/2X9UeQPusMAMevz7cWfXEAAS1CO5hDaKv/GyB8mb55gt5RLGfp+tna5Ly4 pzj1A4+ZKgJ8TRAgdSl1CAFBsxRzfwu5Soekxs514g6xMpj/JOTw4nbfARWy8905cBxv L4Hn31jkaQCK0nXuy/sVIOCpBKXVisdBXF8PtKKCJBI9t+2PIKRHP49Yg3swOtRhXeNR 6FnH603XXlOOj8FQZllyenhkE9p1BUk0bFlzcM5Cglb9rMBua9aNJnjLVBkTbjVNeMrL ODVg== 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=z7VUdHrkoVPn44uXwrxeoeHpPNCmIh+FY9h8uYWw+II=; b=X/wnzs7+soi+pQaU1GNI4fX/7DlFS4tzQjKYjw3v4BGkI2+n3KiGxJ/rPqebgj0Lan TkcDo5EX3CaiGbz6lu6q/ReL+7ZPohVLjTW/G2wFZu+KfL2eDlEoZY1K5zDoB31CHN5C 6ahPb3YMEiDBBBfYIoIjmwnCxyKJrENtS7+YZYqULwWgVoClQFgzh7Gnf7sbvGwBTx8N BtUrShfykbibeQ/WZYOIyRr7m3Jj2cOAq34z6R0+a9lWj2ssQHwntNAZAWM6ZqQXfi2+ sibqXHcekMq+nS5eju/vER3VwCJpA2cy+MeqW4w35ma5gfZS1u1hA9TgltejEjfxSqSo 0lIw== 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 6-v6si5968054pgz.592.2018.07.19.09.11.27; Thu, 19 Jul 2018 09:11:44 -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 S1731931AbeGSQyo (ORCPT + 99 others); Thu, 19 Jul 2018 12:54:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35028 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731645AbeGSQyo (ORCPT ); Thu, 19 Jul 2018 12:54:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F137040704A7; Thu, 19 Jul 2018 16:10:51 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-54.rdu2.redhat.com [10.10.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B6061C640; Thu, 19 Jul 2018 16:10:46 +0000 (UTC) Date: Thu, 19 Jul 2018 12:08:03 -0400 From: Richard Guy Briggs To: Paul Moore Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org, Eric Paris , sgrubb@redhat.com, aviro@redhat.com Subject: Re: [RFC PATCH ghak59 V1 1/6] audit: give a clue what CONFIG_CHANGE op was involved Message-ID: <20180719160803.7faw2feelfkunysa@madcap2.tricolour.ca> References: <17f22b579c28c6cd9475a57e792b5d4fb4dde1dc.1529003588.git.rgb@redhat.com> <20180713004122.qlxdpkae4ihkxatg@madcap2.tricolour.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180512 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 19 Jul 2018 16:10:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 19 Jul 2018 16:10:52 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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-07-18 17:45, Paul Moore wrote: > On Thu, Jul 12, 2018 at 8:43 PM Richard Guy Briggs wrote: > > On 2018-06-28 15:41, Paul Moore wrote: > > > 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 > > > :) > > > > The version I'm looking at already had it when it was added in 2009. > > Yup, there it is ... now I'm wondering what tree I was looking at as a > reference while reviewing this? > > /me scratches head > > > This one doesn't add the auid and ses fields because they will be > > covered by the linking of this record with the syscall record via the > > audit_context() introduced in another patch. > > Yeah, I'm not concerned about that for the reasons you state. > > > > and one more in audit_receive_msg(). There may be more. > > > > I believe they're covered by other patches in the ghak59 set. > > If they are in the later patches it might be good to move those "op=" > additions into this patch. I don't see any CONFIG_CHANGE records generated in audit_receive_msg() that are missing op= field. Can you narrow it down? > > > > 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 > > > > - 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 > > > > -- > 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