AWS - Identity and Access Manag

2021-04-08  本文已影响0人  Lyudmilalala

Workflow

Principal

A principal is a person or application that can make a request for an action or operation on an AWS resource.

Authentication

You need to sign your request with credentials, such as email, username, password, before it is sent to AWS. (signed in)

Reuqest

When a principal tries to use the AWS Management Console, the AWS API, or the AWS CLI, that principal sends a request including the following information to AWS:

Authorization

During authorization, AWS uses values from the request context to check for policies that apply to the request. It then uses the policies to determine whether to allow or deny the request. Requests are denied by default, AWS authorizes your request only if every part of your request is allowed by the applicable permissions policies. If a single permissions policy includes a denied action, AWS denies the entire request and stops evaluating. This is called an explicit deny. (has permission)

After your request has been authenticated and authorized, AWS approves the actions or operations in your request.

Identities

The IAM resource objects that are used to identify and group. You can attach a policy to an IAM identity. These include users, groups, and roles.

User

MFA
Password Policy

You can set a password policy to specify complexity requirements and mandatory rotation periods for your IAM users' passwords
When the minimum length and character type requirements change, these settings are enforced the next time that your users change their passwords.
When you set a password expiration period, the expiration period is enforced immediately.

CodeCommit

CodeCommit is a managed version control service that hosts private Git repositories in the AWS cloud.
You can authenticate your IAM credentials used to communicate with CodeCommit repositories in three ways:

Group

Role

Grant cross-account access.
Service Role
Role chaining
Providing access to AWS accounts owned by third parties

You need to provide the following to create a role that a third party AWS account can assume:

AWS Cognito
Relying Party and Claim Rule

Telling the IdP about AWS as a service provider is called adding relying party trust between your IdP and AWS.

A claim is information about the user and its groups. A claim rule maps that information into SAML attributes.

You need to create appropriate claim rules in your IdP that specify AWS as a relying party, which makes sure that SAML authentication responses from your IdP contain the necessary attributes that AWS uses in IAM policies to check permissions for federated users.

Tagging IAM Users and Roles

-- Tag keys and values can include any combination of letters, numbers, spaces, and _ . : / = + - @ . symbols.

Using Amazon Cognito for mobile apps
Delegation
Federation

Entities

The IAM resource objects that AWS uses for authentication. These include IAM users, federated users, and assumed IAM roles.

Federating existing users

If your user is already:

  1. Enterprise identity federation: have identities in a corporate directory, or
  2. Web identity federation: have identified themselves through an Internet identity provider like Login with Amazon, Facebook, Google, or any OpenID Connect (OIDC) compatible identity provider

you can temporarily federate those user identities into AWS.
To assign permissions to federated users, you can create an entity referred to as a role and define permissions for the role. When a federated user signs in to AWS, the user is associated with the role and is granted the permissions that are defined in the role.

Resources

The user, group, role, policy, and identity provider objects that are stored in IAM. You can add, edit, and remove resources from IAM.

Policies and Permission

Identity-based policies

Permissions policies that you attach to an IAM identity
Consists of effect, action, resource, condition
Identity-based policies can contain resource-level permissions that allow a user to access some resources.
Identity-based policies and resource-based policies are both permissions policies and are evaluated together.

Managed policies

Standalone identity-based policies that you can attach to multiple users, groups, and roles in your AWS account
The same managed policy can be attached to multiple principal entities
AWS managed policies – Managed policies that are created and managed by AWS
Customer managed policies – Managed policies that you create and manage in your AWS account
When you change a customer managed policy, the changed policy doesn't overwrite the existing policy. Instead, IAM creates a new version of the managed policy. IAM stores up to five versions of your customer managed policies. You can use policy versions to revert a policy to an earlier version if you need.
AWS recommends user to use managed policies instead of inline policies.

Inline policies

Policies that you create and manage and that are embedded directly into a single user, group, or role
Inline policies maintain a strict one-to-one relationship between a policy and an identity. when you delete that identity, the policies embedded in the identity are deleted as well.

Resource-based policies

Permissions policies that you attach to a resource
Consists of effect, principal, and action
Resource-based policies are inline policies, and there are no managed resource-based policies
The IAM service supports only one type of resource-based policy called a role trust policy, Trust policies define which principal entities (accounts, users, roles, and federated users) can assume the role.

Services that supports resource-based policies for granting principals in another AWS account who access to the resource:

Permissions Boundary

A permissions boundary is an advanced feature that allows you to use AWS managed policies to limit the maximum permissions that an identity-based policy can grant to a user or role.

Organizations service control policy (SCP)

A Organizations SCP is a JSON policy that specify the maximum permissions for account members of an organization or organizational unit (OU).

Access Control List (ACL)

ACL controls which principals in other accounts can access the resource to which the ACL is attached.
The only policy type that does not use the JSON policy document structure.
ACLs are cross-account permissions policies that grant permissions to the specified principal. They cannot grant permissions to entities within the same account.

Session policies

Session policies limit the permissions that the role or user's identity-based policies grant to the created session.

Permissions Across Multiple Accounts

Granting permissions for AWS Services

Typical services: Amazon EMR, Elastic Load Balancing, and Amazon EC2 Auto Scaling
You usually attach a role that defines what the service is allowed to do to the service.

Policy evaluation logic

Attribute-based access control (ABAC)

Role-based access control (RBAC).

RBAC defines permissions based on a person's job function.
In IAM, you implement RBAC by creating different policies for different job functions. You then attach the policies with minimum permissions necessary to identities (IAM users, groups of users, or IAM roles.
The disadvantage to using the traditional RBAC model is that when employees add new resources, you must update policies to allow access to those resources.

ABAC VS RBAC

AWS Security Token Service (AWS STS)

Advantages

  1. You do not have to distribute or embed long-term AWS security credentials with an application.
  2. You do not have to rotate them or explicitly revoke them when they're no longer needed.
  3. You can provide access to your AWS resources to users without having to define an AWS identity for them.

Bearer tokens

Some AWS services require that you have permission to get an AWS STS service bearer token before you can access their resources programmatically.
When you perform AWS CLI or AWS API operations that require bearer tokens, the AWS service requests a bearer token on your behalf. The service respondes you with the bearer token, which you can then use to perform subsequent operations in that service.

Special API

Access Analyzer

Access Analyzer analyzes only the resource-based policies that are applied to AWS resources in the Region where you enabled Access Analyzer.

Access Analyzer generates a finding when a resource-based policy allows access to a resource, even if the resource was not accessed by the external entity. Access Analyzer does not currently report findings from AWS service principals or internal service accounts.

Access Analyzer is built on Zelkova, which translates IAM policies into equivalent logical statements, and runs a suite of general-purpose and specialized logical solvers (satisfiability modulo theories) against the problem.

For customer privacy and security, Access Analyzer also does not consider the state of any external accounts when making its determination.

Access Analyzer in S3 buckets

Generates a finding when an Amazon S3 bucket policy, ACL, or access point applied to a bucket grants access to an external entity.
You can enable block public access settings on your bucket. It overrides the bucket policies that are applied to the bucket.
Access Analyzer analyzes block public access settings at the bucket level whenever a policy changes. However, it evaluates the block public access settings at the account level only once every 6 hours.

Access Analyzer in IAM roles

For IAM roles, Access Analyzer analyzes trust policies.

Access Analyzer in KMS keys

For AWS KMS customer master keys (CMKs), Access Analyzer analyzes the key policies and grants applied to a key. Access Analyzer generates a finding if a key policy or grant allows an external entity to access the key.

Access Analyzer in Lambda functions and layers

For AWS Lambda functions, Access Analyzer analyzes policies, including condition statements in a policy, that grant access to the function to an external entity.
Access Analyzer also analyzes permissions granted when using the AddPermission operation of the AWS Lambda API with an EventSource Token.

Access Analyzer in SQS queues

For Amazon SQS queues, Access Analyzer analyzes policies, including condition statements in a policy, that allow an external entity access to a queue.

Business use cases for IAM

上一篇 下一篇

猜你喜欢

热点阅读