Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role assumption names #134

Merged
merged 4 commits into from
Aug 30, 2018
Merged

Role assumption names #134

merged 4 commits into from
Aug 30, 2018

Conversation

jrnt30
Copy link
Contributor

@jrnt30 jrnt30 commented Aug 17, 2018

Fixes #120
See conversation from #121 for additional context/discussion

When using a federated user session in conjunction with
the -r role assumption option, some of the fidelity of that
initial session is lost (ex: caller-specified-name from
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable)

This will conditionally check, if a new role is asked to be assumed,
if there is already an existing role specified and if so, it will
pass it through to the new session to allow for easier auditing
of users as they traverse more complex IAM role delegation structures.

  • Ensure proper fallback for role assumption without session forwarding

Justin Nauman added 2 commits August 17, 2018 10:39
When using a federated user session in conjunction with
the -r role assumption option, some of the fidelity of that
initial session is lost (ex: caller-specified-name from
                         https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable)

This will conditionally check, if a new role is asked to be assumed,
if there is already an existing role specified and if so, it will
pass it through to the new session to allow for easier auditing
of users as they traverse more complex IAM role delegation structures.
- Disabled automatic session name mapping for federated users and creating
feature flag for explicit "opt-in" of the option.
- Explanation and disclaimer added to README
- Small linting error to pass `make test`
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 17, 2018
@@ -181,9 +184,29 @@ func (g generator) GetWithRoleForSession(clusterID string, roleARN string, sess

// if a roleARN was specified, replace the STS client with one that uses
// temporary credentials from that role.
if roleARN != "" {
if roleARN != "" && g.forwardSessionName {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need a separate if g.forwardSessionName within the if roleARN != "", this is bypassing role assumption if they aren't forwarding the session name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point! Thanks.

- Fixes a bug where the role would not be appropriately assumed when users
that are federated did not specify the new `forward-session-name` argument
Copy link
Member

@micahhausler micahhausler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, can you just clean up the doc strings in the code?

if g.forwardSessionName {
// Determine if the current session is already a federated identity. If so,
// we carry through this session name onto the new session to provide better
// aduiting capabilities
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this from 'auditing' to 'debugging'?

// we carry through this session name onto the new session to provide better
// aduiting capabilities
//
// NOTE: I couldn't figure out a more `direct` way of indicating if the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this note?

@mattlandis
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 30, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jrnt30, mattlandis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2018
@mattlandis mattlandis merged commit e894536 into kubernetes-sigs:master Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants