This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2170559 - Unable to use imported IMA key on self-signed RPM.
Summary: Unable to use imported IMA key on self-signed RPM.
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: ima-evm-utils
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Coiby
QA Contact: Linqing Lu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-16 17:37 UTC by Brandon Clark
Modified: 2023-09-25 19:45 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-25 19:45:13 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-8824 0 None Migrated None 2023-09-25 19:45:09 UTC
Red Hat Issue Tracker RHELPLAN-148955 0 None None None 2023-02-16 17:39:34 UTC

Description Brandon Clark 2023-02-16 17:37:47 UTC
Description of problem:
When configuring IMA/EVM and importing a key to the IMA keyring, while the key can be successfully imported, said key is unable to be used with any self-signed RPM packages that has the key's respective certificate.

Version-Release number of selected component (if applicable):
libattr-2.5.1-3.el9.x86_64
attr-2.5.1-3.el9.x86_64
ima-evm-utils-1.4-4.el9.x86_64
keyutils-libs-1.6.3-1.el9.x86_64
keyutils-1.6.3-1.el9.x86_64

How reproducible:
Consistently

Steps to Reproduce:
1. Implement IMA/EVM via documentation (see Additional Info).
2. Create key and respective self-signed certificate.
3. Create RPM package and sign with certificate.
4. Import key to IMA keyring.
5. Attempt to install self-signed RPM.

Actual results:
Imported key is able to be utilized on it's respective self-signed RPM package.

Expected results:
Imported key is unable to be utilized on it's respective self-signed RPM package.

Additional info:
Documentation referenced is the following:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_monitoring_and_updating_the_kernel/enhancing-security-with-the-kernel-integrity-subsystem_managing-monitoring-and-updating-the-kernel#enabling-integrity-measurement-architecture-and-extended-verification-module_enhancing-security-with-the-kernel-integrity-subsystem

Comment 1 Joe Wright 2023-02-16 21:15:21 UTC
The actual results and expected results are backwards. Expected is actual and vice versa

Comment 2 Coiby 2023-06-30 10:31:57 UTC
Hi Brandon,

Sorry, somehow I didn't notice this bug until now.

Could you be provided the detailed steps to reproduce. I don't quite understand the bug as https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_monitoring_and_updating_the_kernel/enhancing-security-with-the-kernel-integrity-subsystem_managing-monitoring-and-updating-the-kernel#enabling-integrity-measurement-architecture-and-extended-verification-module_enhancing-security-with-the-kernel-integrity-subsystem doesn't mention anything about self-signed certificate.

Comment 3 Joe Wright 2023-07-17 18:00:39 UTC
The command 'evmctl import /path/to/certificate ${im_keyring_id}' fails.

The key is confirmed as enrolled using the command 'mokutil --list-enrolled'

The 'evmctl import $pubkey $keyring' command also isn't working. It keeps returning an error 126 (ENOKEY) when trying to import to the IMA keyring.

The failure occurs with or without secure boot enabled.


When running it through strace (attached strace.txt), we see that permission is denied when trying to import the key:

4901  1676043783.480671 write(2</dev/pts/0>, "Importing public key f055f363 from file /etc/keys/pubkey_ima.der into keyring 247926348\n", 88) = 88 <0.000010>
4901  1676043783.480709 add_key("asymmetric", NULL, "0\202\6U0\202\4=\240\3\2\1\2\2\t\0\341\274P\242\17\264nJ0\r\6\t*\206H\206\367\r\1\1\v\5\0000m1\0240\22\6\3U\4\3\f\vOwl IMA Key1\v0\t\6\3U\4\6\23\2US1\v0\t\6\3U\4\10\f\2CT1\0200\16\6\3U\4\7\f\7Danbury1)0'\6\3U\4\n\f Owl Cyber Defense Solutions, LLC0\36\27\r230111200356Z\27\r230210200356Z0m1\0240\22\6\3U\4\3\f\vOwl IMA Key1\v0\t\6\3U\4\6\23\2US1\v0\t\6\3U\4\10\f\2CT1\0200\16\6\3U\4\7\f\7Danbury1)0'\6\3U\4\n\f Owl Cyber Defense Solutions, LLC0\202\2\"0\r\6\t*\206H\206\367\r\1\1\1\5\0\3\202\2\17\0000\202\2\n\2\202\2\1\0\271d\223\2479v\263.y\224\255\344\7]\310q\303v\362\300\267\255c<gta!\324.L\341\26\232\231O\0\251\302\220r\371\200\355\212/\24e\233\375\203\237\302\313\34\265\367\274\201QD8\367\337\217'De\235\v/\347\346\264\233a\316\232\264\374\232W\303\16\356\254\vM:\30\337.:a\2155\340\366\2344\30\364\306G\273\350lM\1V\2301\33\372\331\241\224u\361\305\320\211\272W\204\24Y,W\304\366\355\253\27f\37F\243\32h\350\16<w\270\220\273\251A\262xQ\304%\216!!\205\265|\20\376\34\370)P\304/\216v\334T\235o\302h2\312o\340\243\237\306\272\320\362\326\202\365\210\263\2E\337\306H5\343P\223C^\3565\263|&\223\201\243\346<\323r|_\242.N\274\362\223\260\252\r\377\323\v\302\327~\257\255\\\2162\304\35\273\363~\224=\177QAN\212\n\23\321\362\300gU\215\202\372\375\32\r\237\214\376K`\36;\215\324&\306+)\5\245\37w,\227\212A\3-;-\10\301l\251\360\272\341\347\302\274\262X\344\3\247\301\242gZj\305\37v\3\0212?pV\351(\22\265$\30C\3117\234G\260!p\311\263[6c\273\342\"$6\271\202\337\377\300~#BR\223a9\273\264\6\220\311\3C\301\272\32\361&\337\27\317\255\37qwC\372k\351\212\r\227k\372\233\215V\222\270\362\362S\316\214\202\301\306D\317\215\177\276\273\34\326\354q\231*K\261\310^\301\31^\213\257\f\257\332b\226\275W\305\333N\37\303'\222\26692\240\6\f\252\324<\271\3011UY\221\207\214<F\331dF\246\302\273\0D\311\245=\221\204\241\6\255\343\2275\262Qsw\222PW\340\232(un\16a,\250\f>\3\211F\225Z\314VV\324#\262<\340\366t\33\210nW\313\f\254\3770JD\326d\261\2\3\1\0\1\243\201\3670\201\3640\35\6\3U\35\16\4\26\4\24o\243\205\36\230\377\324\35\323\317\323uS\4=\320\360U\363c0\201\237\6\3U\35#\4\201\2270\201\224\200\24o\243\205\36\230\377\324\35\323\317\323uS\4=\320\360U\363c\241q\244o0m1\0240\22\6\3U\4\3\f\vOwl IMA Key1\v0\t\6\3U\4\6\23\2US1\v0\t\6\3U\4\10\f\2CT1\0200\16\6\3U\4\7\f\7Danbury1)0'\6\3U\4\n\f Owl Cyber Defense Solutions, LLC\202\t\0\341\274P\242\17\264nJ0\t\6\3U\35\23\4\0020\0000\16\6\3U\35\17\1\1\377\4\4\3\2\7\2000\26\6\3U\35%\1\1\377\4\f0\n\6\10+\6\1\5\5\7\3\0030\r\6\t*\206H\206\367\r\1\1\v\5\0\3\202\2\1\0\7\177\363F\272\244\242\352\240\300\261\0\313\351,\361\225\361\267\376G\2010b\321\3234=\21\371\25\332B\275E\36-\27\3528\32371\335\314L\313F\303\vW[\344.\366s\334\301t\206\26A\235\325\277\376\31\20/1\2728\204\33\313\346\214\342\253\364\313O\256/3\323G\376\352`\36\342\360\17\303\256\320\224\2116\t\36(\276Q\356\365v_5\346\323>\223\211A\6I\234#e\377)-\264\346{\371jw\331\207s\365\374\2134\351D[e\202\36\375#\334\267T\225%\210\203\7\232\373\340t\252\264M\265$\36\32qv\224=j\305\306T\1HM\367\275=\323\202\305\230F\2\26*}i1\2166AD\49T\246T\364\367\322'\235\326\31\323\217\346\226\245\371\344\301^\21Mks\234R\320kg\356W]u\201\373G\251\312\250.\311\266\333\31I\316\332\374\371\216\244z\261j\212c\342\206\253\34\233\374\377\10\304^g\363\365i\"\306\10FU)\20\6\264\244M-\340\361a\251`\344\342\311\17\220\244\266/4#\317x\241\267,3[X\262\242\v\204[L\277\311<\327\235\347\205\356\205\0\331\227]\341\254G\345\257\260\206\334\207\32\f?QXN\361\244v\354\2757\367eANk\256\276\365\217G6\20\36\334m\364\2739Cs\31\225\343\376L\3N\265\225\26\236\270\315\3776\344\255SQC\374\2678E\332\330\274M\0\303\357A\373\371\6::\253}\336\27|\237\340\275\79\0234S\335U\302j\215h)\0[\1<6LF\322\rJ<\200T\2323\213\242\315\335`i\215i#}0\256\302\267Y\24\0\330\373\311\306\251\36\313,eyk\313@\306N\364\216\341\220\240\320g\257u8>\251\223\6* \241Kv\16\234\360\16\253\326\1i;\"\247\3\27\206\232a\265F-`\244Z}\20S-u\316mP", 1625, 247926348) = -1 EACCES (Permission denied) <0.000012>
4901  1676043783.480766 write(2</dev/pts/0>, "add_key failed\n", 15) = 15 <0.000007>
4901  1676043783.480801 write(2</dev/pts/0>, "errno: Permission denied (13)\n", 30) = 30 <0.000007>

There is no STIG/SCAP or other similar hardening applied to the environment.

Comment 5 Coiby 2023-07-18 11:24:59 UTC
(In reply to Joe Wright from comment #3)
> The command 'evmctl import /path/to/certificate ${im_keyring_id}' fails.
> 
> The key is confirmed as enrolled using the command 'mokutil --list-enrolled'
> 
> The 'evmctl import $pubkey $keyring' command also isn't working. It keeps
> returning an error 126 (ENOKEY) when trying to import to the IMA keyring.
> 
> The failure occurs with or without secure boot enabled.
> 
> 
> When running it through strace (attached strace.txt), we see that permission
> is denied when trying to import the key:
> 
> 4901  1676043783.480671 write(2</dev/pts/0>, "Importing public key f055f363
> from file /etc/keys/pubkey_ima.der into keyring 247926348\n", 88) = 88
> <0.000010>
> 4901  1676043783.480709 add_key("asymmetric", NULL,
> "0\202\6U0\202\4=\240\3\2\1\2\2\t\0\341\274P\242\17\264nJ0\r\6\t*\206H\206\36
> 7\r\1\1\v\5\0000m1\0240\22\6\3U\4\3\f\vOwl IMA
> Key1\v0\t\6\3U\4\6\23\2US1\v0\t\6\3U\4\10\f\2CT1\0200\16\6\3U\4\7\f\7Danbury1
> )0'\6\3U\4\n\f Owl Cyber Defense Solutions,
> LLC0\36\27\r230111200356Z\27\r230210200356Z0m1\0240\22\6\3U\4\3\f\vOwl IMA
> Key1\v0\t\6\3U\4\6\23\2US1\v0\t\6\3U\4\10\f\2CT1\0200\16\6\3U\4\7\f\7Danbury1
> )0'\6\3U\4\n\f Owl Cyber Defense Solutions,
> LLC0\202\2\"0\r\6\t*\206H\206\367\r\1\1\1\5\0\3\202\2\17\0000\202\2\n\2\202\2
> \1\0\271d\223\2479v\263.y\224\255\344\7]\310q\303v\362\300\267\255c<gta!\324.
> L\341\26\232\231O\0\251\302\220r\371\200\355\212/
> \24e\233\375\203\237\302\313\34\265\367\274\201QD8\367\337\217'De\235\v/
> \347\346\264\233a\316\232\264\374\232W\303\16\356\254\vM:\30\337.:
> a\2155\340\366\2344\30\364\306G\273\350lM\1V\2301\33\372\331\241\224u\361\305
> \320\211\272W\204\24Y,
> W\304\366\355\253\27f\37F\243\32h\350\16<w\270\220\273\251A\262xQ\304%\216!!
> \205\265|\20\376\34\370)P\304/
> \216v\334T\235o\302h2\312o\340\243\237\306\272\320\362\326\202\365\210\263\2E
> \337\306H5\343P\223C^\3565\263|&\223\201\243\346<\323r|_\242.
> N\274\362\223\260\252\r\377\323\v\302\327~\257\255\\\2162\304\35\273\363~\224
> =\177QAN\212\n\23\321\362\300gU\215\202\372\375\32\r\237\214\376K`\36;
> \215\324&\306+)\5\245\37w,\227\212A\3-;-
> \10\301l\251\360\272\341\347\302\274\262X\344\3\247\301\242gZj\305\37v\3\0212
> ?pV\351(\22\265$\30C\3117\234G\260!
> p\311\263[6c\273\342\"$6\271\202\337\377\300~#BR\223a9\273\264\6\220\311\3C\3
> 01\272\32\361&\337\27\317\255\37qwC\372k\351\212\r\227k\372\233\215V\222\270\
> 362\362S\316\214\202\301\306D\317\215\177\276\273\34\326\354q\231*K\261\310^\
> 301\31^\213\257\f\257\332b\226\275W\305\333N\37\303'\222\26692\240\6\f\252\32
> 4<\271\3011UY\221\207\214<F\331dF\246\302\273\0D\311\245=\221\204\241\6\255\3
> 43\2275\262Qsw\222PW\340\232(un\16a,
> \250\f>\3\211F\225Z\314VV\324#\262<\340\366t\33\210nW\313\f\254\3770JD\326d\2
> 61\2\3\1\0\1\243\201\3670\201\3640\35\6\3U\35\16\4\26\4\24o\243\205\36\230\37
> 7\324\35\323\317\323uS\4=\320\360U\363c0\201\237\6\3U\35#\4\201\2270\201\224\
> 200\24o\243\205\36\230\377\324\35\323\317\323uS\4=\320\360U\363c\241q\244o0m1
> \0240\22\6\3U\4\3\f\vOwl IMA
> Key1\v0\t\6\3U\4\6\23\2US1\v0\t\6\3U\4\10\f\2CT1\0200\16\6\3U\4\7\f\7Danbury1
> )0'\6\3U\4\n\f Owl Cyber Defense Solutions,
> LLC\202\t\0\341\274P\242\17\264nJ0\t\6\3U\35\23\4\0020\0000\16\6\3U\35\17\1\1
> \377\4\4\3\2\7\2000\26\6\3U\35%\1\1\377\4\f0\n\6\10+\6\1\5\5\7\3\0030\r\6\t*\
> 206H\206\367\r\1\1\v\5\0\3\202\2\1\0\7\177\363F\272\244\242\352\240\300\261\0
> \313\351,\361\225\361\267\376G\2010b\321\3234=\21\371\25\332B\275E\36-
> \27\3528\32371\335\314L\313F\303\vW[\344.
> \366s\334\301t\206\26A\235\325\277\376\31\20/
> 1\2728\204\33\313\346\214\342\253\364\313O\256/
> 3\323G\376\352`\36\342\360\17\303\256\320\224\2116\t\36(\276Q\356\365v_5\346\
> 323>\223\211A\6I\234#e\377)-
> \264\346{\371jw\331\207s\365\374\2134\351D[e\202\36\375#\334\267T\225%\210\20
> 3\7\232\373\340t\252\264M\265$\36\32qv\224=j\305\306T\1HM\367\275=\323\202\30
> 5\230F\2\26*}i1\2166AD\49T\246T\364\367\322'\235\326\31\323\217\346\226\245\3
> 71\344\301^\21Mks\234R\320kg\356W]u\201\373G\251\312\250.
> \311\266\333\31I\316\332\374\371\216\244z\261j\212c\342\206\253\34\233\374\37
> 7\10\304^g\363\365i\"\306\10FU)\20\6\264\244M-
> \340\361a\251`\344\342\311\17\220\244\266/4#\317x\241\267,
> 3[X\262\242\v\204[L\277\311<\327\235\347\205\356\205\0\331\227]\341\254G\345\
> 257\260\206\334\207\32\f?QXN\361\244v\354\2757\367eANk\256\276\365\217G6\20\3
> 6\334m\364\2739Cs\31\225\343\376L\3N\265\225\26\236\270\315\3776\344\255SQC\3
> 74\2678E\332\330\274M\0\303\357A\373\371\6::
> \253}\336\27|\237\340\275\79\0234S\335U\302j\215h)\0[\1<6LF\322\rJ<\200T\2323
> \213\242\315\335`i\215i#}0\256\302\267Y\24\0\330\373\311\306\251\36\313,
> eyk\313@\306N\364\216\341\220\240\320g\257u8>\251\223\6*
> \241Kv\16\234\360\16\253\326\1i;\"\247\3\27\206\232a\265F-`\244Z}\20S-
> u\316mP", 1625, 247926348) = -1 EACCES (Permission denied) <0.000012>
> 4901  1676043783.480766 write(2</dev/pts/0>, "add_key failed\n", 15) = 15
> <0.000007>
> 4901  1676043783.480801 write(2</dev/pts/0>, "errno: Permission denied
> (13)\n", 30) = 30 <0.000007>
> 
> There is no STIG/SCAP or other similar hardening applied to the environment.


By "${im_keyring_id}", do you mean the %:.ima keyring? If the answer is yes, in order to add this key to the .ima keyring, this key needs to be signed by a CA key/certificate in the .builtin_trusted_keys or .secondary_trusted_keys (the latter is supported since kernel-5.14.0-337.el9.x86_64) keyrings. You can follow "Generate trusted keys" [1] to create a CA key and sign the IMA key.

[1] https://github.com/mimizohar/ima-evm-utils/blob/next-testing/README#L274

Comment 6 Brandon Clark 2023-08-17 17:37:29 UTC
Hello,

Is there a specific set of steps needed for importing the keys to the secondary_trusted_keys?

Comment 8 RHEL Program Management 2023-09-25 18:18:28 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 9 RHEL Program Management 2023-09-25 19:45:13 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


Note You need to log in before you can comment on or make changes to this bug.