Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp467584imm; Fri, 14 Sep 2018 01:03:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaYNbszHz+WwlSXtZLWUFcTeMXaaecGciXHkwDy4twgta5Sk3LjiQ2Nl5SoM5ELc+kmvul3 X-Received: by 2002:a65:5144:: with SMTP id g4-v6mr10379419pgq.21.1536912230822; Fri, 14 Sep 2018 01:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536912230; cv=none; d=google.com; s=arc-20160816; b=bsMHpfaOmRGYqVPuXrumagc19nbr9GAMz5VLBSynhbfpSdYgOfr+q7IiYYNAjHi1/w 0UgZB5/R8/YB7O3UiEs3CTNkD+eGkhxOU5EcWPKcH/RjUOFtqysbrOy0HFSQ0SsUFsKh Rwc8TwU9hlcJ5k8Vm6u3cthBraOiZemVh+1le9YpiqSxmDwEXpUajpM8vB1X0S2OdJyg 3ZGIBb6T1uYSUEoX6oYb5U2RO7RLGigRTjW7ZOrbACKwwyL7kJGgGSvdSk7V+4hi33jk qW91VhnjYD5JjxWO3oJv8ft+I4RBetsZnsEQLOHoJ0aL9/Tm9umjY0Low8OA+Vi3YCov 85Xg== 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; bh=5vHpjZsJJQBsGUi0xnjUJYUaz/mnGFrDD5RiynG1IyM=; b=ePbhFbk7JcUW4U/npuoFeEMKrrqfyftXVM1E+8nu6GxnUgCHxWD5w6jxvD7sG1d9QR 2oKSZYDZHCVcgtXIKHCDRW5kFby80sQoS+jDQVp+SenPT6UOwdV2sFabZfF5YYOMhxUh j9c3tgDCOO/EvuICcHblkmO9QLaNVowOF7OSrdZWJjB9arvKAh42BPJQtGIcFrWLPFWq jDQsyeWDZTZU6ZYAqzCIfJX3JLKKqTJb8z6r3BjVq/J6UV9mD2nVMv72jRWRHB1XKg9G u+KhnagpV68GVPWh/B2pQAhfFjFrTyaMMIVe6w/7pGcZopUjvWxJHPwS5rj1rwCmIVlh DUag== 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 u4-v6si6962248plj.134.2018.09.14.01.03.36; Fri, 14 Sep 2018 01:03:50 -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 S1728240AbeINNQe (ORCPT + 99 others); Fri, 14 Sep 2018 09:16:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50920 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727881AbeINNQe (ORCPT ); Fri, 14 Sep 2018 09:16:34 -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 w8E7xCNR059279 for ; Fri, 14 Sep 2018 04:03:16 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2mg5u7y3pf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Sep 2018 04:03:16 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Sep 2018 09:03:14 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 14 Sep 2018 09:03:10 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8E8399U62324896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 14 Sep 2018 08:03:09 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ECD0B42052; Fri, 14 Sep 2018 11:02:59 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81F854204C; Fri, 14 Sep 2018 11:02:58 +0100 (BST) Received: from swastik.in.ibm.com (unknown [9.124.31.41]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 14 Sep 2018 11:02:58 +0100 (BST) From: Nayna Jain To: linux-integrity@vger.kernel.org Cc: zohar@linux.ibm.com, linux-security-module@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, jforbes@redhat.com, Nayna Jain Subject: [PATCH v2 5/6] ima: add support for external setting of ima_appraise Date: Fri, 14 Sep 2018 13:30:04 +0530 X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180914080005.6138-1-nayna@linux.vnet.ibm.com> References: <20180914080005.6138-1-nayna@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18091408-0020-0000-0000-000002C630D7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18091408-0021-0000-0000-000021139125 Message-Id: <20180914080005.6138-6-nayna@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-14_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 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-1807170000 definitions=main-1809140085 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "ima_appraise" mode defaults to enforcing, unless configured to allow the boot command line "ima_appraise" option. This patch explicitly sets the "ima_appraise" mode for the arch specific policy 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 588e4813370c..6e5fa7c42809 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 8bd7a0733e51..e061613bcb87 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 23f3aa214016..c574841bcc9a 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -585,9 +585,12 @@ void __init ima_init_policy(void) arch_entries = ima_init_arch_policy(); if (!arch_entries) pr_info("No architecture policies found\n"); - else + else { add_rules(arch_policy_entry, arch_entries, IMA_DEFAULT_POLICY | IMA_CUSTOM_POLICY); + if (temp_ima_appraise) + set_ima_appraise("enforce"); + } /* * Insert the builtin "secure_boot" policy rules requiring file -- 2.13.6