copyright | lastupdated | keywords | subcollection | content-type | account-plan | completion-time | ||
---|---|---|---|---|---|---|---|---|
|
2024-04-05 |
network-level access, network security strategy |
account |
tutorial |
lite |
20m |
{{site.data.keyword.attribute-definition-list}}
{: #context-restrictions-tutorial} {: toc-content-type="tutorial"} {: toc-completion-time="20m"}
This tutorial walks you through how to use context-based restrictions as another layer of protection to your resources. By completing this tutorial, you learn how to create network zones and rules that define access restrictions to specific resources based on context in addition to IAM identity. For more information, see What are context-based restrictions? {: shortdesc}
The tutorial uses a fictitious account owner named Xander. Xander previously set up access for managers that need the administrator
role on account management services by using IAM policies.
Xander trusts his team to manage their personal and service credentials properly, but he wants to make sure they are protected even if credentials are mismanaged. Because Xander knows the IP addresses that the team uses, Xander can restrict access to the access management service based on the network location of the access requests. This way, access policy creation is restricted to the IP addresses he defines. Since both IAM access and context-based restrictions must allow access, context-based restrictions offer protection even in the face of compromised or mismanaged credentials.
{: #cbr-tutorial-before-you-begin}
Set up {{site.data.keyword.cloudaccesstrailshort}} to monitor your enabled and report-only rules. For more information, see Monitoring context-based restrictions.
{: #tutorial-networkzone-new} {: step}
First, create a new network zone for the team.
- In the {{site.data.keyword.cloud_notm}} console, click Manage > Context-based restrictions
- Go to Network zones and then click Create.
- Name the network zone
management-team-zone
- Enter the IP addresses the team must use:
- Team members in Austin use the following IP addresses: 4.4.4.1-4.4.4.99
- An Austin team member in another building uses the following subnet: 204.17.5.0/24
- A remote team member uses the following IP address: 3.3.3.56
- Click Next.
- Review the details of the network zone.
- Click Create.
{: #tutorial-context-rules} {: step}
Now, Xander can use the network zone that he created in a rule.
-
Go to Rules and click Create.
-
To restrict access to the creation of IAM policies, select the IAM Access Management Service.
-
Click Continue.
-
Xander has public endpoints in his network zone, so he keeps the endpoint type toggle switch set to No, which allows requests from any endpoint type.
-
Select the network zone
management-team-zone
. -
Click Add to include your context configuration in the rule.
-
Click Continue.
-
Name the rule
Management team
-
Set the enforcement to Report only so that you can monitor the impact of the rule before you enable it. You can update the enforcement at any time after you create the rule. For more information, see Updating context-based restrictions. {: note}
-
Click Continue.
-
Then, click Create.
Xander is logging and monitoring policy management requests by using report-only mode. Since the management team has the correct access policies and use allowed IP addresses, they are authorized to execute policy management operations. All policy management requests that come from IP addresses that don't match the conext that Xander defined are denied when the rule is enabled.
{: #tutorial-context-step-next}
After 30 days of monitoring, update the rule to Enabled to begin enforcing your restrictions.
You can also use network zones to restrict access at the account level and user level. For more information, see Allowing specific IP addresses.
To create context-based restrictions programmatically, see the Context-based Restrictions API and the Context-based restrictions CLI plug-in.
For more information about implementing context-based restrictions in your security strategy, see the solution tutorial Enhance cloud security by applying context-based restrictions.