From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE3ECC04AB4 for ; Tue, 14 May 2019 17:25:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC67820850 for ; Tue, 14 May 2019 17:25:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbfENRZ7 (ORCPT ); Tue, 14 May 2019 13:25:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40288 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfENRZ6 (ORCPT ); Tue, 14 May 2019 13:25:58 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4EHMdC8032267 for ; Tue, 14 May 2019 13:25:58 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sfytc6kuv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 14 May 2019 13:25:57 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 May 2019 18:25:55 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Tue, 14 May 2019 18:25:52 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4EHPpTq8060984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 May 2019 17:25:51 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FC2142047; Tue, 14 May 2019 17:25:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4198E4203F; Tue, 14 May 2019 17:25:51 +0000 (GMT) Received: from dhcp-9-31-103-88.watson.ibm.com (unknown [9.31.103.88]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 14 May 2019 17:25:51 +0000 (GMT) Subject: Re: IMA signature generated by evmctl has unexpected key identifier From: Mimi Zohar To: Lakshmi , linux-integrity@vger.kernel.org Date: Tue, 14 May 2019 13:25:50 -0400 In-Reply-To: <90a4d769-4c32-4b2b-ceaa-6e0980d5c193@linux.microsoft.com> References: <90a4d769-4c32-4b2b-ceaa-6e0980d5c193@linux.microsoft.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19051417-0020-0000-0000-0000033CA0BD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19051417-0021-0000-0000-0000218F5E02 Message-Id: <1557854750.4139.65.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-14_10:,, 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-1810050000 definitions=main-1905140120 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Tue, 2019-05-14 at 10:18 -0700, Lakshmi wrote: > On 5/12/19 5:37 PM, nramas@linux.microsoft.com wrote: > > Hello, > > > > I am trying to test IMA signature validation using EVMCTL version 1.1 > > Am running kernel version 5.1.0 rc2 on an Ubuntu desktop. > > > > I have followed the steps given in the README below: > > https://sourceforge.net/p/linux-ima/ima-evm-utils/ci/master/tree/README > > > > I have created private\public key pair and the DER encoded certificate > > for the private key. Imported the signed DER encoded cert to IMA keyring. > > > > keyctl show %keyring:.ima > > Keyring > > 1054868458 ---lswrv      0     0  keyring: .ima > >  740136756 --als--v      0     0   \_ asymmetric: hostname: whoami signing > > key: 85512d09fc12c7f38b9679352651dcb365903336 > > > > cat /proc/keys | grep -i signing > > 2c1d9734 I--Q---     1 perm 39010000     0     0 asymmetri hostname: > > whoami signing key: 85512d09fc12c7f38b9679352651dcb365903336: X509.rsa > > 65903336 [] > > > > evmctl ima_sign -a sha256 --key /etc/keys/privkey_evm.pem > > /boot/vmlinuz-5.1.0-rc2+ > > > > In the key identifier set in security.ima attribute the key identifier > > should be 65903336 to match the key in the IMA keyring. But it is b8847de9. > > > > getfattr -d -m ima -e hex /boot/vmlinuz-5.1.0-rc2+ > > getfattr: Removing leading '/' from absolute path names > > # file: boot/vmlinuz-5.1.0-rc2+ > > security.ima=0x030204b8847de90080b06c8d5517a6afea64805c2871581b256a4efcf7ce4ba079a85545e5e70a2603596366c4e342f11052291e9b558ccb1a1208747f12c45bbe4cee59c727f308a46e951c0df9b1f6b443a8c0a4f5ac881d49e0cce9927b64eeab29c5688aba0758e5cfb30c26fd5b131c2206f1b208d48a427c53a77ae5baf98f4994a19f67b163 > > > > > > When trying to verify the IMA signature I get the following error > > > > evmctl ima_verify --key /etc/keys/x509_evm.der /boot/vmlinuz-5.1.0-rc2+ > > /boot/vmlinuz-5.1.0-rc2+: RSA_public_decrypt() failed: -1 > > error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding > > error:04067072:rsa routines:rsa_ossl_public_decrypt:padding check failed > > > > This looks very similar to the issue discussed here > > https://sourceforge.net/p/linux-ima/mailman/message/34290588/ > > > > But the bug discussed in the above thread looks to be fixed though. > > > > Am I missing something? > > > > Thank you. > > > >  -lakshmi > > > > I have tried the above on Linux kernel 4.18.0-17 as well and am seeing > the same behavior. > > I am unable to find older versions (prior to Version 1.1) of evmctl to > check if the behavior is different. Missing from this log is the list of keys on the .ima keyring. Mimi