Getting PKCS11 to read the correct CN on an AD CA signed cert












0















So i've done a lot of testing the past week on this and it seems that opensc_pkcs11 only reads the very first CN on a certificate which is very annoying. I've been generating the certs via AD which maps the CN the user is in as well as the CN of the user. So Centos/Ubuntu read the cert as being for "Users" and not for "bfrown".



Now if I write the certificate on my FreeIPA server I can load it into the userCertificate attribute and it correctly recognizes and authenticates the cert against the user. I figured I could do this via the userCertificate attribute on AD as well so I did an ldapmodify and loaded it onto bfrown, I can see it if I do a Get-ADUser and view the properties but it's not verifying it at all. I have my sssd.conf with [pam] set to pam_cert_auth = True and ldap_user_certificate = userCertificate:binary but it still fails to properly pop up a smartcard login on GDM gui.



The certificates correctly map to their users in the context of, if the cert is for "CN=Users,CN=bfrown" and it can map bfrown to a user on the linux system or through SSSD against the domain, it will login as bfrown, and you can't use that same cert to login as "CN=Users,CN=notbfrown" on the same domain...I just hate that it says "Welcome Users!" at the prompt and feel there has to be same way to make it read the last CN in the cert instead of the very first or something...



Looking at .crt on Windows it reads as "CN=btown,CN=Users,DC=example,DC=com" but on linux it's reversed in being "DC=com,DC=example,CN=Users,CN=btown". Opensc grabs that first CN and just uses that as the prompt when issuing a "Welcome".









share







New contributor




btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    So i've done a lot of testing the past week on this and it seems that opensc_pkcs11 only reads the very first CN on a certificate which is very annoying. I've been generating the certs via AD which maps the CN the user is in as well as the CN of the user. So Centos/Ubuntu read the cert as being for "Users" and not for "bfrown".



    Now if I write the certificate on my FreeIPA server I can load it into the userCertificate attribute and it correctly recognizes and authenticates the cert against the user. I figured I could do this via the userCertificate attribute on AD as well so I did an ldapmodify and loaded it onto bfrown, I can see it if I do a Get-ADUser and view the properties but it's not verifying it at all. I have my sssd.conf with [pam] set to pam_cert_auth = True and ldap_user_certificate = userCertificate:binary but it still fails to properly pop up a smartcard login on GDM gui.



    The certificates correctly map to their users in the context of, if the cert is for "CN=Users,CN=bfrown" and it can map bfrown to a user on the linux system or through SSSD against the domain, it will login as bfrown, and you can't use that same cert to login as "CN=Users,CN=notbfrown" on the same domain...I just hate that it says "Welcome Users!" at the prompt and feel there has to be same way to make it read the last CN in the cert instead of the very first or something...



    Looking at .crt on Windows it reads as "CN=btown,CN=Users,DC=example,DC=com" but on linux it's reversed in being "DC=com,DC=example,CN=Users,CN=btown". Opensc grabs that first CN and just uses that as the prompt when issuing a "Welcome".









    share







    New contributor




    btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      So i've done a lot of testing the past week on this and it seems that opensc_pkcs11 only reads the very first CN on a certificate which is very annoying. I've been generating the certs via AD which maps the CN the user is in as well as the CN of the user. So Centos/Ubuntu read the cert as being for "Users" and not for "bfrown".



      Now if I write the certificate on my FreeIPA server I can load it into the userCertificate attribute and it correctly recognizes and authenticates the cert against the user. I figured I could do this via the userCertificate attribute on AD as well so I did an ldapmodify and loaded it onto bfrown, I can see it if I do a Get-ADUser and view the properties but it's not verifying it at all. I have my sssd.conf with [pam] set to pam_cert_auth = True and ldap_user_certificate = userCertificate:binary but it still fails to properly pop up a smartcard login on GDM gui.



      The certificates correctly map to their users in the context of, if the cert is for "CN=Users,CN=bfrown" and it can map bfrown to a user on the linux system or through SSSD against the domain, it will login as bfrown, and you can't use that same cert to login as "CN=Users,CN=notbfrown" on the same domain...I just hate that it says "Welcome Users!" at the prompt and feel there has to be same way to make it read the last CN in the cert instead of the very first or something...



      Looking at .crt on Windows it reads as "CN=btown,CN=Users,DC=example,DC=com" but on linux it's reversed in being "DC=com,DC=example,CN=Users,CN=btown". Opensc grabs that first CN and just uses that as the prompt when issuing a "Welcome".









      share







      New contributor




      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      So i've done a lot of testing the past week on this and it seems that opensc_pkcs11 only reads the very first CN on a certificate which is very annoying. I've been generating the certs via AD which maps the CN the user is in as well as the CN of the user. So Centos/Ubuntu read the cert as being for "Users" and not for "bfrown".



      Now if I write the certificate on my FreeIPA server I can load it into the userCertificate attribute and it correctly recognizes and authenticates the cert against the user. I figured I could do this via the userCertificate attribute on AD as well so I did an ldapmodify and loaded it onto bfrown, I can see it if I do a Get-ADUser and view the properties but it's not verifying it at all. I have my sssd.conf with [pam] set to pam_cert_auth = True and ldap_user_certificate = userCertificate:binary but it still fails to properly pop up a smartcard login on GDM gui.



      The certificates correctly map to their users in the context of, if the cert is for "CN=Users,CN=bfrown" and it can map bfrown to a user on the linux system or through SSSD against the domain, it will login as bfrown, and you can't use that same cert to login as "CN=Users,CN=notbfrown" on the same domain...I just hate that it says "Welcome Users!" at the prompt and feel there has to be same way to make it read the last CN in the cert instead of the very first or something...



      Looking at .crt on Windows it reads as "CN=btown,CN=Users,DC=example,DC=com" but on linux it's reversed in being "DC=com,DC=example,CN=Users,CN=btown". Opensc grabs that first CN and just uses that as the prompt when issuing a "Welcome".







      linux smartcard





      share







      New contributor




      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 4 mins ago









      btownbtown

      1




      1




      New contributor




      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      btown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          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
          });


          }
          });






          btown is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f495548%2fgetting-pkcs11-to-read-the-correct-cn-on-an-ad-ca-signed-cert%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          btown is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          btown is a new contributor. Be nice, and check out our Code of Conduct.













          btown is a new contributor. Be nice, and check out our Code of Conduct.












          btown is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f495548%2fgetting-pkcs11-to-read-the-correct-cn-on-an-ad-ca-signed-cert%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

          Histoire des bourses de valeurs

          Why is there Russian traffic in my log files?

          Rename multiple files to decrement number in file name?