Git Product home page Git Product logo

pyokta-aws-cli-assume-role's Issues

Unhandled error when NOT using MFA

Install the code and create config file as prescribed in README. mfa_choice is omitted from profile in config and is not enabled on AWS role or login. Attempt to auth to that profile yields:

Traceback (most recent call last):
  File "%LOCALAPPDATA%\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "%LOCALAPPDATA%\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "%LOCALAPPDATA%\Programs\Python\Python37\Scripts\pyokta-aws.exe\__main__.py", line 9, in <module>
  File "%LOCALAPPDATA%\programs\python\python37\lib\site-packages\pyokta_aws\__main__.py", line 26, in main
    return dispatch(sys.argv[1:])
  File "%LOCALAPPDATA%\programs\python\python37\lib\site-packages\pyokta_aws\cli.py", line 69, in dispatch
    return main(args.args)
  File "%LOCALAPPDATA%\programs\python\python37\lib\site-packages\pyokta_aws\commands\auth.py", line 99, in main
    return authenticate(auth_settings)
  File "%LOCALAPPDATA%\programs\python\python37\lib\site-packages\pyokta_aws\commands\auth.py", line 70, in authenticate
    saml = okta.get_saml_via_auth()
  File "%LOCALAPPDATA%\programs\python\python37\lib\site-packages\pyokta_aws\okta\api.py", line 151, in get_saml_via_auth
    token = self._verify_via_mfa(resp.json())
  File "%LOCALAPPDATA%\programs\python\python37\lib\site-packages\pyokta_aws\okta\api.py", line 128, in _verify_via_mfa
    "Don't know how to handle status '{}'".format(data.get('status')))
Exception: Something went wrong.
Don't know how to handle status 'SUCCESS'

I have replaced the actual path in each line with the variable %LOCALAPPDATA% to keep things generic 8-) I've been playing around in the code and it appears that it tries to check MFA methods even when the option is omitted in the profile, plus there is that return value of "SUCCESS" that _verify_via_mfa is not expecting. Is this a bug, or am I doing something wrong?

Seeing the below on Python 3.5

Ubuntu 18.04, python 3.5.2 - seems like a syntax error:

pyokta-aws auth --verbose --profile test -c ~/.pyokta_aws/config
Traceback (most recent call last):
File "/usr/local/bin/pyokta-aws", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/pyokta_aws/main.py", line 26, in main
return dispatch(sys.argv[1:])
File "/usr/local/lib/python3.5/dist-packages/pyokta_aws/cli.py", line 67, in dispatch
main = registered_commands[args.command].load()
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 2443, in load
return self.resolve()
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 2449, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.5/dist-packages/pyokta_aws/commands/auth.py", line 23, in
from pyokta_aws.okta.api import Api as OktaApi
File "/usr/local/lib/python3.5/dist-packages/pyokta_aws/okta/api.py", line 40
self.okta: OktaEndpoints = OktaEndpoints(okta_org, app_url)
^
SyntaxError: invalid syntax

I have the config file setup in the directory - not sure if this project is being maintained.

Unable to authenticate: problem with Role ARN?

I've submitted an issue before; I am now with a different employer and experiencing a different issue. I have installed the utility as directed and created the config file (see --verbose output below), but I am unable to authenticate due to an apparent issue with the Role ARN. Note that I am working in gov-cloud (not the public AWS cloud) and that services are sometimes absent or behave differently. Have you been able to test in the gov-cloud? Does the stack trace below indicate to you what might be wrong? As before, I have redacted certain information in the trace to preserve anonymity.

[me]>pyokta-aws auth --verbose -p rdt-admin
Loading settings from config file "[me]/.pyokta_aws/config"...
Using the following settings...
profile...........: rdt-admin
region............: us-gov-west-1
okta_org..........: [redacted].okta.com
okta_aws_app_url..: https://[okta-org]/home/amazon_aws/0oa46z3dyPZgL5uA24h6/272
aws_role_to_assume: arn:aws:iam::arn:aws-us-gov:iam::[aws-acct-id]:role/AdministratorViaOkta
aws_idp...........: arn:aws:iam::arn:aws-us-gov:iam::[aws-acct-id]:saml-provider/BraxtonOkta
username..........: [email protected]
password..........: <redacted>
sts_duration......: 28800
mfa_choice........: app
config_file.......: [me]/.pyokta_aws/config
verbose...........: True
interactive.......: True
Okta username: [email protected]
Enter Okta mobile app code: [auth-code]
Traceback (most recent call last):
  File "%LOCALAPPDATA%\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "%LOCALAPPDATA%\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "%LOCALAPPDATA%\Programs\Python\Python39\Scripts\pyokta-aws.exe\__main__.py", line 7, in <module>
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\pyokta_aws\__main__.py", line 26, in main
    return dispatch(sys.argv[1:])
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\pyokta_aws\cli.py", line 69, in dispatch
    return main(args.args)
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\pyokta_aws\commands\auth.py", line 99, in main
    return authenticate(auth_settings)
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\pyokta_aws\commands\auth.py", line 71, in authenticate
    resp = aws_auth_with_saml(
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\pyokta_aws\commands\auth.py", line 34, in aws_auth_with_saml
    return client.assume_role_with_saml(**data)
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\botocore\client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "%LOCALAPPDATA%\programs\python\python39\lib\site-packages\botocore\client.py", line 676, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the AssumeRoleWithSAML operation: Request ARN is invalid

[me]>

The documentation in the README seems to differ somewhat from the output of pyokta-aws -h, but I have tried numerous variations on the format of the Role ARN without success. Any suggestions will be welcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.