Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1506777ybb; Thu, 9 Apr 2020 03:35:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIJGGnudLc5v6MjmiCmwYoz5wTcVT1cdrupg4OKeeSIM72IF0eSyIY5Au1ymXzmmXu3DDdU X-Received: by 2002:a05:6830:4025:: with SMTP id i5mr9562947ots.203.1586428538864; Thu, 09 Apr 2020 03:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586428538; cv=none; d=google.com; s=arc-20160816; b=IUTaZJdwtmqTrjKGa72rlLLYwP4GMr1yljAYIIdgEqAO2TU6785c8Ax/HZXLQo0/4N fFWuLJNgEmhTav/W0uPrbeo23lwj+lW1/M2nexkFDXRyCq3k1XKu0t1hjhJNNxbcKMqb eksiSoiRIo2svgmrC2HRPuJksAYnFOtNvz9bcRop1jwK2a+P1ob44IkoUfBBneSenLHO UtzoF9HKdd4A4sPgB8RhrIn+eq+U7B7832zeT+J8hNZ8XMI0VVV11wa034kt/VV0PraA j/Lyn2DcOLTl9vqo6PveZ7oEwIioPHpj505jTZHwt6fZd6kAg73coj6eqcbSwPVnHzZr G45Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=b6+tI0CjyAr6J4EmzvfnyCk6iipIoFvxPhty50Ocb+M=; b=CMYdOKIXSiFosN3rzGN3D8vX0LK0sbUtulazuxnlPUyyc46OmeUTQPjg0/v/J3sknN EKFHF9xCFEeF1M1l+jfLokQTqW6g2ZHse25sU+QYhTZw7La7o7VOj/cxUnpgiRJ5gPHl nKsYbCG3mPNgZpR2RVrsP/Ae0yAXMX28os11N93v207LDDkneoiZIKlA/ZNjADzOhpkR P3k8atKYqxjoI4tn5dg7bI1ywiQocMzzbM489gf0evT+KqgxFxfgSn5An65dr3RhpwUC LMSCHAeCP7cw/pMHvZHBUh6jnSi+8t0r/UKSXOtKw32OY0yeqvMiuLZopvwRjG7o6bIA S2Uw== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g144si3804619oib.40.2020.04.09.03.35.25; Thu, 09 Apr 2020 03:35:38 -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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgDIKes (ORCPT + 99 others); Thu, 9 Apr 2020 06:34:48 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:50441 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbgDIKer (ORCPT ); Thu, 9 Apr 2020 06:34:47 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R891e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01419;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0Tv2Jng._1586428480; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0Tv2Jng._1586428480) by smtp.aliyun-inc.com(127.0.0.1); Thu, 09 Apr 2020 18:34:41 +0800 From: Tianjia Zhang To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, zhangliguang@linux.alibaba.com, zhang.jia@linux.alibaba.com Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, tianjia.zhang@linux.alibaba.com Subject: [PATCH v2 0/2] support to read and tune appraise mode in runtime Date: Thu, 9 Apr 2020 18:34:38 +0800 Message-Id: <20200409103440.47946-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Support the read and write operations of ima_appraise by adding a securifyfs file 'appraise_mode'. In order to tune appraise mode in runtime, writing a PKCS#7 signature corresponding the signed content is required. The content should be off, enforce, log or fix. Given a simple way to archive this: $ echo -n off > mode $ openssl smime -sign -nocerts -noattr -binary \ -in mode -inkey \ -signer -outform der -out mode.p7s $ sudo cat mode.p7s \ > /sys/kernel/security/ima/appraise_mode Note that the signing key must be a trust key located in system trusted keyring. So even the root privilege cannot simply disable the enforcement. --- v2 change: fix build error. Tianjia Zhang (2): ima: support to read appraise mode ima: support to tune appraise mode in runtime security/integrity/ima/ima_fs.c | 140 +++++++++++++++++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) -- 2.17.1