| copyright |
|
||
|---|---|---|---|
| lastupdated | 2025-02-06 | ||
| keywords | tutorials, cbr, firewall, allowlist, rules | ||
| subcollection | cloud-logs | ||
| content-type | tutorial | ||
| completion-time | 10m |
{{site.data.keyword.attribute-definition-list}}
{: #iam-cbr-tutorial} {: toc-content-type="tutorial"} {: toc-completion-time="10m"}
In this tutorial, you will set up context-based restrictions that prevent any access to the {{site.data.keyword.logs_full_notm}} instance unless the request originates from an allowed network zone. {: shortdesc}
{: #iam-cbr-tutorial-prereqs}
Before you use context-based restrictions with an {{site.data.keyword.logs_full_notm}} instances you need:
- An instance of {{site.data.keyword.logs_full_notm}}
- A role of
Administratorfor context-based restrictions
{: #iam-cbr-tutorial-console} {: step}
- Log in to your {{site.data.keyword.cloud_notm}} account{: external}.
- Click Manage > Context-based restrictions.
{: #iam-cbr-tutorial-new-rule} {: step}
- Click Rules.
- In the service section, select {{site.data.keyword.logs_full_notm}} from the menu.
- In the APIs section, select All in Service APIs.
{: #iam-cbr-tutorial-scope} {: step}
Now, you can choose the resources where you want to apply the context-based restrictions. You can specify a particular instance, or you can apply the restrictions to all {{site.data.keyword.logs_full_notm}} instances.
In this tutorial, you will choose a specific {{site.data.keyword.logs_full_notm}} instance.
- In the resources section, select specific resources.
- Click Add a condition and select the Service instance option from the menu.
- Select the {{site.data.keyword.logs_full_notm}} instance you want the rule to affect.
- Click Continue.
{: #iam-cbr-tutorial-network-zone} {: step}
Now that you know which resources the rule will affect, you need to define what the rule will allow. To do this, create a new network zone and apply it to the rule.
-
In the network zone section, Click Create + .
-
Provide a meaningful name and description for the network zone.
-
Add the IP addresses to the
Allowed IP addressesfield. Only these IP addresses will be permitted to interact with the {{site.data.keyword.logs_full_notm}} instance you selected in the previous step. -
Click Next and then Create.
-
Select the newly created network zone and click Add.
-
Click Continue.
{: #iam-cbr-tutorial-describe-rule} {: step}
In the final step, you can add a description for the rule and choose how you want to enforce it. Once you've made your selections, click Create.
{: caption="Create your rule"}
After you create, enforce, or disable enforcement of a rule, it might take up to 10 minutes for the change to take effect. {: note}
{: #iam-cbr-tutorial-verify} {: step}
An easy way to verify whether the rule is working as expected is to try accessing your {{site.data.keyword.logs_full_notm}} instance's dashboard from IPs other than those allowed. You should be blocked from accessing the dashboard.
Next, try accessing the dashboard from an allowed IP address. You should be able to access the dashboard.
Another way to verify the rule is through CLI commands.
If you try to run commands from an IP address that is not allowed for the specified instance, the command will fail with a forbidden error message.
Example command : ibmcloud logs alerts


