Received: by 10.192.165.156 with SMTP id m28csp339373imm; Mon, 16 Apr 2018 00:34:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/scUQ21KU390FANcLf76AedOlHd0TMyx8Dcy2sTOEwa90dxmOmP/bp5HBHvY8zEzOFD1H6 X-Received: by 2002:a17:902:206:: with SMTP id 6-v6mr14364685plc.376.1523864097851; Mon, 16 Apr 2018 00:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523864097; cv=none; d=google.com; s=arc-20160816; b=AwA1uTUORSWga3BCSRYcg6+ObEsWQBpH6uFfvLzTWUUeP/2BreqkUxjhVzwvzHyY0x /zqfGS3Kj/m54ACofu94IM2K6jXLqLNNJdad7HkjMCluV62e1CUNsbXKaLL6Q4udM345 ePXvtbzQueldIi+v1ee3tBG7kAwJil3NOpYMLZa6eprilSVIkhWnsJRSpiElVJagMWv+ nVJCACpi7DldA13cQbGVJaHop9OYB9zLtqE2/N0YB/QmqGGeGOgc1NiOfAXOwuu6YsGV 35oHYcLOI8Pnkko1RzFhumH4QLVghRpnVhaenoPLl6H8H9PONFovwEOOU/RA7JZ6ESLX Hn3Q== 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:arc-authentication-results; bh=6tFGIdPVJw4zgfYOA9NwmslgEZQVsPObArRuL8O6TMo=; b=FEwXCMwsoX145rVbMKgJ2KVScEfA8Fx+qfUz8YNRdtdLax9IWS18XXHTcXNUSD0Hz2 vhalMVwCNSH02Jfb44lEW5mWRC9+KNpiRe4dLlUFReXvY5kOv7PflkEsGImDKdQiJVZV d30qHzypwvNAjOs76yYoAXI4vG5zZChJ+EqCxCr4sPSkg0CV5tCQJsJT3sYsb2puLl2o bCFRrxBIsFnSJoWL8QHt7nzoo/yfcETwKeVoAeW5L0dIc38A7sYhOiau8QCDxLZ07oDN 9cD7Qh7pTxQKXbtqfKILE8URkyNYD0VL0vpoNZ2Wl//XJy6lm7QuRsDUXdLbwRYo0OSA tytg== 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 f14si9541093pgr.486.2018.04.16.00.34.43; Mon, 16 Apr 2018 00:34:57 -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 S1754016AbeDPH0u (ORCPT + 99 others); Mon, 16 Apr 2018 03:26:50 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:42672 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753994AbeDPH0k (ORCPT ); Mon, 16 Apr 2018 03:26:40 -0400 Received: by mail-oi0-f66.google.com with SMTP id 26-v6so4046906ois.9 for ; Mon, 16 Apr 2018 00:26:39 -0700 (PDT) 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=6tFGIdPVJw4zgfYOA9NwmslgEZQVsPObArRuL8O6TMo=; b=baRYjNv2Jh6tYlZ3uV4oldrYSIf2rzUll9nm7E8M/nXBauYhoRaD3QqGd4QfCiL7jG 7ZZXkJ94aHVBAxrdY7xX2V3UyBJA1oVYoVaI0F5AJQByN+jp76Kg4zqTPgMzN4dQLyK+ 3uDmgMIe0ngRlOwixcqwo5QoM6ySMNwq53cFuZQkxjrqtC3wc7OYt7vC3zkQpKoCufnu zI5yhHJ73wEZWUPor0FFYMg24KdzJ2ZEKuh3LEPJKGgPo+F2C2iHeSe+TJtdmaFQRyM+ 6iN5ZWiIABp9dnIwBtaE3t/3QElovmx2IlnqwCaNTGgvG/NpgLkgi9Ti7tS/+uD3CWne 2m/w== X-Gm-Message-State: ALQs6tAeATxHeGZJ6PZRVy1bH/L5dr7ZrgBvR4Qzq3LAJTFnOc8+JP/z 8+kdLXHc51bwtxhWlOPjZ2SW237uf2MIJdQ4RJ7IfmqGPII= X-Received: by 2002:aca:e008:: with SMTP id x8-v6mr13627144oig.345.1523863599358; Mon, 16 Apr 2018 00:26:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.154.70 with HTTP; Mon, 16 Apr 2018 00:26:23 -0700 (PDT) In-Reply-To: <6b939250a519668af109adf877d85ff018b217d7.1523316267.git.rgb@redhat.com> References: <6b939250a519668af109adf877d85ff018b217d7.1523316267.git.rgb@redhat.com> From: Ondrej Mosnacek Date: Mon, 16 Apr 2018 09:26:23 +0200 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 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 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? Just my two cents... > 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; > -- > 1.8.3.1 > > -- > Linux-audit mailing list > Linux-audit@redhat.com > https://www.redhat.com/mailman/listinfo/linux-audit -- Ondrej Mosnacek Associate Software Engineer, Security Technologies Red Hat, Inc.