GithubHelp home page GithubHelp logo

aws-okta's Introduction

aws-okta

aws-okta allows you to authenticate with AWS using your Okta credentials.

⚠️ As per #278, development and maintenance of aws-okta is halted. If you're not already using it, now would be a bad time to start. ⚠️

Installing

See the wiki for more installation options.

MacOS

You can install with brew:

$ brew install aws-okta

Shout-out to the fine maintainers of the core formula.

Linux

Download a binary from our release page, or see the wiki for more installation options like deb/rpm packages.

Windows

See docs/windows.md for information on getting this working with Windows.

Usage

Adding Okta credentials

$ aws-okta add

This will prompt you for your Okta organization, custom domain, region, username, and password. These credentials will then be stored in your keyring for future use.

Exec

$ aws-okta exec <profile> -- <command>

Exec will assume the role specified by the given aws config profile and execute a command with the proper environment variables set. This command is a drop-in replacement for aws-vault exec and accepts all of the same command line flags:

$ aws-okta help exec
exec will run the command specified with aws credentials set in the environment

Usage:
  aws-okta exec <profile> -- <command>

Flags:
  -a, --assume-role-ttl duration   Expiration time for assumed role (default 1h0m0s)
  -h, --help                       help for exec
  -t, --session-ttl duration       Expiration time for okta role session (default 1h0m0s)

Global Flags:
  -b, --backend string   Secret backend to use [kwallet secret-service file] (default "file")
  -d, --debug            Enable debug logging

Exec for EKS and Kubernetes

aws-okta can also be used to authenticate kubectl to your AWS EKS cluster. Assuming you have installed kubectl, setup your kubeconfig and installed aws-iam-authenticator, you can now access your EKS cluster with kubectl. Note that on a new cluster, your Okta CLI user needs to be using the same assumed role as the one who created the cluster. Otherwise, your cluster needs to have been configured to allow your assumed role.

$ aws-okta exec <profile> -- kubectl version --short

Likewise, most Kubernetes projects should work, like Helm and Ark.

$ aws-okta exec <profile> -- helm version --short

Configuring your aws config

aws-okta assumes that your base role is one that has been configured for Okta's SAML integration by your Okta admin. Okta provides a guide for setting up that integration here. During that configuration, your admin should be able to grab the AWS App Embed URL from the General tab of the AWS application in your Okta org. You will need to set that value in your ~/.aws/config file, for example:

[okta]
aws_saml_url = home/amazon_aws/0ac4qfegf372HSvKF6a3/965

Next, you need to set up your base Okta role. This will be one your admin created while setting up the integration. It should be specified like any other aws profile:

[profile okta-dev]
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>
region = <region>

Your setup may require additional roles to be configured if your admin has set up a more complicated role scheme like cross account roles. For more details on the authentication process, see the internals section.

A more complex example

The aws_saml_url can be set in the "okta" ini section, or on a per profile basis. This is useful if, for example, your organization has several Okta Apps (i.e. one for dev/qa and one for prod, or one for internal use and one for integrations with third party providers). For example:

[okta]
# This is the "default" Okta App
aws_saml_url = home/amazon_aws/cuZGoka9dAIFcyG0UllG/214

[profile dev]
# This profile uses the default Okta app
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>

[profile integrations-auth]
# This is a distinct Okta App
aws_saml_url = home/amazon_aws/woezQTbGWUaLSrYDvINU/214
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>

[profile vendor]
# This profile uses the "integrations-auth" Okta app combined with secondary role assumption
source_profile = integrations-auth
role_arn = arn:aws:iam::<account-id>:role/<secondary-role-name>

[profile testaccount]
# This stores the Okta session in a separate item in the Keyring.
# This is useful if the Okta session is used or modified by other applications
# and needs to be isolated from other sessions. It is also useful for
# development versions or multiple versions of aws-okta running.
okta_session_cookie_key = okta-session-cookie-test
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>

The configuration above means that you can use multiple Okta Apps at the same time and switch between them easily.

Multiple Okta accounts

setup accounts:

aws-okta add --account=account-a
aws-okta add --account=account-b

define keyring key for each profile:

[profile account-a]
# This is a distinct Okta App
aws_saml_url = home/amazon_aws/woezQTbGWUaLSrYDvINU/214
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>
okta_account_name = account-a

[profile account-b]
aws_saml_url = home/amazon_aws/woezQTbGaDAA4rYDvINU/123
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>
okta_account_name = account-b

Configuring Okta assume role and AWS assume role TTLs

The default TTLs for both the initial SAML assumed role and secondary AWS assumed roles are 1 hour. This means that AWS credentials will expire every hour.

  • session-ttl: Duration of initial role assumed by Okta
  • assume-role-ttl: Duration of second role assumed

In addition to specifying session and AWS assume role TTLs with command-line flags, they can be set using environment variables.

export AWS_SESSION_TTL=1h
export AWS_ASSUME_ROLE_TTL=1h

The AWS assume role TTL can also be set per-profile in the aws config:

# Example with an initial and secondary role that are configured with a max session duration of 12 hours
[profile ttldemo]
aws_saml_url = home/amazon_aws/cuZGoka9dAIFcyG0UllG/214
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>
session_ttl = 12h

[profile ttldemo-role]
source_profile = ttldemo
role_arn = arn:aws:iam::<account-id>:role/<secondary-role-name>
assume_role_ttl = 12h

Multi-factor Authentication (MFA) configuration

If you have a single MFA factor configured, that factor will be automatically selected. By default, if you have multiple available MFA factors, then you will be prompted to select which one to use. However, if you have multiple factors and want to specify which factor to use, you can do one of the following:

  • Specify on the command line with --mfa-provider and --mfa-factor-type
  • Specify with environment variables AWS_OKTA_MFA_PROVIDER and AWS_OKTA_MFA_FACTOR_TYPE
  • Specify in your aws config with mfa_provider and mfa_factor_type

Shell completion

aws-okta provides shell completion support for BASH and ZSH via the aws-okta completion command.

Backends

We use 99design's keyring package that they use in aws-vault. Because of this, you can choose between different pluggable secret storage backends just like in aws-vault. You can either set your backend from the command line as a flag, or set the AWS_OKTA_BACKEND environment variable.

For Linux / Ubuntu add the following to your bash config / zshrc etc:

export AWS_OKTA_BACKEND=secret-service

--session-cache-single-item aka AWS_OKTA_SESSION_CACHE_SINGLE_ITEM (alpha)

This flag enables a new secure session cache that stores all sessions in the same keyring item. For macOS users, this means drastically fewer authorization prompts when upgrading or running local builds.

No provision is made to migrate sessions between session caches.

Implemented in https://github.com/segmentio/aws-okta/issues/146.

Local Development

If you're developing in Linux, you'll need to get libusb. For Ubuntu, install the libusb-1.0-0-dev or use the Dockerfile provided in the repo.

Running Tests

make test

Releasing

Pushing a new tag will cause Circle to automatically create and push a linux release. After this is done, you should run (from a mac):

$ export CIRCLE_TAG=`git describe --tags`
$ make release-mac

Analytics

aws-okta includes some usage analytics code which Segment uses internally for tracking usage of internal tools. This analytics code is turned off by default, and can only be enabled via a linker flag at build time, which we do not set for public github releases.

Internals

Authentication process

We use the following multiple step authentication:

  • Step 1 : Basic authentication against Okta
  • Step 2 : MFA challenge if required
  • Step 3 : Get AWS SAML assertion from Okta
  • Step 4 : Assume base okta role from profile with the SAML Assertion
  • Step 5 : Assume the requested AWS Role from the targeted AWS account to generate STS credentials

aws-okta's People

Contributors

aultimus avatar bazzargh avatar chippiewill avatar citruspi avatar devinburnette avatar devonbleak avatar dfuentes avatar eculver avatar ejcx avatar elementalvoid avatar eperdeme avatar fauzyy avatar garyatsegment avatar josacar avatar logan-hcg avatar logikal avatar lsowen avatar lukaszracon avatar marshallbrekka avatar mike-zorn avatar mikn avatar nickatsegment avatar prasincs avatar pryz avatar raylu avatar reverson avatar sdann avatar systemizer avatar tensho avatar vivianho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-okta's Issues

command line completion

It would be nice to add completion for the login and exec command to list the profiles over there.

I can do it in bash/zsh for I ask here if I should bake it in the CLI itself.

When I `aws-okta add` and set a password with a space character, it fails

I'm running Ubuntu 18.04, and am using the 0.19.0 binary that has been published here on GitHub.

When I try running aws-okta add, it always fails with the Failed to set credentials in your keyring when I input a password with a space character in it. However, it works fine if the password I input does not have any space characters in it (I havent tried any other whitespace characters though).

write out credentials

I understand this is based off aws-vault, but would you be interested in an option to have aws-okta write out credentials to the ~/.aws/credentials file for usage with other tools.

Okta session cookie expire

Where do you set the expire time for "okta session cookie" ? Does this come directly from okta?

It does not seem to respect our okta aws app session length at the moment, I can see the profile session cookie times out after 60 minutes but it then just creates a new cookie without auth as the okta session cookie is still available. If i delete the okta session cookie then i have to reauth after the 60 minutes

Proxy not working

I am unable to login using a proxy:

Okta organization: Blah
Okta region ([us], emea, preview):
Okta domain [us.okta.com]:
Okta username: <my username> 
Okta password:

DEBU[0016] Step: 1
DEBU[0076] Failed to validate credentials: Failed to authenticate with okta: &url.Error{Op:"Post", URL:"https://FutureAdvisor.okta.com/api/v1/authn", Err:(*http.httpError)(0xc00000d200)}
Failed to validate credentials```

The build breaks for `go get` because of analytics-go

When I follow the instructions in README, I'm getting the following

[22:28:04] [~/go/src/github.com/segmentio/aws-okta] [master *]
-> % go install
# github.com/segmentio/aws-okta/cmd
cmd/add.go:37:41: cannot convert nil to type analytics.Client
cmd/add.go:38:18: analyticsClient.Enqueue undefined (type analytics.Client has no field or method Enqueue)
cmd/add.go:41:16: undefined: analytics.NewProperties
cmd/exec.go:119:41: cannot convert nil to type analytics.Client
cmd/exec.go:120:18: analyticsClient.Enqueue undefined (type analytics.Client has no field or method Enqueue)
cmd/exec.go:123:16: undefined: analytics.NewProperties
cmd/login.go:71:41: cannot convert nil to type analytics.Client
cmd/login.go:72:18: analyticsClient.Enqueue undefined (type analytics.Client has no field or method Enqueue)
cmd/login.go:75:16: undefined: analytics.NewProperties
cmd/root.go:29:2: cannot use nil as type analytics.Client in assignment
cmd/login.go:75:16: too many errors

surely there's no Enqueue method in analytics-go's client code.. if I rip out all the analytics, it compiles fine. This looks like an internal interface that works at segment but isn't externally available or library dependency.

I'm providing the patch as a sample of what I was doing, not as a PR (obviously if people want analytics, they should be able to configure it), but please don't break the open source facing builds.

out.patch.txt

Constantly being asked for pasphrase

I have added an OKTA provider and user/pass details and can run aws cli commands. I am being prompted for my passphrase every single aws command.

Running Ubuntu 18.04 using pre-built binary.

Is there a way to disable the passphrase entirely? If I leave it blank, I am prompted for the passphrase and have to hit Enter 3 times before it executes the command.

Homebrew formula

Is there a homebrew formula for this? I can't seem to find one. It would be great to have one for easy upgrading. thanks!

Can't authenticate if App-level MFA is turned on

Summary

If the profile is connected to an Okta application that has Application Level MFA enabled, authentication fails.

OS: OS X 10.13.6
aws-okta version: aws-okta-v0.19.0-darwin-amd64 binary

Details

Prerequisites:

  • Two Okta applications: one regular, one with MFA turned on.
    okta-app-mfa Both applications are assigned to a user with ID [email protected], and both provide full read-only access to an AWS account with ID 1234567891011.
  • two profiles in ~/.aws/config for both applications:
[profile normal-app]
aws_saml_url = home/amazon_aws/XXXXXXXXXXX
role_arn = arn:aws:iam::1234567891011:role/

[profile app-with-mfa]
aws_saml_url = home/amazon_aws/YYYYYYYYYYYY
role_arn = arn:aws:iam::1234567891011:role/

Run results:

$ aws-okta -d exec normal-app -- aws ec2 describe-instances
DEBU[0000] Parsing config file /Users/john.doe/.aws/config
DEBU[0000] Using aws_saml_url from profile: normal-app
DEBU[0000] using okta provider
DEBU[0001] Failed to reuse session token, starting flow from start
DEBU[0001] Step: 1
DEBU[0001] Step: 2
DEBU[0001] Step: 3
DEBU[0004] Writing session for normal-app to keyring
DEBU[0004]  Using session HAAO, expires in 59m58.763470426s
...<successful command execution>

$ aws-okta -d exec app-with-mfa -- aws ec2 describe-instances
DEBU[0000] Parsing config file /Users/john.doe/.aws/config
DEBU[0000] Using aws_saml_url from profile: app-with-mfa
DEBU[0000] using okta provider
DEBU[0004] Failed to reuse session token, starting flow from start
DEBU[0004] Step: 1
DEBU[0005] Step: 2
DEBU[0005] Step: 3
Okta user [email protected] does not have the AWS app added to their account.  Please contact your Okta admin to make sure things are configured properly.

Session TTL is used for assume role duration on SAML-assumed roles

What this effectively means is that this construct ignores the assume_role_ttl and other ways of setting that value:

# example with a role that's configured with a max session duration of 12 hours
[profile ttldemo]
aws_saml_url = home/amazon_aws/cuZGoka9dAIFcyG0UllG/214
role_arn = arn:aws:iam::<account-id>:role/<okta-role-name>
assume_role_ttl = 12h

It instead uses the session ttl setting.

IMO we should be checking for source profile = target profile and in that case leverage assume_role_ttl and return fresh credentials on each call rather than the previously cached creds so that the expiration is more consistent. We should continue to operate as we are currently when source profile != target profile.

Can't install due to go1.10 compilation errors

I haven't used go in a while and I'm by no means an expert, but these look like compiler errors from library code.

👌 /U/valvarez
(i) go get -v github.com/segmentio/aws-okta
github.com/99designs/keyring/vendor/github.com/keybase/go-keychain
# github.com/99designs/keyring/vendor/github.com/keybase/go-keychain
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:29: cannot use nil as type _Ctype_CFDataRef in return argument
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:36: cannot convert nil to type _Ctype_CFDataRef
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:37: cannot use nil as type _Ctype_CFDataRef in return argument
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:62: cannot convert nil to type _Ctype_CFDictionaryRef
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:63: cannot use nil as type _Ctype_CFDictionaryRef in return argument
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:74: cannot convert &keys[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:74: cannot convert &values[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:87: cannot use nil as type _Ctype_CFStringRef in return argument
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:90: cannot use nil as type _Ctype_CFStringRef in return argument
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:141: cannot convert &a[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer
go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:141: too many errors
❗ /U/valvarez
(i) go version
go version go1.10 darwin/amd64

On investigation it looks like this was filed in keybase/go-keychain#20 and fixed in keybase/go-keychain#23. However,

👌 ~/c/other
(i) go get -v -f -u github.com/segmentio/aws-okta
github.com/segmentio/aws-okta (download)
github.com/99designs/keyring (download)
github.com/Sirupsen/logrus (download)
golang.org/x/crypto (download)
golang.org/x/sys (download)
github.com/aws/aws-sdk-go (download)
github.com/mitchellh/go-homedir (download)
github.com/vaughan0/go-ini (download)
golang.org/x/net (download)
github.com/skratchdot/open-golang (download)
github.com/spf13/cobra (download)
github.com/spf13/pflag (download)
github.com/99designs/keyring/vendor/github.com/keybase/go-keychain
# github.com/99designs/keyring/vendor/github.com/keybase/go-keychain
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:29: cannot use nil as type _Ctype_CFDataRef in return argument
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:36: cannot convert nil to type _Ctype_CFDataRef
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:37: cannot use nil as type _Ctype_CFDataRef in return argument
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:62: cannot convert nil to type _Ctype_CFDictionaryRef
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:63: cannot use nil as type _Ctype_CFDictionaryRef in return argument
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:74: cannot convert &keys[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:74: cannot convert &values[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:87: cannot use nil as type _Ctype_CFStringRef in return argument
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:90: cannot use nil as type _Ctype_CFStringRef in return argument
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:141: cannot convert &a[0] (type *_Ctype_CFTypeRef) to type *unsafe.Pointer
../../go/src/github.com/99designs/keyring/vendor/github.com/keybase/go-keychain/corefoundation.go:141: too many errors

still doesn't work; I'm wondering if there's a better way, or at least a documentation update (for how to install this package) is in order; does

"revision": "569a68cce0f5e9255938db33daab4ae53ace992a"
have to change?

Option to configure default MFA

The tool asks to choose MFA when running every-time:

INFO[0002] Requesting MFA. Please complete two-factor authentication with your second device
INFO[0002] Select a MFA from the following list
INFO[0002] 0: OKTA (push)
INFO[0002] 1: OKTA (token:software:totp)

And I always end up choosing the same option. It will be nice to provide this option in configuration file to avoid selecting the same option every time.

no darwin binary for v0.18.0

I know I can build this myself, but... I've started pointing others on macOS to the releases page here to grab the latest version. Happy to point them somewhere else in the interim, but could someone please add a darwin-amd64 binary for the latest release? Thanks!

login: Allow user to specify a browser path

Sometimes I like to use multiple browsers for logging into AWS (for example, when I want to compare two different environments, like prod and stage).

It would be useful to be able to specify that I'd like to log in via Safari (which is not my default browser) instead of Chrome for a particular session. I'm an OS X user.

Okta account locked out after 1 attempt

ℹ️ Overview

Hey there, we are facing an issue when running aws-okta command after 1 unsuccessful attempt.

👓 Details

We have a policy for password rotation which is quite short (30 days). This policy lead peoples to sometimes forget to re-authenticate aws-okta after a password change.

The fact is that when people are running (only once) aws-okta command without re-authenticating before, then it just lock out the user.

❓ Questions

  • Does someone already faced this kind of issue? If so do you have a solution?
  • Is there an Okta setting to change in order to avoid this?

Thanks for helping 🙏

"The handle is invalid" when prompting for password in git bash

Seems to be related to how it's handling turning off terminal echo for passphrase entry.

Administrator@EC2AMAZ-6N44Q2M MINGW64 ~
$ aws-okta -d exec fg-payer -- aws s3 ls
time="2018-05-14T20:40:12Z" level=debug msg="Parsing config file C:\Users\Administrator\.aws\config"
Enter passphrase to unlock C:\Users\Administrator/.aws-okta/: time="2018-05-14T20:40:12Z" level=debug msg="Using aws_saml_url from profile: okta"
time="2018-05-14T20:40:12Z" level=debug msg="using okta provider"
Enter passphrase to unlock C:\Users\Administrator/.aws-okta/: time="2018-05-14T20:40:12Z" level=debug msg="couldnt get okta creds from keyring: %sThe handle is invalid."
The handle is invalid.

Administrator@EC2AMAZ-6N44Q2M MINGW64 ~
$

Running latest version from github as of time of writing this.

Support reading MFA code from an environment variable

It would be very useful from an automation standpoint if you could pass the value of an MFA code via an environment variable, say AWS_OKTA_MFA_CODE. This would allow running another script that generated that TOTP code, vs needing it to be typed, something like:

$ AWS_OKTA_MFA_CODE="$(get_totp_code)" aws-okta exec <profile> -- <command>

Start providing Windows releases

With the issues Go has on Windows with network drives and the recent addition of gcc as a build dependency and libconv.dll as a runtime dependency it's getting to the point that we can't reasonably expect users to all be building on Windows.

I'd be willing to start building/providing 64-bit WIndows binaries in a .zip or something if we can figure out how to incorporate it into the GitHub releases.

Ideally I think we'd get something like a .msi or chocolatey package built but that's probably beyond what I can commit to personally for now.

Go 1.11 compilation issue

Compiling it with Go 1.11 fails:

$ go build -ldflags '-X main.Version=0.19.1'
# github.com/segmentio/aws-okta/vendor/github.com/keybase/go-keychain
vendor/github.com/keybase/go-keychain/corefoundation_go110.go:35:33: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFDataCreate
vendor/github.com/keybase/go-keychain/corefoundation_go110.go:61: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal
vendor/github.com/keybase/go-keychain/corefoundation_go110.go:98:41: cannot use nil as type _Ctype_CFAllocatorRef in argument to _Cfunc_CFStringCreateWithBytes
vendor/github.com/keybase/go-keychain/corefoundation_go110.go:133: cannot use nil as type _Ctype_CFAllocatorRef in argument to func literal

Authentication flow fails at Duo Push, unsure of cause

I've set up an aws-okta profile, and can use Okta to log into the role it specifies normally. When I attempt to use aws-okta, it gets to the MFA portion, waits for 2-3 seconds, then fails without sending a push. From the Duo side, there are no corresponding failed MFA events. Is there anything else I can do track down what's going on?

$ aws-okta login profile-name -d
DEBU[0000] Parsing config file /Users/andrewr/.aws/config
DEBU[0000] using okta provider
DEBU[0000] Failed to reuse session token, starting flow from start
DEBU[0000] Step: 1
DEBU[0002] Step: 2
INFO[0002] Sending push notification...
DEBU[0002] Okta Factor ID: <looks right>

DEBU[0003] Host:api-23a196fe.duosecurity.com
Signature:<REDACTED>
StateToken:<REDACTED>

DEBU[0003] challenge u2f
Failed Duo challenge

Support multiple simultaneous okta role executions

This is a bit out there perhaps, and forgive me if this is somehow already supported and I have simply missed it, but in some scenarios, people might be setting up activities involving resource in multiple accounts, and require the availability of multiple simultaneous aws-okta profiles when performing an exec.
In the case I am considering, there is no aws cross-account role assumption, but rather, each aws account has its own SAML endpoint, and so it would be necessary to utilize several different sets of environment variables for this. I could imagine something along the lines of the following:
aws-okta exec prof-a,prof-b -- terraform plan .
Then, the execution environment might contain, for example, AWS_ACCESS_KEY_ID_prof_a and AWS_ACCESS_KEY_ID_prof_b without necessarily having to enable AWS role assumption from a to b or b to a, and the underlying tool (in my case terraform) could be directed to use the appropriate environment variables.

0.10.0 broke assume-role

SharedConfigAssumeRoleError: failed to load assume role for arn:aws:iam::xxxxx:role/RoleName, source profile has no shared credentials

0.9.0 works fine.

Duo 2fa error

Hello,
I have a problem with one user during 2fa to Duo mobile.

$ aws-okta -d exec cnc -- aws s3 ls
DEBU[0000] Parsing config file /Users/lwaisberg/.aws/config
DEBU[0000] Using aws_saml_url from profile: cnc
DEBU[0000] using okta provider
DEBU[0000] Failed to reuse session token, starting flow from start
DEBU[0000] Step: 1
DEBU[0001] Step: 2
INFO[0001] Requesting MFA
DEBU[0001] 00...............................DS
DEBU[0001] Okta Factor Provider: DUO
DEBU[0001] Okta Factor ID: dsfk................0x7
DEBU[0001] Okta Factor Type: web
DEBU[0002] Host:api-e5f9f14f.duosecurity.com
Signature:TX|bHdha................................7624
StateToken:00jB.................ttiPhVeDS

DEBU[0002] challenge u2f
INFO[0002] Sending Push Notification...
Failed Duo challenge

login to AWS console is working fine. Another user has no such issue.

could you point me to the way to investigate this issue?

aws-okta version 0.19.4

Getting a strncpy warning during build

Upon issuing the go get github.com/segmentio/aws-okta command the software starts downloading and installing the package. The installation errors out with the following error message:

$ go get github.com/segmentio/aws-okta                                           
# github.com/marshallbrekka/go-u2fhost/vendor/github.com/marshallbrekka/go.hid   
hid_windows.c: In function 'hid_enumerate':                                      
hid_windows.c:423:5: warning: 'strncpy' specified bound depends on the length of  the source argument [-Wstringop-overflow=]                                           
strncpy(cur_dev->path, str, len+1);                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                          
hid_windows.c:421:11: note: length computed here                                      
len = strlen(str);                                                                     
^~~~~~~~~~~

This error prevents aws-okta from being completely installed.

Issue with Duo Yubikey auth

Output:

➜  ~ aws-okta exec developer --mfa-device u2f --debug -- echo "hello"
DEBU[0000] Parsing config file /Users/vho/.aws/config
DEBU[0000] Using aws_saml_url from profile: okta
DEBU[0000] using okta provider
DEBU[0000] Failed to reuse session token, starting flow from start
DEBU[0000] Step: 1
DEBU[0001] Step: 2
INFO[0001] Requesting MFA. Please complete two-factor authentication with your second device
DEBU[0001] 009PSPwKCb5AZJyoPhNcOYWoFKCe85gJOuXZf_UFqN
DEBU[0001] Okta Factor Provider: DUO
DEBU[0001] Okta Factor ID: <REDACTED>
DEBU[0001] Okta Factor Type: web
DEBU[0001] Host:api-<REDACTED>.duosecurity.com
Signature:TX|<REDACTED>
StateToken:<REDACTED>

DEBU[0001] challenge u2f
INFO[0001] Sending Push Notification...
DEBU[0002] Facet: https://api-<REDACTED>.duosecurity.com
Touch the flashing U2F device to authenticate...

INFO[0002] Authentication succeeded, continuing
INFO[0002] Device: u2f
INFO[0004] Err: Prompt request failed: 403
Failed Duo challenge. Err: Prompt request failed: 403

OS: macOS 10.13.6
Yubikey: YubiKey 5C Nano
aws-okta version: 0.19.5 (I installed via brew)

I disabled all other 2FA options on Okta and Duo just to isolate the problem (but fwiw Duo Push notifications work well)

Unable to authenticate

Exactly the same issue as #26 just started happening between Friday and today.

DEBU[0000] Parsing config file /Users/shawn/.aws/config
DEBU[0000] Using aws_saml_url from profile: <profile_name>
DEBU[0000] using okta provider
DEBU[0000] Failed to reuse session token, starting flow from start
DEBU[0000] Step: 1
DEBU[0001] Step: 2
INFO[0001] Requesting MFA. Please complete two-factor authentication with your second device
DEBU[0001] <REDACTED>
DEBU[0001] Okta Factor Provider: DUO
DEBU[0001] Okta Factor ID: <REDACTED>
DEBU[0001] Okta Factor Type: web
DEBU[0001] Host:api-beb1bbc4.duosecurity.com
Signature:<REDACTED>
StateToken:<REDACTED>

DEBU[0001] challenge u2f
INFO[0001] Sending Push Notification...
Failed Duo challenge

Session expires during terraform execution

This is feature request.

We use aws-okta with terrafom and when execution takes longer time that left on session - terraform execution fails.

Please add a configurable parameter AWS_SESSION_MINIMUM_TTL_TIME = 15 minutes
And if its less that specified - that would force re-login

it would guarantee that session is valid whole execution time.

Support for other IdPs

Is there any plans or ideas for supporting non-Okta identity providers? We're in the middle of a transition to Okta, but the project is timeline might be 12+ months. We're considering moving from IAM to Shibboleth backed federation (which is what Okta will be replacing).

Pluggable authentication modules?

I've built out a fork of this in order to integrate with a different IDP (Shibboleth) at https://github.com/CUBoulder-OIT/aws-shib

It's very raw at this point, but it makes me think there could be a good use case for making aws-okta more flexible to allow pluggable (or at least configuration driven) selection of providers. It seems like the provider/oktaprovider relationship was built with this in mind, but right now oktaprovider is hardcoded.

I'd be happy to help with this with some PRs if there is interest in expanding aws-okta to more use cases.

improve error message for changed password?

If you change your password in okta, authentication fails here:

return fmt.Errorf("Failed to authenticate with okta: %#v", err)

...this is expected, but we're we're in a maze of authentication failures (session tokens etc). It'd be nice to indicate that this one is easy to fix: "If your password has changed, run aws-okta add again.", or perhaps "Invalid credentials, use aws-okta add to change them." - to cover more scenarios.

The specified item could not be found in the keyring.

I keep getting the above error when I run aws-okta exec.

This was working, until I changed my password in Okta. Then I kept getting a 401 error. I tried to figure out how to change password (because aws-okta add didn't work for me. So I removed the creds from Keychain, delete the application and do everything from scratch. But now I get this error.

Version affected: aws-okta 0.19.0 and aws-okta dev. I installed through homebrew and go get

Gracefully handle requested TTL > max session duration of a role

Currently when the requested credential TTL exceeds the max session duration allowed for the AssumeRole* call, aws-okta errors out.

I think it would be great if we could add a flag (or other mechanism) such that when this happens a warning is expressed and a second request is made with some lower TTL (1 hour?) rather than simply failing. This would also help with "chained" AssumeRole calls which currently have a hard 1-hour max duration regardless of the max session duration of the role being assumed.

Okta MFA prompts with multiple options are not helpful

When configured with MFA the prompt from aws-okta is not helpful; it doesn't indicate which of several options is which "factor" (SMS vs. OTP vs. Push).

For example:

$ aws-okta exec dev -- aws sts get-caller-identity
DEBU[0000] Parsing config file /home/mklich/.aws/config
DEBU[0000] Using aws_saml_url from profile: dev
DEBU[0000] using okta provider
DEBU[0000] Failed to reuse session token, starting flow from start
DEBU[0000] Step: 1
DEBU[0001] Step: 2
INFO[0001] Requesting MFA
DEBU[0001] <<redacted>>
INFO[0001] Select a MFA from the following list
INFO[0001] 0: OKTA
INFO[0001] 1: OKTA
INFO[0001] 2: OKTA
Select MFA method: 0
DEBU[0006] Okta Factor ID: <<redacted>>
DEBU[0006] Okta Factor Type: token:software:totp
DEBU[0006] Token MFA
Enter MFA Code: 

There are three MFA options but you cannot tell which is which until you choose one; and then only when debug logging is enabled.

Random fail with account locking

Overview

Hello there,

I'm coming here today because, randomly and approximately 1 time over 10, when I run a command through aws-okta I receive an authentification error:

Failed to authenticate with okta: &errors.errorString{s:"POST https://my-company.okta.com/api/v1/authn: 401 Unauthorized"}

How to reproduce

Steps to reproduce the behavior:

  • Run the following command for about 10 times
 aws-okta exec my-profile -- aws s3 ls s3://

Setup

  • OS: Ubuntu 18.04.1 LTS
  • Release: 18.04
  • aws-okta version: dev

Details

In consequence, my Okta account is regularly blocked and you must unblock it to me or I have to wait to be unlocked.

Additional informations

  • ~/.aws/config content:
[default]
region = eu-west-1
output = json

[profile okta]
aws_saml_url = home/amazon_aws/1234567890

[profile main]
region = eu-west-1
role_arn = arn:aws:iam::1234567890:role/my-role
  • AWS related environment variables:
AWS_PROFILE=default
AWS_VAULT_BACKEND=kwallet

aws-okta hangs in powershell ISE

Works fine in cmd.exe and "normal" powershell, but in powershell ISE I get the following:

PS C:\Users\Administrator> .\go\bin\aws-okta -d exec fg-payer -- aws s3 ls
.\go\bin\aws-okta : time="2018-05-14T20:36:37Z" level=debug msg="Parsing config file C:\Users\Administrator\.aws\config" 
At line:1 char:1
+ .\go\bin\aws-okta -d exec fg-payer -- aws s3 ls
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (time="2018-05-1...r\.aws\config" :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

...and then nothing else happens.

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.