Bug 2170559
| Summary: | Unable to use imported IMA key on self-signed RPM. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Brandon Clark <brclark> |
| Component: | ima-evm-utils | Assignee: | Coiby <coxu> |
| Status: | NEW --- | QA Contact: | Linqing Lu <lilu> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 9.1 | CC: | alanm, amike, brclark, casantos, dbohanno, denli, jwright, mkielian, mkolbas, rparrazo |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Brandon Clark
2023-02-16 17:37:47 UTC
The actual results and expected results are backwards. Expected is actual and vice versa 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. 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.
(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 Hello, Is there a specific set of steps needed for importing the keys to the secondary_trusted_keys? |