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

Windows conjur logon #98

Closed tomcruise81 closed 3 years ago

tomcruise81 commented 3 years ago
cybr conjur logon -b ... -a ... -l ...
Enter password:
Replace ~/.conjurrc file [y]: n
2021/03/09 09:59:14 open C:\Users\[USERNAME]/.conjurrc: The system cannot find the file specified.

Looks like it might be tied to https://github.com/infamousjoeg/cybr-cli/blob/main/pkg/cybr/conjur/netrc.go#L24 and the fact that it's not including a call to filepath.FromSlash(...), though you could also put a normalizing call to it right before https://github.com/infamousjoeg/cybr-cli/blob/main/pkg/cybr/conjur/conjurrc.go#L111.

AndrewCopeland commented 3 years ago

And you have validated that the C:\Users\[USERNAME]\.conjurrc does exist?

I also agree that we will need to include the filepath.FromSlash() comment.

Will test in my lab.

Thanks for using the cybr-cli!

infamousjoeg commented 3 years ago

@tomcruise81 Can you take a look at PR #99 and give it a test. This should resolve your issue. If it does, I'll go ahead and squash and merge it for staging to release in v0.1.2-beta.

Thanks!

tomcruise81 commented 3 years ago

@AndrewCopeland - no it doesn't exist. My assumption was that you'd utilize the information I provided to create one if one doesn't exist.

@infamousjoeg - I've tested the code and found one additional change that is needed. Wherever you have:

answer := strings.Replace(text, "\n", "", -1)

you'll need to change it to something like:

answer := strings.TrimSpace(text)

to deal with Windows including "\r\n" on STDIN presses.

Thanks!

AndrewCopeland commented 3 years ago

Good to know thats how strings.TrimSpace() behaves, I have made the proposed changes.