Hello,
We have a Conjur EE PoC/Demo that has been setup by Cyberark and I believe I’ve retrieved my API Key however when I am using the Python CLI I get the following response back:
Getting the API Key
> curl --silent --verbose --insecure --user ${USER}:${PASSWORD} ${URL}/authn/${ACCOUNT}/login
>
>
> < HTTP/1.1 200 OK
> < Server: nginx
> < Date: Fri, 20 Sep 2019 08:14:45 GMT
> < Content-Type: text/html; charset=utf-8
> < Transfer-Encoding: chunked
> < Connection: keep-alive
> < X-Frame-Options: SAMEORIGIN
> < X-XSS-Protection: 1; mode=block
> < X-Content-Type-Options: nosniff
> < ETag: W/"d6b622cb43a2740bb4eeb552f03ac06e"
> < Cache-Control: max-age=0, private, must-revalidate
> < X-Request-Id: c8df728b-e6bc-4210-9104-8dcbff4e1d83
> < X-Runtime: 0.287601
> <
> * Connection #0 to host <redacted>.eu-west-1.compute.amazonaws.com left intact
> REDACTED396m0ya27wvvez1qsef4g1ydtf702a3rvepndk46r20m1q0a3x2ymzb%
And here is the response, is this the correct way to authenticate as the docs don’t make it quite clear:
> conjur-cli --debug --verbose --insecure --url ${URL} --account ${ACCOUNT} --api-key ${CONJUR_API_KEY} list
> 2019-09-20 09:16:07,778 INFO: Initializing configuration...
> 2019-09-20 09:16:07,778 INFO: Not all expected variables were provided. Using conjurrc as credential store...
> 2019-09-20 09:16:07,778 INFO: Trying to get configuration from filesystem (/Users/jimsmith/.conjurrc)...
> 2019-09-20 09:16:07,780 INFO: Trying to get API key from netrc...
> Traceback (most recent call last):
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/lib/python3.7/site-packages/conjur/client.py", line 70, in __init__
> on_disk_config = dict(api_config_class())
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/lib/python3.7/site-packages/conjur/config.py", line 57, in __init__
> netrc_obj = netrc.netrc(netrc_file)
> File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/netrc.py", line 30, in __init__
> self._parse(file, fp, default_netrc)
> File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/netrc.py", line 63, in _parse
> "bad toplevel token %r" % tt, file, lexer.lineno)
> netrc.NetrcParseError: bad toplevel token 'REDACTED396m0ya27wvvez1qsef4g1ydtf702a3rvepndk46r20m1q0a3x2ymzb' (/Users/jimsmith/.netrc, line 2)
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/bin/conjur-cli", line 10, in <module>
> sys.exit(Cli.launch())
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/lib/python3.7/site-packages/conjur/cli.py", line 178, in launch
> Cli().run()
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/lib/python3.7/site-packages/conjur/cli.py", line 107, in run
> Cli.run_client_action(resource, args)
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/lib/python3.7/site-packages/conjur/cli.py", line 132, in run_client_action
> debug=args.debug)
> File "/Users/jimsmith/Workspace/virtualenv/conjur-ee-poc-ce-python3.7/lib/python3.7/site-packages/conjur/client.py", line 80, in __init__
> raise ConfigException(exc)
> conjur.client.ConfigException: bad toplevel token 'REDACTED396m0ya27wvvez1qsef4g1ydtf702a3rvepndk46r20m1q0a3x2ymzb' (/Users/jimsmith/.netrc, line 2)
ls -la ~/.netrc ; cat ~/.netrc
-rw-r--r-- 1 jimsmith staff 56 Sep 20 09:18 /Users/jimsmith/.netrc
REDACTED396m0ya27wvvez1qsef4g1ydtf702a3rvepndk46r20m1q0a3x2ymzb