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

returns boolean if a user has access to console login #2012

Merged

Conversation

valkiriaaquatica
Copy link
Contributor

@valkiriaaquatica valkiriaaquatica commented Mar 4, 2024

Summary
I've introduced a new feature that includes in the response a console_access parameter, which is a boolean indicating whether an iam user has the ability to log in through the AWS console. This addition is particularly useful for scenarios where administrative constraints require users to access AWS services exclusively via API keys or through controlled environments, such as landing zones, without using the AWS console login interface.

Issue Type

  • Feature Pull Request
    Component Name: botocore
    includes the botocore interaction, specifically regarding the console_access information retrievals

Additional Information
With this update, the module now provides visibility into whether an IAM user is permitted console access. This could be pivotal for enforcing stricter security protocols, ensuring users do not bypass VPN requirements, API keys, or other access control measures by logging in through the AWS console

Before the change a normal response:

{
    "arn": "arn:aws:iam::11111111:user/terraform",
    "create_date": "2018-04-18T14:12:44+00:00",
    "path": "/",
    "tags": {},
    "user_id": "12345abcd",
    "user_name": "terraform"
}

After the change:

{
    "arn": "arn:aws:iam::11111111:user/terraform",
    "console_access": false,
    "create_date": "2018-04-18T14:12:44+00:00",
    "path": "/",
    "tags": {},
    "user_id": "12345abcd",
    "user_name": "terraform"
}

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/918c85f9bbc34b5593e793db86f19575

✔️ ansible-galaxy-importer SUCCESS in 3m 48s
✔️ build-ansible-collection SUCCESS in 15m 42s
✔️ ansible-test-splitter SUCCESS in 6m 31s
✔️ integration-amazon.aws-1 SUCCESS in 5m 10s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/c52e741c13c34c5fb600cc9a4ab05c66

✔️ ansible-galaxy-importer SUCCESS in 5m 22s
✔️ build-ansible-collection SUCCESS in 17m 40s
✔️ ansible-test-splitter SUCCESS in 6m 33s
✔️ integration-amazon.aws-1 SUCCESS in 5m 12s
Skipped 43 jobs

@abikouo
Copy link
Contributor

abikouo commented Mar 21, 2024

@valkiriaaquatica thanks for your contribution to this repository.
Your PR is incomplete, you will need to add a changelog fragment describing the change, here is an example https://github.com/ansible-collections/amazon.aws/blob/main/changelogs/fragments/20231211-rds_instance_cloudwatch.yml.
You will also need to update the module RETURN block adding the new parameters

Copy link
Contributor

@abikouo abikouo left a comment

Choose a reason for hiding this comment

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

Just minor updates to return the full LoginProfile information in the output, as this should be necessary for other use cases

plugins/modules/iam_user_info.py Outdated Show resolved Hide resolved
plugins/modules/iam_user_info.py Outdated Show resolved Hide resolved
plugins/modules/iam_user_info.py Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Mar 21, 2024

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

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

Apologies for the significant change requests, the IAM modules have recently been subject to some refactoring work including adding decorators for some of the common error handling code.

plugins/modules/iam_user_info.py Outdated Show resolved Hide resolved
plugins/modules/iam_user_info.py Outdated Show resolved Hide resolved
plugins/modules/iam_user_info.py Show resolved Hide resolved
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/85079ccea3744996b576b1722c34b5b9

✔️ ansible-galaxy-importer SUCCESS in 5m 13s
✔️ build-ansible-collection SUCCESS in 16m 02s
✔️ ansible-test-splitter SUCCESS in 6m 16s
✔️ integration-amazon.aws-1 SUCCESS in 9m 22s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/ce93286bcbf44c2f8b1192263ae3c8c0

✔️ ansible-galaxy-importer SUCCESS in 5m 38s
✔️ build-ansible-collection SUCCESS in 15m 34s
✔️ ansible-test-splitter SUCCESS in 6m 00s
✔️ integration-amazon.aws-1 SUCCESS in 6m 38s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/8adee2157aa4453987461294de3017b8

✔️ ansible-galaxy-importer SUCCESS in 5m 27s
✔️ build-ansible-collection SUCCESS in 14m 26s
✔️ ansible-test-splitter SUCCESS in 5m 26s
✔️ integration-amazon.aws-1 SUCCESS in 6m 52s
Skipped 43 jobs

@valkiriaaquatica
Copy link
Contributor Author

thanks @abikouo and @tremble ! If there is anythiing i can help with the iam documentation (that I see is not as complete as others) I can help :)

Copy link
Contributor

@abikouo abikouo left a comment

Choose a reason for hiding this comment

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

Just minor change in the changelog fragment

changelogs/fragments/20240321-iam-user-info.yml Outdated Show resolved Hide resolved
valkiriaaquatica and others added 14 commits March 22, 2024 08:37
I have added that now return in the return json the parameter console_access in boolean format to know if the user has or not access to login by console to the account. It can be used in cases where you only want users to access with keys or by landing zones...
instead of boolean it returns user info so if a user has console access info will be returned

Co-authored-by: Mark Chappell <[email protected]>
@abikouo abikouo added the mergeit Merge the PR (SoftwareFactory) label Mar 22, 2024
@tremble tremble added the backport-7 PR should be backported to the stable-7 branch label Mar 22, 2024
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/1da04bdc3b0e49698ca94ee7b4c7c6dc

✔️ ansible-galaxy-importer SUCCESS in 5m 38s
✔️ build-ansible-collection SUCCESS in 15m 34s
✔️ ansible-test-splitter SUCCESS in 7m 04s
✔️ integration-amazon.aws-1 SUCCESS in 6m 20s
Skipped 43 jobs

@tremble
Copy link
Contributor

tremble commented Mar 22, 2024

@valkiriaaquatica thanks for the efforts you've put into this. Don't worry about the docs, it's my fault and I'll get them written. This isn't my day job so there's a certain amount of "getting around to it" involved (and everyone knows that writing code is more interesting than docs and tests :) ).

Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/9ab8baa329f64ad1897ba89e3782910d

✔️ ansible-galaxy-importer SUCCESS in 5m 01s
✔️ build-ansible-collection SUCCESS in 15m 03s
✔️ ansible-test-splitter SUCCESS in 5m 20s
✔️ integration-amazon.aws-1 SUCCESS in 7m 47s
Skipped 43 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 8b138e3 into ansible-collections:main Mar 22, 2024
40 checks passed
Copy link

patchback bot commented Mar 22, 2024

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/8b138e3947ede41de8264e9a4aabcfd7a2759891/pr-2012

Backported as #2023

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Mar 22, 2024
returns boolean if a user has access to console login

Summary
I've introduced a new feature that includes in the response a console_access parameter, which is a boolean indicating whether an iam user has the ability to log in through the AWS console. This addition is particularly useful for scenarios where administrative constraints require users to access AWS services exclusively via API keys or through controlled environments, such as landing zones, without using the AWS console login interface.
Issue Type

Feature Pull Request
Component Name: botocore
includes the botocore interaction, specifically regarding the console_access information retrievals

Additional Information
With this update, the module now provides visibility into whether an IAM user is permitted console access. This could be pivotal for enforcing stricter security protocols, ensuring users do not bypass VPN requirements, API keys, or other access control measures by logging in through the AWS console
Before the change a normal response:
{
    "arn": "arn:aws:iam::11111111:user/terraform",
    "create_date": "2018-04-18T14:12:44+00:00",
    "path": "/",
    "tags": {},
    "user_id": "12345abcd",
    "user_name": "terraform"
}

After the change:
{
    "arn": "arn:aws:iam::11111111:user/terraform",
    "console_access": false,
    "create_date": "2018-04-18T14:12:44+00:00",
    "path": "/",
    "tags": {},
    "user_id": "12345abcd",
    "user_name": "terraform"
}

Reviewed-by: Bikouo Aubin
Reviewed-by: Mark Chappell
(cherry picked from commit 8b138e3)
@valkiriaaquatica valkiriaaquatica deleted the patch-1 branch March 22, 2024 09:36
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Apr 1, 2024
[PR #2012/8b138e39 backport][stable-7] returns boolean if a user has access to console login

This is a backport of PR #2012 as merged into main (8b138e3).
Summary
I've introduced a new feature that includes in the response a console_access parameter, which is a boolean indicating whether an iam user has the ability to log in through the AWS console. This addition is particularly useful for scenarios where administrative constraints require users to access AWS services exclusively via API keys or through controlled environments, such as landing zones, without using the AWS console login interface.
Issue Type

Feature Pull Request
Component Name: botocore
includes the botocore interaction, specifically regarding the console_access information retrievals

Additional Information
With this update, the module now provides visibility into whether an IAM user is permitted console access. This could be pivotal for enforcing stricter security protocols, ensuring users do not bypass VPN requirements, API keys, or other access control measures by logging in through the AWS console
Before the change a normal response:
{
    "arn": "arn:aws:iam::11111111:user/terraform",
    "create_date": "2018-04-18T14:12:44+00:00",
    "path": "/",
    "tags": {},
    "user_id": "12345abcd",
    "user_name": "terraform"
}

After the change:
{
    "arn": "arn:aws:iam::11111111:user/terraform",
    "console_access": false,
    "create_date": "2018-04-18T14:12:44+00:00",
    "path": "/",
    "tags": {},
    "user_id": "12345abcd",
    "user_name": "terraform"
}

Reviewed-by: Alina Buzachis
Reviewed-by: Helen Bailey <[email protected]>
mandar242 pushed a commit to mandar242/amazon.aws that referenced this pull request Aug 29, 2024
fix unsafe asserts

SUMMARY
Closes ansible-collections#2012
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
integrationtests

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4bdcecd
mandar242 pushed a commit to mandar242/amazon.aws that referenced this pull request Aug 30, 2024
fix unsafe asserts

SUMMARY
Closes ansible-collections#2012
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
integrationtests

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4bdcecd
mandar242 pushed a commit to mandar242/amazon.aws that referenced this pull request Sep 3, 2024
fix unsafe asserts

SUMMARY
Closes ansible-collections#2012
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
integrationtests

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4bdcecd
mandar242 pushed a commit to mandar242/amazon.aws that referenced this pull request Sep 30, 2024
fix unsafe asserts

SUMMARY
Closes ansible-collections#2012
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
integrationtests

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4bdcecd
mandar242 pushed a commit to mandar242/amazon.aws that referenced this pull request Oct 7, 2024
fix unsafe asserts

SUMMARY
Closes ansible-collections#2012
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
integrationtests

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4bdcecd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7 PR should be backported to the stable-7 branch mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants