Import Existing Certificates #155
Replies: 21 comments
-
Hey there @smokey7722. Sorry for the delay, holidays and such :) Is this still a need? If so, just let me know and I can start looking into it. As of today, this functionality doesn't exist. |
Beta Was this translation helpful? Give feedback.
-
Yup still needed. I've been working on doing it manually but haven't gotten it working entirely yet so would love to see if it could be added to your module if not too difficult! |
Beta Was this translation helpful? Give feedback.
-
Here's an initial cut at the code. Could you test this out a bit and see what's missing/not working? |
Beta Was this translation helpful? Give feedback.
-
I feel extremely stupid asking this but I don't see a change in that branch? I downloaded the code and looked through but am not seeing an update in it? |
Beta Was this translation helpful? Give feedback.
-
Sorry about that, it wasn't you. Not sure what happened with vscode, but it was unhappy about something and supposedly uploaded the files, but didn't. Should be good now. Here are the updates. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I'll try to take a look at this today. |
Beta Was this translation helpful? Give feedback.
-
I was able to get some testing in today and it looks like the creation does work perfectly! I'm going to run some tests to see how updating a cert functions but so far this all looks great. Update: I ran a few tests for updating/replacing a certificate and it looks to work exactly as expected. So far I have not found any issues at all. |
Beta Was this translation helpful? Give feedback.
-
Some further testing I think I am running into an issue. This is the process I followed: Expected behavior: Steps:
Result: This is putting this new certificatedata into step 1's Venafi object and does not create a second object as expected based on the unique name and certificatedata. Initially I ran steps 1 and 2 immediately after each other and saw the issue. I then went back and ran Step 1, then opened a new powershell prompt and tppsession and ran Step 2. The result is the same though. |
Beta Was this translation helpful? Give feedback.
-
Can you please run the command with -verbose and send me those details and errors received? |
Beta Was this translation helpful? Give feedback.
-
I'll have the output to you later today, thanks! |
Beta Was this translation helpful? Give feedback.
-
Below are the two imports. Unfortunately to me they don't seem to include any useful data but maybe they do to you. FYI I did have to sanitize the cert data (corp security team requirements even though its a public cert) in the log entries below. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to troubleshoot this on my side but haven't found any leads yet. Let me know if you haven't been able to reproduce or if could use any additional info. There aren't any errors, its just the multiple certs are being added to the same Venafi object rather than creating individual objects. |
Beta Was this translation helpful? Give feedback.
-
One thing I would try is to use the |
Beta Was this translation helpful? Give feedback.
-
I just tried it with |
Beta Was this translation helpful? Give feedback.
-
Playing with it more, I am guessing this may be due to the Common Name matching between these certificates. These are all Azure application certificates so the Common Name will always be "Microsoft Azure Federated SSO Certificate". By adding |
Beta Was this translation helpful? Give feedback.
-
What's interesting is that Venafi has the default as overwrite/replace, but that didn't make sense to me as it's more destructive. I'm inclined to keep it as is, but let me know your thoughts. Here is the description of the parameter as they document it...
|
Beta Was this translation helpful? Give feedback.
-
The interesting thing is that when I have it set to |
Beta Was this translation helpful? Give feedback.
-
Yeah, that is odd, overwrite should "import and replace". I'm thinking my parameter name of @tr1ck3r or @BeardedPrincess, can you see the last couple of messages and provide your thoughts please? |
Beta Was this translation helpful? Give feedback.
-
@gdbarron and @smokey7722 Sorry it took me so long to notice this! Your parameter -Overwrite is engaging the reconcile parameter in the TPP function by setting it to false. This parameter was added specifically to force TPP to not try and reconcile certificates into history (so each cert imported would be a unique object). I've attached the reconciliation logic from the TPP docs, hopefully that will help understand how it's doing that logic. I think the issue is that if you tell the system not to reconcile certs, you get the ability to tell which object they get imported into. If you allow TPP to reconcile, then a new object will only get created if the cert being imported is not already "related" to some other cert in the system. |
Beta Was this translation helpful? Give feedback.
-
@smokey7722, it's been a while, but I have added this functionality, https://www.powershellgallery.com/packages/VenafiTppPS/2.0.1. I've decided to go with the approach Venafi took and provide a @BeardedPrincess, thanks as always for the great info. |
Beta Was this translation helpful? Give feedback.
-
Thanks, I'll take a look, modify my usage accordingly and let you know if I run into any issues! |
Beta Was this translation helpful? Give feedback.
-
Is it possible to use your module to import existing certificates? Looks like from the SDK that would be "POST Certificates/Import" and/or "POST Discovery/Import". I am looking to import existing Base64 certificates (no private keys available), followed by manually setting them as User Certificate type (this part I haven't found in the SDK on how to manually set).
Before I go down the rabbit hole of coding this without using your module, I figured it would be worth posting and asking.
Thanks in advance for all your great work!
Beta Was this translation helpful? Give feedback.
All reactions