cyberark / ansible-security-automation-collection

CyberArk Ansible Security Automation Collection
MIT License
60 stars 37 forks source link

handling of persistency cookies #69

Open ELANDJEA opened 6 months ago

ELANDJEA commented 6 months ago

Is your feature request related to a problem? Please describe.

We want to utilize Ansible to publish root accounts of newly deployed servers. However, when we utilize the ansible modules to use the PVWA path through our netscaler loadbalancers, we get error "401" (unauthorized)......when we use an "api_base_url" pointing directly to one of the servers behind the loadbalancer the logon and provisioning functions as expected.

At this point we think this is result of the (within our organisation) standard configuration of the netscalers, which provides a cookie to handle session persistancy (https://docs.netscaler.com/en-us/citrix-adc/current-release/load-balancing/load-balancing-persistence/http-cookie-persistence.html)

Describe the solution you would like

within powershell rest calls (invoke-restmethod), there are options to use a websession/sessionvariable to parse cookie info during a restcall (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7.4)....making the used loadbalancer config "transparent" for the restcall.

is it possible to also build such handling in the Ansible cyberark authentication modules to also make it possible to use session persistency based on cookies?

Describe alternatives you have considered

A clear and concise description of any alternative solutions or features that may be related to this that you have considered.

Additional context

code and results sofar:

failure code

fatal: [localhost]: FAILED! => changed=false headers: Authorization: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER Content-Type: application/json User-Agent: CyberArk/1.0 (Ansible; cyberark.pas) msg: |- Error while performing get_account.Please validate parameters provided. * end_point=**/PasswordVault/api/accounts?filter=safeName%20eq%20T-LINUX-ROOT&search=srv9999.localdns.nl ==> HTTP Error 401: Unauthorized status_code: 401

szh commented 6 months ago

@cyberark-bizdev @infamousjoeg

Danjaraka commented 1 week ago

Currently facing the exact same issue in my organization...

Our current workaround is to use the Ansible URI module and manually making the REST calls.