csphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}(hhparenthuba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget./translations/zh_CN/admin-guide/module-signingmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}(hhhh2ubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/zh_TW/admin-guide/module-signingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}(hhhhFubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/it_IT/admin-guide/module-signingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}(hhhhZubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/ja_JP/admin-guide/module-signingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}(hhhhnubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/ko_KR/admin-guide/module-signingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}(hhhhubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget./translations/sp_SP/admin-guide/module-signingmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hKernel module signing facilityh]hKernel module signing facility}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhH/var/lib/git/docbuild/linux/Documentation/admin-guide/module-signing.rsthKubhcomment)}(hCONTENTSh]hCONTENTS}(hhhhubah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhhhKubh)}(hhh]h}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(h - Overview.h]h - Overview.}(hhhhubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(h- Configuring module signing.h]h- Configuring module signing.}(hhhhubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(h- Generating signing keys.h]h- Generating signing keys.}(hhhhubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(h- Public keys in the kernel.h]h- Public keys in the kernel.}(hhhhubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhK ubh)}(h- Manually signing modules.h]h- Manually signing modules.}(hhhj ubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhK ubh)}(h- Signed modules and stripping.h]h- Signed modules and stripping.}(hhhjubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhK ubh)}(h- Loading signed modules.h]h- Loading signed modules.}(hhhj&ubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhK ubh)}(h,- Non-valid signatures and unsigned modules.h]h,- Non-valid signatures and unsigned modules.}(hhhj4ubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhK ubh)}(h+- Administering/protecting the private key.h]h+- Administering/protecting the private key.}(hhhjBubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hjUhjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhjPhhhhhKubh paragraph)}(hXThe kernel module signing facility cryptographically signs modules during installation and then checks the signature upon loading the module. This allows increased kernel security by disallowing the loading of unsigned modules or modules signed with an invalid key. Module signing increases security by making it harder to load a malicious module into the kernel. The module signature checking is done by the kernel so that it is not necessary to have trusted userspace bits.h]hXThe kernel module signing facility cryptographically signs modules during installation and then checks the signature upon loading the module. This allows increased kernel security by disallowing the loading of unsigned modules or modules signed with an invalid key. Module signing increases security by making it harder to load a malicious module into the kernel. The module signature checking is done by the kernel so that it is not necessary to have trusted userspace bits.}(hjehjchhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKhjPhhubjb)}(hXThis facility uses X.509 ITU-T standard certificates to encode the public keys involved. The signatures are not themselves encoded in any industrial standard type. The built-in facility currently only supports the RSA & NIST P-384 ECDSA public key signing standard (though it is pluggable and permits others to be used). The possible hash algorithms that can be used are SHA-2 and SHA-3 of sizes 256, 384, and 512 (the algorithm is selected by data in the signature).h]hXThis facility uses X.509 ITU-T standard certificates to encode the public keys involved. The signatures are not themselves encoded in any industrial standard type. The built-in facility currently only supports the RSA & NIST P-384 ECDSA public key signing standard (though it is pluggable and permits others to be used). The possible hash algorithms that can be used are SHA-2 and SHA-3 of sizes 256, 384, and 512 (the algorithm is selected by data in the signature).}(hjshjqhhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKhjPhhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hConfiguring module signingh]hConfiguring module signing}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK'ubjb)}(hThe module signing facility is enabled by going to the :menuselection:`Enable Loadable Module Support` section of the kernel configuration and turning on::h](h7The module signing facility is enabled by going to the }(h7The module signing facility is enabled by going to the hjhhhNhNubhinline)}(hEnable Loadable Module Supporth]hEnable Loadable Module Support}(hhhjhhhNhNubah}(h]h ] menuselectionah"]h$]h&]rawtext/:menuselection:`Enable Loadable Module Support`uh1jhjubh4 section of the kernel configuration and turning on:}(h4 section of the kernel configuration and turning on:hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jahhhK)hjhhubh literal_block)}(h7CONFIG_MODULE_SIG "Module signature verification"h]h7CONFIG_MODULE_SIG "Module signature verification"}(hhhjubah}(h]h ]h"]h$]h&]hhuh1jhhhK-hjhhubjb)}(h'This has a number of options available:h]h'This has a number of options available:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhK/hjhhubh block_quote)}(hhh]henumerated_list)}(hhh](h list_item)}(hX+:menuselection:`Require modules to be validly signed` (``CONFIG_MODULE_SIG_FORCE``) This specifies how the kernel should deal with a module that has a signature for which the key is not known or a module that is unsigned. If this is off (ie. "permissive"), then modules for which the key is not available and modules that are unsigned are permitted, but the kernel will be marked as being tainted, and the concerned modules will be marked as tainted, shown with the character 'E'. If this is on (ie. "restrictive"), only modules that have a valid signature that can be verified by a public key in the kernel's possession will be loaded. All other modules will generate an error. Irrespective of the setting here, if the module has a signature block that cannot be parsed, it will be rejected out of hand. h](jb)}(hS:menuselection:`Require modules to be validly signed` (``CONFIG_MODULE_SIG_FORCE``)h](j)}(h$Require modules to be validly signedh]h$Require modules to be validly signed}(hhhjhhhNhNubah}(h]h ] menuselectionah"]h$]h&]rawtext5:menuselection:`Require modules to be validly signed`uh1jhjubh (}(h (hjhhhNhNubhliteral)}(h``CONFIG_MODULE_SIG_FORCE``h]hCONFIG_MODULE_SIG_FORCE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h)hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jahhhK1hjubjb)}(hThis specifies how the kernel should deal with a module that has a signature for which the key is not known or a module that is unsigned.h]hThis specifies how the kernel should deal with a module that has a signature for which the key is not known or a module that is unsigned.}(hj$hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhK4hjubjb)}(hXIf this is off (ie. "permissive"), then modules for which the key is not available and modules that are unsigned are permitted, but the kernel will be marked as being tainted, and the concerned modules will be marked as tainted, shown with the character 'E'.h]hX If this is off (ie. “permissive”), then modules for which the key is not available and modules that are unsigned are permitted, but the kernel will be marked as being tainted, and the concerned modules will be marked as tainted, shown with the character ‘E’.}(hj2hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhK7hjubjb)}(hIf this is on (ie. "restrictive"), only modules that have a valid signature that can be verified by a public key in the kernel's possession will be loaded. All other modules will generate an error.h]hIf this is on (ie. “restrictive”), only modules that have a valid signature that can be verified by a public key in the kernel’s possession will be loaded. All other modules will generate an error.}(hj@hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKubah}(h]h ]h"]h$]h&]uh1jhjhhhNhNubjb)}(h5The following is an example to sign a kernel module::h]h4The following is an example to sign a kernel module:}(h4The following is an example to sign a kernel module:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKhjhhubj)}(hTscripts/sign-file sha512 kernel-signkey.priv \ kernel-signkey.x509 module.koh]hTscripts/sign-file sha512 kernel-signkey.priv \ kernel-signkey.x509 module.ko}(hhhjubah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubjb)}(hThe hash algorithm used does not have to match the one configured, but if it doesn't, you should make sure that hash algorithm is either built into the kernel or can be loaded without requiring itself.h]hThe hash algorithm used does not have to match the one configured, but if it doesn’t, you should make sure that hash algorithm is either built into the kernel or can be loaded without requiring itself.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKhjhhubjb)}(hqIf the private key requires a passphrase or PIN, it can be provided in the $KBUILD_SIGN_PIN environment variable.h]hqIf the private key requires a passphrase or PIN, it can be provided in the $KBUILD_SIGN_PIN environment variable.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKhjhhubeh}(h]manually-signing-modulesah ]h"]manually signing modulesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hSigned modules and strippingh]hSigned modules and stripping}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjb)}(hA signed module has a digital signature simply appended at the end. The string ``~Module signature appended~.`` at the end of the module's file confirms that a signature is present but it does not confirm that the signature is valid!h](hPA signed module has a digital signature simply appended at the end. The string }(hPA signed module has a digital signature simply appended at the end. The string hj hhhNhNubj)}(h ``~Module signature appended~.``h]h~Module signature appended~.}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh| at the end of the module’s file confirms that a signature is present but it does not confirm that the signature is valid!}(hz at the end of the module's file confirms that a signature is present but it does not confirm that the signature is valid!hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jahhhKhjhhubjb)}(hXSigned modules are BRITTLE as the signature is outside of the defined ELF container. Thus they MAY NOT be stripped once the signature is computed and attached. Note the entire module is the signed payload, including any and all debug information present at the time of signing.h]hXSigned modules are BRITTLE as the signature is outside of the defined ELF container. Thus they MAY NOT be stripped once the signature is computed and attached. Note the entire module is the signed payload, including any and all debug information present at the time of signing.}(hj$ hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhKhjhhubeh}(h]signed-modules-and-strippingah ]h"]signed modules and strippingah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hLoading signed modulesh]hLoading signed modules}(hj= hj; hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj8 hhhhhMubjb)}(hModules are loaded with insmod, modprobe, ``init_module()`` or ``finit_module()``, exactly as for unsigned modules as no processing is done in userspace. The signature checking is all done within the kernel.h](h*Modules are loaded with insmod, modprobe, }(h*Modules are loaded with insmod, modprobe, hjI hhhNhNubj)}(h``init_module()``h]h init_module()}(hhhjR hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjI ubh or }(h or hjI hhhNhNubj)}(h``finit_module()``h]hfinit_module()}(hhhje hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjI ubh, exactly as for unsigned modules as no processing is done in userspace. The signature checking is all done within the kernel.}(h, exactly as for unsigned modules as no processing is done in userspace. The signature checking is all done within the kernel.hjI hhhNhNubeh}(h]h ]h"]h$]h&]uh1jahhhMhj8 hhubeh}(h]loading-signed-modulesah ]h"]loading signed modulesah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h)Non-valid signatures and unsigned modulesh]h)Non-valid signatures and unsigned modules}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhM ubjb)}(hXmIf ``CONFIG_MODULE_SIG_FORCE`` is enabled or module.sig_enforce=1 is supplied on the kernel command line, the kernel will only load validly signed modules for which it has a public key. Otherwise, it will also load modules that are unsigned. Any module for which the kernel has a key, but which proves to have a signature mismatch will not be permitted to load.h](hIf }(hIf hj hhhNhNubj)}(h``CONFIG_MODULE_SIG_FORCE``h]hCONFIG_MODULE_SIG_FORCE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhXO is enabled or module.sig_enforce=1 is supplied on the kernel command line, the kernel will only load validly signed modules for which it has a public key. Otherwise, it will also load modules that are unsigned. Any module for which the kernel has a key, but which proves to have a signature mismatch will not be permitted to load.}(hXO is enabled or module.sig_enforce=1 is supplied on the kernel command line, the kernel will only load validly signed modules for which it has a public key. Otherwise, it will also load modules that are unsigned. Any module for which the kernel has a key, but which proves to have a signature mismatch will not be permitted to load.hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jahhhM hj hhubjb)}(h=Any module that has an unparsable signature will be rejected.h]h=Any module that has an unparsable signature will be rejected.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhMhj hhubeh}(h])non-valid-signatures-and-unsigned-modulesah ]h"])non-valid signatures and unsigned modulesah$]h&]uh1hhhhhhhhM ubh)}(hhh](h)}(h(Administering/protecting the private keyh]h(Administering/protecting the private key}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubjb)}(hXSince the private key is used to sign modules, viruses and malware could use the private key to sign modules and compromise the operating system. The private key must be either destroyed or moved to a secure location and not kept in the root node of the kernel source tree.h]hXSince the private key is used to sign modules, viruses and malware could use the private key to sign modules and compromise the operating system. The private key must be either destroyed or moved to a secure location and not kept in the root node of the kernel source tree.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahhhMhj hhubjb)}(hXpIf you use the same private key to sign modules for multiple kernel configurations, you must ensure that the module version information is sufficient to prevent loading a module into a different kernel. Either set ``CONFIG_MODVERSIONS=y`` or ensure that each configuration has a different kernel release string by changing ``EXTRAVERSION`` or ``CONFIG_LOCALVERSION``.h](hIf you use the same private key to sign modules for multiple kernel configurations, you must ensure that the module version information is sufficient to prevent loading a module into a different kernel. Either set }(hIf you use the same private key to sign modules for multiple kernel configurations, you must ensure that the module version information is sufficient to prevent loading a module into a different kernel. Either set hj hhhNhNubj)}(h``CONFIG_MODVERSIONS=y``h]hCONFIG_MODVERSIONS=y}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhU or ensure that each configuration has a different kernel release string by changing }(hU or ensure that each configuration has a different kernel release string by changing hj hhhNhNubj)}(h``EXTRAVERSION``h]h EXTRAVERSION}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh or }(h or hj hhhNhNubj)}(h``CONFIG_LOCALVERSION``h]hCONFIG_LOCALVERSION}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh.}(hjhj hhhNhNubeh}(h]h ]h"]h$]h&]uh1jahhhMhj hhubeh}(h](administering-protecting-the-private-keyah ]h"](administering/protecting the private keyah$]h&]uh1hhhhhhhhMubeh}(h]kernel-module-signing-facilityah ]h"]kernel module signing facilityah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjg error_encodingUTF-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confapep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacefile_insertion_enabled raw_enabledKline_length_limitM'syntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_link embed_imagesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jB j? jjjjj2j/jjjjj5 j2 j j j j j: j7 u nametypes}(jB NjNjNj2NjNjNj5 Nj Nj Nj: Nuh}(j? hjjPjjj/jjj5jjj2 jj j8 j j j7 j u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.