Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS API credentials with OneLogin SAML and MFA

We want to allow our users to retrieve a set of temporary CLI credentials for a given AWS role by signing in to OneLogin with password and MFA. We have a working solution, but it requires the user to fully re-authenticate to OneLogin (including MFA) every 60 minutes as the AWS temporary credentials expire. I think that won't fly - our users are accustomed to permanent API credentials tied to a real IAM user.

Ideally, we'd like to allow users to authenticate once a day, securely cache the resulting SAML assertion, and use that to transparently refresh the AWS API credentials as needed. I'm thinking of something like aws-keychain that would use the local OS credential store to remember the SAML assertion, and only prompt the user for input when their OneLogin session has timed out.

This almost works as-is. The catch is that the SAML assertion returned by OneLogin's saml_assertion and verify_factor endpoints sets a three-minute deadline on the Subject and Conditions fields.

Is there a way to do what we want, or are we trying to route around a core SAML principle?

like image 558
Jack Foy Avatar asked Oct 31 '16 03:10

Jack Foy


People also ask

How do I get AWS SAML assertion?

To use this attribute, you must configure the SAML provider to provide single sign-on access to the AWS Management Console through the console sign-in web endpoint at https:// region-code . signin.aws.amazon.com/saml . For a list of possible region-code values, see the Region column in AWS Sign-In endpoints.


1 Answers

We're in the process of officially adding an option to in our official CLI tool to re-use the user credentials similarly to what you're describing.

Essentially our CLI tool has an option to reuse the user/pass in the background to continuously refresh the access info in a user profile so while the user will provide credentials once, the access info will get updated before it expires.

But unfortunately, at least at this time, there's no way to get around the MFA part if the application policy requires MFA. It'll need that MFA to refresh the credentials.

If you have to have MFA, you can always use the OneLogin MFA APIs to bake in an MFA flow into the tool...

Check it out here: https://github.com/onelogin/onelogin-aws-cli-assume-role/pull/5

like image 187
John Offenhartz Avatar answered Oct 19 '22 02:10

John Offenhartz