From patchwork Mon Jun 5 16:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roberto Sassu X-Patchwork-Id: 13267799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97DC5C7EE23 for ; Mon, 5 Jun 2023 16:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbjFEQ4i (ORCPT ); Mon, 5 Jun 2023 12:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjFEQ4h (ORCPT ); Mon, 5 Jun 2023 12:56:37 -0400 Received: from frasgout13.his.huawei.com (unknown [14.137.139.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DBBDE6 for ; Mon, 5 Jun 2023 09:56:35 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.227]) by frasgout13.his.huawei.com (SkyGuard) with ESMTP id 4QZfcy37TJz9ypbn for ; Tue, 6 Jun 2023 00:46:10 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP1 (Coremail) with SMTP id LxC2BwDXU_+pE35kXiQSAw--.3839S2; Mon, 05 Jun 2023 17:56:16 +0100 (CET) From: Roberto Sassu To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com Cc: linux-integrity@vger.kernel.org, vt@altlinux.org, pvorel@suse.cz, stefanb@linux.ibm.com, paul@paul-moore.com, casey@schaufler-ca.com, Roberto Sassu Subject: [PATCH v2 ima-evm-utils 0/4] Simple EVM HMAC calculation tests Date: Mon, 5 Jun 2023 18:55:50 +0200 Message-Id: <20230605165554.1965238-1-roberto.sassu@huaweicloud.com> X-Mail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07UWE__UUUUU= X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQATBF1jj4467QAAs+ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org From: Roberto Sassu Add two simple tests to check whether or not the HMAC calculated by the kernel and evmctl matches. Do the tests for a regular file, and for a directory successfully transmuted with Smack. Also add two bug fixes to include the filesystem UUID and the inode generation in the HMAC calculation, and the new option --hmackey to specify an alternate location of the HMAC key. Changelog v1: - Add documentation for --hmackey option of evmctl (suggested by Mimi) - Update kernel configuration for CI - Include inode generation in HMAC calculation for directories - Specify kernel patches required for the tests (suggested by Mimi) - Move xattr compare code to compare_xattr() - Add new Smack-specific test to check HMAC of transmuting directory (suggested by Mimi) - Check in the test that the --hmackey option is available (suggested by Mimi) - Remove i_version mount option (should be default in ext4) - Mount smackfs if the UML kernel is used Roberto Sassu (4): Include the filesystem UUID in HMAC calculation Restore correct HMAC calculation for directories Add --hmackey option for evmctl Add simple test to check EVM HMAC calculation README | 3 +- kernel-configs/base | 4 +- kernel-configs/integrity | 1 + src/evmctl.c | 31 ++++- src/imaevm.h | 1 + tests/Makefile.am | 2 +- tests/evm_hmac.test | 251 +++++++++++++++++++++++++++++++++++++++ tests/functions.sh | 6 + 8 files changed, 293 insertions(+), 6 deletions(-) create mode 100755 tests/evm_hmac.test