Skip to content

Instantly share code, notes, and snippets.

@drewsonne
Last active March 8, 2018 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewsonne/b451613ce7795b203e74b90ababace5a to your computer and use it in GitHub Desktop.
Save drewsonne/b451613ce7795b203e74b90ababace5a to your computer and use it in GitHub Desktop.
onelogin-aws-cli daemon
drews@mbp: ~/Development/onelogin-aws-cli
$ onelogin-aws-daemon
2018-03-08 09:28:29 [debug ] initialise component=daemon-server host=127.0.0.1 port=53819
2018-03-08 09:28:29 [info ] start address=http://127.0.0.1:53819 component=daemon-server host=127.0.0.1 name=1.0.0.127.in-addr.arpa port=53819
2018-03-08 09:28:30 [info ] authentication action=check component=auth-process
2018-03-08 09:28:35 [info ] authentication action=check component=auth-process
2018-03-08 09:28:41 [info ] authentication action=check component=auth-process
2018-03-08 09:28:41 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:28:46 [info ] authentication action=check component=auth-process
2018-03-08 09:28:52 [info ] authentication action=check component=auth-process
2018-03-08 09:28:54 [debug ] set-password component=auth-process
2018-03-08 09:28:54 [info ] status status=<OneLoginAWSAuthStatus.PENDING: 1>
2018-03-08 09:28:54 [info ] request component=request-handler message="POST / HTTP/1.1" 200 -
2018-03-08 09:28:55 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:28:56 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:28:57 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:28:57 [info ] authentication action=check component=auth-process
2018-03-08 09:28:57 [warning ] authentication action=no-aws-credentials component=auth-process message=The config profile (default) could not be found
2018-03-08 09:28:58 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:28:59 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:00 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:01 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:02 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:02 [info ] authentication action=check component=auth-process
2018-03-08 09:29:03 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:05 [debug ] set-username component=auth-process username=**************
2018-03-08 09:29:05 [info ] status status=<OneLoginAWSAuthStatus.WAITING_FOR_OTP|PENDING: 17>
2018-03-08 09:29:05 [info ] request component=request-handler message="POST / HTTP/1.1" 200 -
2018-03-08 09:29:06 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:07 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:08 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:08 [info ] authentication action=check component=auth-process
2018-03-08 09:29:08 [warning ] authentication action=no-aws-credentials component=auth-process message=The config profile (default) could not be found
2018-03-08 09:29:09 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:10 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:10 [info ] process-mfa component=saml
2018-03-08 09:29:10 [info ] process-mfa component=saml device=None missing=True token=None
2018-03-08 09:29:11 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:15 [info ] authentication action=check component=auth-process
2018-03-08 09:29:15 [warning ] authentication action=no-aws-credentials component=auth-process message=The config profile (default) could not be found
2018-03-08 09:29:17 [info ] process-mfa component=saml
2018-03-08 09:29:17 [info ] process-mfa component=saml device=None missing=True token=None
2018-03-08 09:29:21 [debug ] set-mfa-service component=auth-process device_id=671172
2018-03-08 09:29:21 [info ] status status=<OneLoginAWSAuthStatus.WAITING_FOR_OTP|PENDING: 17>
2018-03-08 09:29:21 [debug ] provide-otp component=auth-process
2018-03-08 09:29:21 [info ] status status=<OneLoginAWSAuthStatus.PENDING: 1>
2018-03-08 09:29:21 [debug ] reset-status component=auth-process
2018-03-08 09:29:21 [info ] status status=<OneLoginAWSAuthStatus.AUTHENTICATING: 8>
2018-03-08 09:29:21 [info ] request component=request-handler message="POST / HTTP/1.1" 200 -
2018-03-08 09:29:22 [info ] authentication action=check component=auth-process
2018-03-08 09:29:22 [warning ] authentication action=no-aws-credentials component=auth-process message=The config profile (default) could not be found
2018-03-08 09:29:23 [info ] process-mfa component=saml
2018-03-08 09:29:23 [info ] process-mfa component=saml device=Namespace(id='=******') missing=False token=******
2018-03-08 09:29:29 [debug ] set-mfa-service component=auth-process device_id=671172
2018-03-08 09:29:29 [info ] status status=<OneLoginAWSAuthStatus.WAITING_FOR_OTP_DEVICE|WAITING_FOR_OTP|AUTHENTICATING: 56>
2018-03-08 09:29:29 [debug ] provide-otp component=auth-process
2018-03-08 09:29:29 [info ] status status=<OneLoginAWSAuthStatus.WAITING_FOR_OTP_DEVICE|AUTHENTICATING: 40>
2018-03-08 09:29:29 [debug ] reset-status component=auth-process
2018-03-08 09:29:29 [info ] status status=<OneLoginAWSAuthStatus.AUTHENTICATING: 8>
2018-03-08 09:29:29 [info ] request component=request-handler message="POST / HTTP/1.1" 200 -
2018-03-08 09:29:29 [info ] authentication action=check component=auth-process
2018-03-08 09:29:29 [warning ] authentication action=no-aws-credentials component=auth-process message=The config profile (default) could not be found
2018-03-08 09:29:30 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:31 [info ] process-mfa component=saml
2018-03-08 09:29:31 [info ] process-mfa component=saml device=Namespace(id='=******') missing=False token==******
Credentials cached in '/Users/drews/.aws/credentials'
Expires at 2018-03-08 10:29:34+00:00
Use aws cli with --profile default
2018-03-08 09:29:36 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
2018-03-08 09:29:39 [info ] authentication action=check component=auth-process
2018-03-08 09:29:39 [info ] authentication Account=440474553311 Arn=arn:aws:sts::=******:assumed-role/OneLogin-=******/drew.sonne@*****.com ResponseMetadata={'RequestId': '39a030af-22b3-11e8-b54a-5f46acadfb6e', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': '39a030af-22b3-11e8-b54a-5f46acadfb6e', 'content-type': 'text/xml', 'content-length': '466', 'date': 'Thu, 08 Mar 2018 09:29:39 GMT'}, 'RetryAttempts': 0} UserId=*****:drew.sonne@*****
.com
2018-03-08 09:29:48 [info ] request component=request-handler message="GET / HTTP/1.1" 200 -
Killed: 9
drews@mbp: ~/Development/onelogin-aws-cli
$ onelogin-aws-login --client
Password:
Username: drew.sonne@*****
.com
1. Yubico YubiKey
2. OneLogin Protect
Which OTP Device? 2
OTP Token: 057962
1. Yubico YubiKey
2. OneLogin Protect
Which OTP Device? 2
OTP Token: 857962
2018-03-08 09:29:30 [info ] waiting-for-mfa component=daemon-client
1. Yubico YubiKey
2. OneLogin Protect
Which OTP Device?
Traceback (most recent call last):
File "/Users/drews/Dropbox/Development/onelogin-aws-cli/.direnv/python-3.6.3/bin/onelogin-aws-login", line 11, in <module>
load_entry_point('onelogin-aws-cli', 'console_scripts', 'onelogin-aws-login')()
File "/Users/drews/Dropbox/Development/onelogin-aws-cli/onelogin_aws_cli/cli.py", line 30, in login
api.update_credentials()
File "/Users/drews/Dropbox/Development/onelogin-aws-cli/onelogin_aws_cli/daemon/daemon.py", line 48, in update_credentials
device, token = mfa_choice(statuses['mfa_devices'])
File "/Users/drews/Dropbox/Development/onelogin-aws-cli/onelogin_aws_cli/userquery.py", line 45, in mfa_choice
device = devices[int(device_num) - 1]
ValueError: invalid literal for int() with base 10: ''
drews@mbp: ~/Development/onelogin-aws-cli
$ onelogin-aws-login --client
2018-03-08 09:29:49 [info ] authentication_ok component=daemon-client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment