Define and enforce config rules on your Key Protect instances.
With the IBM Cloud Security and Compliance Center, you can embed security checks into your everyday workflows to prevent and monitor for security and compliance. By creating config rules, IBM Cloud customers can enforce resource configuration across accounts and use monitoring results to prove compliance for your organization. Config rules are guardrails for resources on how they are provisioned and configured. For example, IBM Cloud administrators can disable public access to resources in production accounts but allow it in testing accounts. Through config rule enforcement, you can manage the resources in your account with confidence that they adhere to the guidelines that are in place for your organization, which can significantly decrease the likelihood of a misconfiguration that could leave you vulnerable.
In this tutorial, learn how to create and manage rules that govern the way that resources can be configured across accounts. The focus of this tutorial will be on enforcing the use of only private networks for your IBM Key Protect for IBM Cloud instances in the Dallas region. To use another region or work with another service, check out the docs to see the available configurations.
Before you begin
Before you get started, be sure that you have the following prerequisites:
Step 1. Create a config rule
You can create rules by using the Security and Compliance Center UI.
- Navigate to the Security and Compliance Center on IBM Cloud.
- Click Configure > Rules.
- Click Create.
- Give your rule a meaningful name and description such as
KP disable public endpoint and
Rule to enforce private only network policy for Key Protect instances.
- Click Next. Select the
Key Protect service and
instance resource kind. The available configuration properties for this resource kind are shown to the right of the JSON editor.
- Use the JSON editor to set the following properties:
- Your final rule will look like this:
- Enable enforcement to prevent creation of a Key Protect instance with a public endpoint and click Next.
- Click Create and attach.
Step 2. Attach a rule
A rule is not in effect until it is attached to a scope. You can choose to attach your rule to your entire enterprise, specific resource group(s) or you can choose to exclude resource groups. If you attach a rule to your entire enterprise, the rule is applied to the target resources that exist within the enterprise. Likewise, if you limit a rule to a specific account group, its properties are inherited by the accounts that exist in that group. You can choose to exclude scopes, such as accounts that are used for testing, so that your rule is applied only where you need it. To attach your rule to a scope, complete the following steps:
- Click the Attach button.
- Under Select scope, choose your Entire account or the Specific resource group where your Key Protect instances will be provisioned.
- Click Attach.
Congrats! You have successfully created a rule and attached it to a scope.
Step 3. Seeing the rule in action
When a user makes a request to create a Key Protect service instance in your account, the request will be evaluated against the conditions that you defined in your config rule. If the account user creates the instance over a private network, Key Protect allows the action to complete because it is compliant with your rule. But, if the account user creates the instance over a public network, Key Protect blocks the request. To see it in action, try it out in the Key Protect UI or check out the following gif:
- Navigate to the catalog and search for Key Protect.
- Once on the Key Protect creation page, give your instance a meaningful service name, such as
KP Private Endpoint.
- Set the location to Dallas (us-south).
- Under Allowed network policy, select Public and private.
- Click Create.
- You will see an error message indicating the requested action of creating a Key Protect instance with the public and private network policy is noncompliant with your config rules.
- Dismiss the error message and change the Allowed Network Policy to Private only.
- Click Create.
- Your Key Protect instance was successfully created.
Now that you have created a rule and a Key Protect instance, you can use the Security and Compliance Center to continuously monitor your rule and any noncompliant resources. Results are generated every 24 hours and can be viewed on the results page. To learn more, visit Viewing evaluation results.
Step 4. Viewing audit events
Whenever a user attempts to make an update to a resource in your account that is governed by a config rule, an event is forwarded to the IBM Cloud Activity Tracker service instance that is available in the same location. The Activity Tracker logs can be used as part of your audit evidence to prove that you are compliant with the external regulations that are required for your industry. To view the events that are logged, you can use the Activity Tracker UI:
- Open the Activity Tracker service instance that is available in Dallas (us-south). For help getting to the UI, see Launching the web UI through the IBM Cloud UI.
- Filter for events based on specific fields by creating a query in Activity Tracker that takes the following form:
action:compliance.configuration-governance-resource.eval <additional field>. Review the following additional fields and append the filter to create your query:
- To see how often your config rules are compliant:
- To see how often your resources that are governed with config rules are allowed to be modified:
- To see how often resources are evaluated as noncompliant:
- To see how often a resource is prevented from being modified or provisioned due to an existing config rule:
Tip: Filtering to see how often resources are evaluated as noncompliant is useful to see how big of an impact enabling enforcement on a config rule will have in your account.
In the following example, you can see the truncated result of a query for:
action:compliance.configuration-governance-resource.eval compliance.isCompliant:true compliance.isAllowed:true
Because you attempted to create an instance of Key Protect twice, you will see two events:
- A noncompliant event from the blocked action in step 3.5
- A compliant event from the allowed action in step 3.8.
By completing this tutorial, you performed the following tasks:
- Created a config rule and attached it to a scope
- Blocked creation of a Key Protect instance which was noncompliant with your newly created rule
- Viewed audit events for noncompliant and compliant resource configuration changes