Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp106030imm; Mon, 4 Jun 2018 13:56:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEjJY9Z/Lww+JEn5XGygwZqBbbAd55WsSHbVFrYpLLu/2aq9lEdtxKbtbmMSP1rjHNKHD/ X-Received: by 2002:a17:902:b611:: with SMTP id b17-v6mr23183921pls.284.1528145815308; Mon, 04 Jun 2018 13:56:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528145815; cv=none; d=google.com; s=arc-20160816; b=uBtX/iCZ/rhEWr+f4BQcsgQVU1PGiEIB1tLxr2XRonjcHpJtH2LXIzeGJCZqYOt1xE Om7ZPWUqr63YTB2JUCBCX99BTGncvXhs6phlmMwg9fiZMJosXza6PaafS0j1xDM/VG/6 F2VjhTI0g5gWftqOdnNJlCKUTObZsnESdifGmkZ+yanL5/idwnpesZ68glwQiQk4A1re RQcp2M+g5AOWi2PXhPmnkj/ocW/ZnWwKD2zsf0RYtqXaHxIyifqahT/Ket4C/7JClPKg x32KItjwnef0BpMrkcLr7eiX3CDttCOn5ZYYzwv7VzmTln74CM6uRsvckJVg5+wP37y0 j0jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=9pvCgAVfde+0Tn5HabKEwN10LLLhPgEcIGI6fFHh+EQ=; b=Kcw2f5FAWD3JNRXKpu/jml6QWaPb+/KhCQH5ATSrvKcVRAylJoK4d8QjpJD5PWKTva s8TCVlySIYw+2jhVQT3eqetkfOx7MBhFl+2Ak7VNmnlsWl8RY0Grp7Rlh8qbgL9wvU1y QGvjdmijeFl/5qUC3qihH/akg7puleKlPdvkJkLk7KveSUjWUBWK3IWIijcQB3GjPHFR oEmN6JCUXz8LG4ERfp8yDiTe/a6+Fcx3FYGOe2TiL4Wo3XKhPBpMd+iOA8Y340EAlCFk //SHtV19smjtYmSqfo6C3SxXKpuaeFw0S1GfboD7T857T5gbKWHTE6doo1jalheoKhss DLsQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z26-v6si47521975pfd.26.2018.06.04.13.56.39; Mon, 04 Jun 2018 13:56:55 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751619AbeFDUzw (ORCPT + 99 others); Mon, 4 Jun 2018 16:55:52 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34864 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751427AbeFDUzK (ORCPT ); Mon, 4 Jun 2018 16:55:10 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w54Kic4g018770 for ; Mon, 4 Jun 2018 16:55:10 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 2jd9k1r004-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Jun 2018 16:55:10 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Jun 2018 14:55:09 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Jun 2018 14:55:06 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w54Kt51746137514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Jun 2018 13:55:05 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A56026E052; Mon, 4 Jun 2018 14:55:05 -0600 (MDT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 017746E04E; Mon, 4 Jun 2018 14:55:05 -0600 (MDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 4 Jun 2018 14:55:04 -0600 (MDT) From: Stefan Berger To: zohar@linux.vnet.ibm.com, paul@paul-moore.com, linux-integrity@vger.kernel.org, linux-audit@redhat.com Cc: sgrubb@redhat.com, linux-kernel@vger.kernel.org, Stefan Berger Subject: [PATCH v3 4/4] ima: Differentiate auditing policy rules from "audit" actions Date: Mon, 4 Jun 2018 16:54:55 -0400 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180604205455.2325754-1-stefanb@linux.vnet.ibm.com> References: <20180604205455.2325754-1-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060420-0016-0000-0000-000008E299DD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009129; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01042340; UDB=6.00533730; IPR=6.00821470; MB=3.00021461; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-04 20:55:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060420-0017-0000-0000-00003F193406 Message-Id: <20180604205455.2325754-5-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-04_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806040238 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The AUDIT_INTEGRITY_RULE is used for auditing IMA policy rules and the IMA "audit" policy action. This patch defines AUDIT_INTEGRITY_POLICY_RULE to reflect the IMA policy rules. Since we defined a new message type we can now also pass the audit_context and get an associated SYSCALL record. This now produces the following records when parsing IMA policy's rules: type=UNKNOWN[1807] msg=audit(1527888965.738:320): action=audit \ func=MMAP_CHECK mask=MAY_EXEC res=1 type=UNKNOWN[1807] msg=audit(1527888965.738:320): action=audit \ func=FILE_CHECK mask=MAY_READ res=1 type=SYSCALL msg=audit(1527888965.738:320): arch=c000003e syscall=1 \ success=yes exit=17 a0=1 a1=55bcfcca9030 a2=11 a3=7fcc1b55fb38 \ items=0 ppid=1567 pid=1601 auid=0 uid=0 gid=0 euid=0 suid=0 \ fsuid=0 egid=0 sgid=0 fsgid=0 tty=tty2 ses=2 comm="echo" \ exe="/usr/bin/echo" \ subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null) Signed-off-by: Stefan Berger --- include/uapi/linux/audit.h | 1 + security/integrity/ima/ima_policy.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 65d9293f1fb8..cb358551376b 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h @@ -148,6 +148,7 @@ #define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */ #define AUDIT_INTEGRITY_RULE 1805 /* policy rule */ #define AUDIT_INTEGRITY_EVM_XATTR 1806 /* New EVM-covered xattr */ +#define AUDIT_INTEGRITY_POLICY_RULE 1807 /* IMA policy rules */ #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index bc99713dfe57..f7230db217a7 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -652,8 +652,8 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) bool uid_token; int result = 0; - ab = integrity_audit_log_start(NULL, GFP_KERNEL, - AUDIT_INTEGRITY_RULE); + ab = integrity_audit_log_start(current->audit_context, GFP_KERNEL, + AUDIT_INTEGRITY_POLICY_RULE); entry->uid = INVALID_UID; entry->fowner = INVALID_UID; -- 2.13.6