Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1344919imm; Wed, 25 Jul 2018 16:33:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYCnrtMIFrtdIoj0Lmp61J1XKsJmEw5qs6Wi2ZDGcnzKhJkdThkx2jWp/4iYZYy3N5aTIt X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr23097563plb.80.1532561606366; Wed, 25 Jul 2018 16:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532561606; cv=none; d=google.com; s=arc-20160816; b=iqynLBpQI8jxXq5cRiap+AHrLrn0bZiwCMwpEuwK5evUEKbQx8/gvF9xlF2pOMAF0h UjFm4nyqfs0PN3/sty+iZtGv2Vo3S3lIjBEMxm0qzwANkWHY7xxdZQnb2ZWh8Ib3a13K 7BfhKiVvyTc6gQ6zlezEQBaS7ZUhwhyweV7L0wkzBkOU+usBPzl61i11DKtK2vqYb19i st+S7KpTIaPniRZ2/AwsEEZs07OpUzpIZn9puDDLoHuECoWlQ2V6poup5gDR1tincuUc ojefRtQPgAQv/zqsOs1zXO1Cu5g8qaIuFtwb/37gimHf9nv+FG+nrsvYm+q2cj8lslIT aD2g== 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=fvt5jSWNn+Bb2qPJwTw4qSLaeJAeRGxd7B99yNl6bKI=; b=N3YGGJFvb/tX9UoZ630mbtI8ML5B49VY32pG2DIJHdefBTsnjYom/GaahMIMQNIYqd LvgKLMwavUbKMA1BwTZc7AjEkqUoJUfQSjQIbOIjW8OI/t9ub0kkoiS0Lbve+1qUseuP odmKuu+q/NpzF5WsE0WbPegf+5cvWcj/hzztP7SwflNYTgirtNK2V8BohgVpPv1Nmp/W Ye2bJ1bRNVCKZwjhIvX5YI+ckPr00+PJAKqDpxoIFxEw8/bLsfNkyc6LJjDLwE1if85f SJVE+zwi1ChHbUiXYD6N14ai1eO8sslsaJkCzM6ILZHUE9xdESaSSq5/cDuSHPHkzEXa 6WZQ== 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 w26-v6si15668764pgk.372.2018.07.25.16.33.11; Wed, 25 Jul 2018 16:33:26 -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 S1731825AbeGZAqP (ORCPT + 99 others); Wed, 25 Jul 2018 20:46:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57468 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731816AbeGZAqO (ORCPT ); Wed, 25 Jul 2018 20:46:14 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6PNTagv020826 for ; Wed, 25 Jul 2018 19:32:16 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kexu6gnp3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Jul 2018 19:32:15 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Jul 2018 00:32:13 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 26 Jul 2018 00:32:10 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6PNW9YU22806674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Jul 2018 23:32:09 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF1FEAE051; Thu, 26 Jul 2018 02:32:16 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83034AE045; Thu, 26 Jul 2018 02:32:15 +0100 (BST) Received: from yorha.ibmmodules.com (unknown [9.80.225.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 26 Jul 2018 02:32:15 +0100 (BST) From: Eric Richter To: linux-integrity Cc: linux-security-module , linux-efi , linux-kernel , David Howells , Seth Forshee , Justin Forbes , Nayna Jain Subject: [PATCH 2/4] ima: add support for external setting of ima_appraise Date: Wed, 25 Jul 2018 18:31:58 -0500 X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180725233200.761-1-erichte@linux.vnet.ibm.com> References: <20180725233200.761-1-erichte@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18072523-0012-0000-0000-0000028ED4F0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072523-0013-0000-0000-000020C0BE96 Message-Id: <20180725233200.761-3-erichte@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-25_06:,, 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-1806210000 definitions=main-1807250240 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nayna Jain The "ima_appraise" mode defaults to enforcing, unless configured to allow the boot command line "ima_appraise" option. This patch allows the "ima_appraise" mode to be defined based on the arch setting. Signed-off-by: Nayna Jain --- security/integrity/ima/ima.h | 5 +++++ security/integrity/ima/ima_appraise.c | 11 +++++++++-- security/integrity/ima/ima_policy.c | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index 588e4813370..6e5fa7c4280 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h @@ -248,6 +248,7 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, int xattr_len); int ima_read_xattr(struct dentry *dentry, struct evm_ima_xattr_data **xattr_value); +void set_ima_appraise(char *str); #else static inline int ima_appraise_measurement(enum ima_hooks func, @@ -290,6 +291,10 @@ static inline int ima_read_xattr(struct dentry *dentry, return 0; } +static inline void set_ima_appraise(char *str) +{ +} + #endif /* CONFIG_IMA_APPRAISE */ /* LSM based policy rules require audit */ diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 8bd7a0733e5..e061613bcb8 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -18,15 +18,22 @@ #include "ima.h" -static int __init default_appraise_setup(char *str) +void set_ima_appraise(char *str) { -#ifdef CONFIG_IMA_APPRAISE_BOOTPARAM if (strncmp(str, "off", 3) == 0) ima_appraise = 0; else if (strncmp(str, "log", 3) == 0) ima_appraise = IMA_APPRAISE_LOG; else if (strncmp(str, "fix", 3) == 0) ima_appraise = IMA_APPRAISE_FIX; + else if (strncmp(str, "enforce", 7) == 0) + ima_appraise = IMA_APPRAISE_ENFORCE; +} + +static int __init default_appraise_setup(char *str) +{ +#ifdef CONFIG_IMA_APPRAISE_BOOTPARAM + set_ima_appraise(str); #endif return 1; } diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index b47db4d7fea..402e5bd1093 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -573,8 +573,11 @@ void __init ima_init_policy(void) * (Highest priority) */ arch_policy_entries = ima_init_arch_policy(); - if (arch_policy_entries > 0) + if (arch_policy_entries > 0) { pr_info("Adding %d architecture policy rules.\n", arch_policy_entries); + set_ima_appraise("enforce"); + } + for (i = 0; i < arch_policy_entries; i++) { struct ima_rule_entry *entry; -- 2.14.4