Signed kernel modules - “not signed with trusted key”












1















Issue:



I'm trying to use signed kernel modules, but getting a failure for the insmod command:



PKCS#7 signature not signed with a trusted key



There is a potentially related error message during Linux boot:



[    3.342888] Loading compiled-in X.509 certificates
[ 3.391774] Problem loading in-kernel X.509 certificate (-129)


The command cat /proc/keys shows .builtin_trusted_keys: empty



Setup:



The 4.9.x kernel was compiled with the following defconfig options:



...
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG=y
CONFIG_MODULE_SIG_ALL=y
CONFIG_MODULE_SIG_FORCE=y
CONFIG_MODULE_SIG_SHA256=y
CONFIG_MODULE_SIG_HASH="sha256"
CONFIG_SYSTEM_TRUSTED_KEYRING=y
CONFIG_KEYS_DEBUG_PROC_KEYS=y
CONFIG_PERSISTENT_KEYRINGS=y
CONFIG_ENCRYPTED_KEYS=y
CONFIG_SECURITY_DMESG_RESTRICT=y
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_PATH=y
CONFIG_HARDENED_USERCOPY=y
CONFIG_SECURITY_SMACK=y
CONFIG_SECURITY_SMACK_BRINGUP=y
CONFIG_DEFAULT_SECURITY_DAC=y
...


Modules were signed with a command:
sign-file sha256 certs/signing_key.pem certs/signing_key.x509 <.ko>



Comments:



I assume I need to fix the in-kernel X.509 certificate loading error, but I haven't come across how to do that. I thought the file certs/signing_key.pem generated during kernel compilation would be wrapped into the kernel but it appears not based on /proc/keys. I don't want to disable signing or allow unsigned modules, I just want to sign them properly with a trusted key. If anyone has advice, that would be much appreciated.



The posts I've found regarding nvidia drivers and Ubuntu/Fedora haven't yielded any progress yet. Example:
PKCS#7 signature not signed with a trusted key










share|improve this question














bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    Issue:



    I'm trying to use signed kernel modules, but getting a failure for the insmod command:



    PKCS#7 signature not signed with a trusted key



    There is a potentially related error message during Linux boot:



    [    3.342888] Loading compiled-in X.509 certificates
    [ 3.391774] Problem loading in-kernel X.509 certificate (-129)


    The command cat /proc/keys shows .builtin_trusted_keys: empty



    Setup:



    The 4.9.x kernel was compiled with the following defconfig options:



    ...
    CONFIG_MODULES=y
    CONFIG_MODULE_UNLOAD=y
    CONFIG_MODVERSIONS=y
    CONFIG_MODULE_SRCVERSION_ALL=y
    CONFIG_MODULE_SIG=y
    CONFIG_MODULE_SIG_ALL=y
    CONFIG_MODULE_SIG_FORCE=y
    CONFIG_MODULE_SIG_SHA256=y
    CONFIG_MODULE_SIG_HASH="sha256"
    CONFIG_SYSTEM_TRUSTED_KEYRING=y
    CONFIG_KEYS_DEBUG_PROC_KEYS=y
    CONFIG_PERSISTENT_KEYRINGS=y
    CONFIG_ENCRYPTED_KEYS=y
    CONFIG_SECURITY_DMESG_RESTRICT=y
    CONFIG_SECURITY=y
    CONFIG_SECURITYFS=y
    CONFIG_SECURITY_PATH=y
    CONFIG_HARDENED_USERCOPY=y
    CONFIG_SECURITY_SMACK=y
    CONFIG_SECURITY_SMACK_BRINGUP=y
    CONFIG_DEFAULT_SECURITY_DAC=y
    ...


    Modules were signed with a command:
    sign-file sha256 certs/signing_key.pem certs/signing_key.x509 <.ko>



    Comments:



    I assume I need to fix the in-kernel X.509 certificate loading error, but I haven't come across how to do that. I thought the file certs/signing_key.pem generated during kernel compilation would be wrapped into the kernel but it appears not based on /proc/keys. I don't want to disable signing or allow unsigned modules, I just want to sign them properly with a trusted key. If anyone has advice, that would be much appreciated.



    The posts I've found regarding nvidia drivers and Ubuntu/Fedora haven't yielded any progress yet. Example:
    PKCS#7 signature not signed with a trusted key










    share|improve this question














    bumped to the homepage by Community 4 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      Issue:



      I'm trying to use signed kernel modules, but getting a failure for the insmod command:



      PKCS#7 signature not signed with a trusted key



      There is a potentially related error message during Linux boot:



      [    3.342888] Loading compiled-in X.509 certificates
      [ 3.391774] Problem loading in-kernel X.509 certificate (-129)


      The command cat /proc/keys shows .builtin_trusted_keys: empty



      Setup:



      The 4.9.x kernel was compiled with the following defconfig options:



      ...
      CONFIG_MODULES=y
      CONFIG_MODULE_UNLOAD=y
      CONFIG_MODVERSIONS=y
      CONFIG_MODULE_SRCVERSION_ALL=y
      CONFIG_MODULE_SIG=y
      CONFIG_MODULE_SIG_ALL=y
      CONFIG_MODULE_SIG_FORCE=y
      CONFIG_MODULE_SIG_SHA256=y
      CONFIG_MODULE_SIG_HASH="sha256"
      CONFIG_SYSTEM_TRUSTED_KEYRING=y
      CONFIG_KEYS_DEBUG_PROC_KEYS=y
      CONFIG_PERSISTENT_KEYRINGS=y
      CONFIG_ENCRYPTED_KEYS=y
      CONFIG_SECURITY_DMESG_RESTRICT=y
      CONFIG_SECURITY=y
      CONFIG_SECURITYFS=y
      CONFIG_SECURITY_PATH=y
      CONFIG_HARDENED_USERCOPY=y
      CONFIG_SECURITY_SMACK=y
      CONFIG_SECURITY_SMACK_BRINGUP=y
      CONFIG_DEFAULT_SECURITY_DAC=y
      ...


      Modules were signed with a command:
      sign-file sha256 certs/signing_key.pem certs/signing_key.x509 <.ko>



      Comments:



      I assume I need to fix the in-kernel X.509 certificate loading error, but I haven't come across how to do that. I thought the file certs/signing_key.pem generated during kernel compilation would be wrapped into the kernel but it appears not based on /proc/keys. I don't want to disable signing or allow unsigned modules, I just want to sign them properly with a trusted key. If anyone has advice, that would be much appreciated.



      The posts I've found regarding nvidia drivers and Ubuntu/Fedora haven't yielded any progress yet. Example:
      PKCS#7 signature not signed with a trusted key










      share|improve this question














      Issue:



      I'm trying to use signed kernel modules, but getting a failure for the insmod command:



      PKCS#7 signature not signed with a trusted key



      There is a potentially related error message during Linux boot:



      [    3.342888] Loading compiled-in X.509 certificates
      [ 3.391774] Problem loading in-kernel X.509 certificate (-129)


      The command cat /proc/keys shows .builtin_trusted_keys: empty



      Setup:



      The 4.9.x kernel was compiled with the following defconfig options:



      ...
      CONFIG_MODULES=y
      CONFIG_MODULE_UNLOAD=y
      CONFIG_MODVERSIONS=y
      CONFIG_MODULE_SRCVERSION_ALL=y
      CONFIG_MODULE_SIG=y
      CONFIG_MODULE_SIG_ALL=y
      CONFIG_MODULE_SIG_FORCE=y
      CONFIG_MODULE_SIG_SHA256=y
      CONFIG_MODULE_SIG_HASH="sha256"
      CONFIG_SYSTEM_TRUSTED_KEYRING=y
      CONFIG_KEYS_DEBUG_PROC_KEYS=y
      CONFIG_PERSISTENT_KEYRINGS=y
      CONFIG_ENCRYPTED_KEYS=y
      CONFIG_SECURITY_DMESG_RESTRICT=y
      CONFIG_SECURITY=y
      CONFIG_SECURITYFS=y
      CONFIG_SECURITY_PATH=y
      CONFIG_HARDENED_USERCOPY=y
      CONFIG_SECURITY_SMACK=y
      CONFIG_SECURITY_SMACK_BRINGUP=y
      CONFIG_DEFAULT_SECURITY_DAC=y
      ...


      Modules were signed with a command:
      sign-file sha256 certs/signing_key.pem certs/signing_key.x509 <.ko>



      Comments:



      I assume I need to fix the in-kernel X.509 certificate loading error, but I haven't come across how to do that. I thought the file certs/signing_key.pem generated during kernel compilation would be wrapped into the kernel but it appears not based on /proc/keys. I don't want to disable signing or allow unsigned modules, I just want to sign them properly with a trusted key. If anyone has advice, that would be much appreciated.



      The posts I've found regarding nvidia drivers and Ubuntu/Fedora haven't yielded any progress yet. Example:
      PKCS#7 signature not signed with a trusted key







      kernel-modules






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 28 '18 at 13:49









      bornruffiansbornruffians

      1064




      1064





      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I think the kernel compilation expects the signing_key.* files in the base directory of the kernel source tree and not under a ”certs” subdirectory. The compilation process should automatically sign the standard modules for you; only third-party modules should need manual signing.



          Also, my old script for compiling a 4.9.* kernel with signed modules had the certificate file in DER format. Perhaps it was necessary?



          In the 4.14 and newer kernels, the procedure is a bit different: there is a kernel configuration option for specifying the pathname of the certificate file.






          share|improve this answer
























          • I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

            – bornruffians
            Oct 1 '18 at 13:32











          • Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

            – bornruffians
            Oct 1 '18 at 13:48











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472076%2fsigned-kernel-modules-not-signed-with-trusted-key%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I think the kernel compilation expects the signing_key.* files in the base directory of the kernel source tree and not under a ”certs” subdirectory. The compilation process should automatically sign the standard modules for you; only third-party modules should need manual signing.



          Also, my old script for compiling a 4.9.* kernel with signed modules had the certificate file in DER format. Perhaps it was necessary?



          In the 4.14 and newer kernels, the procedure is a bit different: there is a kernel configuration option for specifying the pathname of the certificate file.






          share|improve this answer
























          • I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

            – bornruffians
            Oct 1 '18 at 13:32











          • Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

            – bornruffians
            Oct 1 '18 at 13:48
















          0














          I think the kernel compilation expects the signing_key.* files in the base directory of the kernel source tree and not under a ”certs” subdirectory. The compilation process should automatically sign the standard modules for you; only third-party modules should need manual signing.



          Also, my old script for compiling a 4.9.* kernel with signed modules had the certificate file in DER format. Perhaps it was necessary?



          In the 4.14 and newer kernels, the procedure is a bit different: there is a kernel configuration option for specifying the pathname of the certificate file.






          share|improve this answer
























          • I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

            – bornruffians
            Oct 1 '18 at 13:32











          • Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

            – bornruffians
            Oct 1 '18 at 13:48














          0












          0








          0







          I think the kernel compilation expects the signing_key.* files in the base directory of the kernel source tree and not under a ”certs” subdirectory. The compilation process should automatically sign the standard modules for you; only third-party modules should need manual signing.



          Also, my old script for compiling a 4.9.* kernel with signed modules had the certificate file in DER format. Perhaps it was necessary?



          In the 4.14 and newer kernels, the procedure is a bit different: there is a kernel configuration option for specifying the pathname of the certificate file.






          share|improve this answer













          I think the kernel compilation expects the signing_key.* files in the base directory of the kernel source tree and not under a ”certs” subdirectory. The compilation process should automatically sign the standard modules for you; only third-party modules should need manual signing.



          Also, my old script for compiling a 4.9.* kernel with signed modules had the certificate file in DER format. Perhaps it was necessary?



          In the 4.14 and newer kernels, the procedure is a bit different: there is a kernel configuration option for specifying the pathname of the certificate file.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 1 '18 at 0:25









          telcoMtelcoM

          18.6k12347




          18.6k12347













          • I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

            – bornruffians
            Oct 1 '18 at 13:32











          • Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

            – bornruffians
            Oct 1 '18 at 13:48



















          • I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

            – bornruffians
            Oct 1 '18 at 13:32











          • Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

            – bornruffians
            Oct 1 '18 at 13:48

















          I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

          – bornruffians
          Oct 1 '18 at 13:32





          I tried specifying SYSTEM_TRUSTED_KEYS=certs/signing_key.pem, but the result was the same. I think you are on to something regarding paths though.

          – bornruffians
          Oct 1 '18 at 13:32













          Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

          – bornruffians
          Oct 1 '18 at 13:48





          Another data point: I did not create the files certs/signing_key.*. They were created during the kernel build process at that location. That's why I'm a bit confused why the kernel isn't pulling the key in by default.

          – bornruffians
          Oct 1 '18 at 13:48


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f472076%2fsigned-kernel-modules-not-signed-with-trusted-key%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          CARDNET

          Boot-repair Failure: Unable to locate package grub-common:i386

          濃尾地震