Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Certificate for specific user can result in duplicate certificates in store #3661

Closed
MJRichardson opened this issue Jul 12, 2017 · 3 comments
Assignees
Labels
feature/certificates kind/bug This issue represents a verified problem we are committed to solving

Comments

@MJRichardson
Copy link

To reproduce:

  1. Use the Import Certificate step to import a certificate for a specified user
  2. Execute code as the specified user which reads the certificate from the store using the X509Store class.
  3. Repeat step 1

This should result in this code being executed in Calamari.

Instead, the certificate is again added to the store.

Reported by http://help.octopusdeploy.com/discussions/problems/55611

@MJRichardson MJRichardson added area/scale kind/bug This issue represents a verified problem we are committed to solving feature/certificates labels Jul 12, 2017
@MJRichardson MJRichardson self-assigned this Jul 12, 2017
@MJRichardson
Copy link
Author

@MJRichardson
Copy link
Author

This issue appears to occur when the certificate was initially imported not by Octopus (i.e. a user other than the user the Tentacle executes as).

The certificate file is written to different places, depending on the circumstances.

For example, it seems that when Octopus imports the certificate for another user (i.e. not the Tentacle) it writes the certificate to the user's registry.

HKEY_USERS
   UserName
      Software
         Microsoft
            SystemCertificates

Then, when accessing the certificate as that user, the certificate is moved to their roaming profile:

C:\Users\UserName\AppData\Roaming\Microsoft\SystemCertificates\My\Certificates

At this point, importing the certificate again with Octopus may cause the problem; effectively two certificates in the store.

Unfortunately the Windows Crypto API (CAPI) code is not open-source. And I can't find any definitive documentation for the behaviour in situations like this.

Given we are relying on the Windows libraries, I'm not sure exactly how we would resolve this.

I have added a recommendation to our docs to allow Octopus to perform the initial import.

@lock
Copy link

lock bot commented Nov 23, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. If you think you've found a related issue, please contact our support team so we can triage your issue, and make sure it's handled appropriately.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature/certificates kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

1 participant