pspete / psPAS

PowerShell module for CyberArk Privileged Access Security REST API
https://pspas.pspete.dev
MIT License
293 stars 91 forks source link

PowerShell SecretManagement Extension? #317

Closed gregharms closed 3 years ago

gregharms commented 3 years ago

Is your feature request related to a problem? Please describe. Microsoft PowerShell SecretManagement module (still in preview) can be extended, but no CyberArk PAS extension yet on PowerShell Gallery. I'm intrigued by the idea of obtaining secrets from my CyberArk PAS vault via this new cross-platform module from Microsoft.

Describe the solution you'd like A SecretManagement extension that can talk to CyberArk PAS.

Describe alternatives you've considered I'm considering building my own SecretManagement.CyberArkPAS module but I'm realizing my favored path would likely be wrappers around existing functions in psPAS. For example, Get-SecretInfo would be calling Get-PASAccount. So thought before I get too deep into development, asking here to see if it would fit better as an added capability of psPAS or a peer project within pspete's great collection of CyberArk projects.

Additional context https://github.com/PowerShell/SecretManagement

pspete commented 3 years ago

No doubt this would be a great project. If it helps, psPAS will only contain features/commands which directly interact with the CyberArk API endpoints; by all means, use the available psPAS commands to create the extension, it is this kind of project which perfectly encapsulates why psPAS was developed 😃 I'd be happy to contribute/collaborate...

gregharms commented 3 years ago

I'll update this thread if/when I get capacity to work on this. Or if someone else gets some time to tackle it they might come across the issue and update us all.

Thanks for the reply!

aaearon commented 3 years ago

I took this an opportunity to expand my PowerShell knowledge and came up with https://github.com/aaearon/SecretManagement.CyberArk. In the end, it just wraps a lot of psPAS modules.

Couple of notes:

In addition to that, I am struggling to find a use case for this myself. Maybe I am not 'getting it' but it feels like using just psPAS without SecretManagement would be a lot more straightforward.

NathanielMaier commented 3 years ago

Looks great, @aaearon! I don't have an immediate use case, but I'm wondering if this would help write product-agnostic code. It looks like you'd still have to handle the New-PASSession piece before using Set-Secret/Get-Secret with your extension, but then switching out to a different SecretManagement extension should be easier.

So the "secret zero" problem about having a password to login with New-PASSession - typically could be solved with pspete's CredentialRetriever module. Would there be a way to allow that to be used from this SecretManagement extension in addition to psPAS? It'd be slick if you could Get-Secret using the CCP or CP and then Set-Secret to add something with psPAS.

pspete commented 3 years ago

Closing this issue, further discussion can be raised on the https://github.com/aaearon/SecretManagement.CyberArk repo 😃