infamousjoeg / cybr-cli

A "Swiss Army Knife" command-line interface (CLI) for easy human and non-human interaction with @CyberArk suite of products.
Apache License 2.0
71 stars 15 forks source link

Client.Timeout exceeded while awaiting headers #69

Closed cbarga closed 3 years ago

cbarga commented 3 years ago

Describe the bug When retrieving a secret, client timeout error occurs.

To Reproduce

[clb10@C02QX3NQFVH5MBP ~/add_account]# cybr conjur get-secret QA-CyberArkVault/Jenkins/DAP_Automation/dap_automation-cyberark/username 2021/02/02 14:20:50 Failed to retrieve secret variable ''. Post "https://conjurmaster-qa./authn//admin/authenticate": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Expected behavior

[clb10@C02QX3NQFVH5MBP ~/add_account]# curl -H "$(conjur authn authenticate -H)" https://conjurmaster-qa.,fqdn>/secrets//variable/QA-CyberArkVault%2FJenkins%2FDAP_Automation%2Fdap_automation-cyberark%2Fusername ChrisB

Screenshots

Screen Shot 2021-02-02 at 14 25 52

Desktop (please complete the following information):

Additional context In the screenshot, you can see that the direct curl and conjur-cli methods work, while the cybr-cli and summon-conjur methods get a timeout. I would think they all use the same API under the covers. This has only been happening for the past few days. summon-conjur works as expected from another server.

[root@lncd906 DAP_Octopus]# /usr/local/lib/summon/summon-conjur QA-CyberArkVault/Jenkins/DAP_Automation/dap_automation-cyberark/username ChrisB

AndrewCopeland commented 3 years ago

The error is occurring at the authentication stage. The CLI will authenticate (to get the conjur access token) and then use that conjur access token to retrieve the secret.

This is using the following library: https://github.com/cyberark/conjur-api-go

I will have to dive into this code to see what the timeout is being set as. It might be very small hence the reason the issue is intermediate and/or related to the network topology from your local machine to the target conjur instance.

Thank you for creating this issue.

AndrewCopeland commented 3 years ago

The client timeout is being sent here within the conjur-api-go library: https://github.com/cyberark/conjur-api-go/blob/b3f7d8f046f8d48d072fa028217d1add8a5a294e/conjurapi/client.go#L227

Is it failing after 10 seconds? Or is it failing quicker?

How quickly is the secret being retrieved from the conjur-cli? How quickly is the secret being retrieved from the curl comand?

Thanks, Andrew

cbarga commented 3 years ago

Yeah, it looks like it's failing right after 10 seconds. [clb10@C02QX3NQFVH5MBP ~/add_account]# time curl -H "$(conjur authn authenticate -H)" https://conjurmaster-qa.fqdn/secrets/account/variable/QA-CyberArkVault%2FJenkins%2FDAP_Automation%2Fdap_automation-cyberark%2FusernameChrisBreal 0m1.730suser 0m0.805ssys 0m0.521s[clb10@C02QX3NQFVH5MBP ~/add_account]# time cybr conjur get-secret QA-CyberArkVault/Jenkins/DAP_Automation/dap_automation-cyberark/username2021/02/03 16:13:06 Failed to retrieve secret variable ''. Post "https://conjurmaster-qa.fqdn/authn/account/admin/authenticate": context deadline exceeded (Client.Timeout exceeded while awaiting headers) real 0m10.094suser 0m0.016ssys 0m0.033s[clb10@C02QX3NQFVH5MBP ~/add_account]# time conjur variable value QA-CyberArkVault/Jenkins/DAP_Automation/dap_automation-cyberark/username;echoChrisBreal 0m1.736suser 0m0.804ssys 0m0.532s [clb10@C02QX3NQFVH5MBP ~/add_account]# time /usr/local/Cellar/summon-conjur/0.5.3/lib/summon/summon-conjur -v QA-CyberArkVault/Jenkins/DAP_Automation/dap_automation-cyberark/usernameERROR Post https://conjurmaster-qa.fqdn/authn/account/admin/authenticate: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) real 0m10.292suser 0m0.014ssys 0m0.031s

On Wednesday, February 3, 2021, 03:11:30 PM EST, Andrew Copeland <notifications@github.com> wrote:  

The client timeout is being sent here within the conjur-api-go library: https://github.com/cyberark/conjur-api-go/blob/b3f7d8f046f8d48d072fa028217d1add8a5a294e/conjurapi/client.go#L227

Is it failing after 10 seconds? Or is it failing quicker?

How quickly is the secret being retrieved from the conjur-cli? How quickly is the secret being retrieved from the curl comand?

Thanks, Andrew

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

AndrewCopeland commented 3 years ago

Resolved in linked issue above.