Questo contenuto non è disponibile nella lingua selezionata.
Chapter 1. Adding additional constraints for IP-based AWS role assumption
Create an identity-based policy that denies requests from non-allowlisted IP addresses. Restricting role access can improve your AWS account security.
1.1. Creating an identity-based IAM policy Copia collegamentoCollegamento copiato negli appunti!
Create an Identity and Access Management (IAM) policy that denies access to all AWS actions if the request is made from an IP address not provided by Red Hat.
Prerequisites
- You have access to the AWS Management Console with the permissions required to create and modify IAM policies.
Procedure
- Sign in to the AWS Management Console using your AWS account credentials.
- Navigate to the IAM service.
- In the IAM console, select Policies from the left navigation menu.
- Click Create policy.
- Select the JSON tab to define the policy using JSON format.
To get the IP addresses required for the JSON policy document, run the following command:
$ ocm get /api/clusters_mgmt/v1/trusted_ip_addressesNoteThese IP addresses are not permanent and can change. Regularly review the API output and update the JSON policy document.
Copy and paste the following
policy_document.jsonfile into the editor:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "*", "Resource": "*", "Condition": { "NotIpAddress": { "aws:SourceIp": [] }, "Bool": { "aws:ViaAWSService": "false" } } } ] }-
Copy and paste all of the IP addresses, which you got in Step 6, into the
"aws:SourceIp": []array in yourpolicy_document.jsonfile. - Click Review and create.
- Provide a name and description for the policy, and review the details for accuracy.
Click Create policy to save the policy.
NoteSet the
aws:ViaAWSServicecondition key to false to ensure that subsequent calls succeed after your initial call. For example, if you do not setaws:ViaAWSServiceto false and runaws ec2 describe-instances, some follow-up calls can fail. It applies to subsequent calls that you make within the AWS API server to retrieve information about the Elastic Block Store (EBS) volumes attached to the EC2 instance. The subsequent calls fail because they originate from AWS IP addresses that are not included in the AllowList.
1.2. Attaching the identity-based IAM policy Copia collegamentoCollegamento copiato negli appunti!
After you create an Identity and Access Management (IAM) policy, attach it to the relevant IAM users, groups, or roles in your AWS account. The policy prevents IP-based role assumption for these entities.
Procedure
- Navigate to the IAM console in the AWS Management Console.
Select the default IAM
ManagedOpenShift-Support-Rolerole to attach the policy.NoteYou can change the default IAM
ManagedOpenShift-Support-Rolerole. For more information about roles, see Red Hat support access.- In the Permissions tab, select Add Permissions or Create inline policy from the Add Permissions drop-down list.
Search for the policy you created earlier by:
- Entering the policy name.
- Filtering by the appropriate category.
Select the policy and click Attach policy.
ImportantTo prevent IP-based role assumption, keep the allowlisted IPs up-to-date. Outdated IPs can block Red Hat site reliability engineering (SRE) from accessing your account and affect your Service Level Agreement (SLA).