- What's New
- Service Overview
- Getting Started
-
User Guide
- Resource List
- Resource Recorder
-
Resource Compliance
- Overview
- Rules
- Organization Rules
- Viewing Noncompliant Resources
- Compliance Rule Concepts
-
Built-In Policies
- Predefined Policy List
-
General Policies
- Resource Names Meet Regular Expression Requirements
- Resources Have All the Specified Tags Attached
- Resources Have One of the Specified Tags Attached
- Tag Prefixes and Suffixes Check
- Resources Have at Least One Tags Attached
- Resource Tag Check
- Resources Are in Specified Enterprise Projects
- Resources Are in Specified Regions
- Resource Type Check by Specifying Allowed Resource Types
- Resource Type Check by Specifying Unallowed Resource Types
- API Gateway
- CodeArts Deploy
- MapReduce Service
- NAT Gateway
- VPC Endpoint
- Web Application Firewall
- Elastic Load Balance
- Elastic IP
- Auto Scaling
- Scalable File Service Turbo (SFS Turbo)
-
Elastic Cloud Server
- Flavor Check
- Image Check
- Image Check by Tag
- Security Group Check by ID
- VPC Check by ID
- ECSs Have Key Pairs Attached
- ECSs Cannot Be Accessed Through Public Networks
- An ECS Does Not Have Multiple EIPs Attached
- Idle ECS Check
- ECSs Have IAM Agencies Attached
- Image Check by Name
- ECSs Have Backup Vaults Attached
- Backup Time Check
- ECSs Have HSS Agents Attached
-
Distributed Cache Service
- DCS Memcached Instances Support SSL
- DCS Memcached Instances Are in a Specified VPC
- DCS Memcached Instances Do Not Have EIPs Attached
- Access Mode Check
- DCS Redis Instances Support SSL
- Cross-AZ Deployment Check
- DCS Redis Instances Are in the Specified VPC
- DCS Redis Instances Do Not Have EIPs Attached
- Access Mode Check
- FunctionGraph
- Content Delivery Network (CDN)
- Config
- Data Warehouse Service
- Data Replication Service
- Data Encryption Workshop
-
Identity and Access Management
- Key Rotation Check
- IAM Policies Do Not Allow Blocked Actions on KMS Keys
- Each User Group Has at Least One User
- Password Strength Check
- Unintended Policy Check
- Admin Permissions Check
- Custom Policies Do Not Allow All Actions for a Service
- The Root User Does Not Have Available Access Keys
- Access Mode Check
- Access Key Check
- IAM Users Are in Specified User Groups
- Last Login Check
- Multi-Factor Authentication Check
- A User Does Not have Multiple Active Access Keys
- MFA Has Been Enabled for Console Login
- The Root User Has MFA Enabled
- All IAM Policies Are in Use
- All IAM Roles Are in Use
- Login Protection Check
- IAM Agencies Contain Specified Policies
- The Admin User Group Only Contains the Root User
- IAM Users Do Not Have Directly Assigned Policies or Permissions
- Document Database Service
- Simple Message Notification
- Virtual Private Cloud
- Virtual Private Network
- Cloud Eye
- Cloud Container Engine
-
Cloud Trace Service
- CTS Trackers Have Traces Encrypted
- CTS Trackers Have Trace Transfer to LTS Enabled
- CTS Trackers Have Been Created for the Specified OBS Bucket
- Trace File Verification Is Enabled
- At Least One Tracker Is Enabled
- There Are CTS Trackers In the Specified Regions
- CTS Trackers Comply with Security Best Practices
-
Relational Database Service
- Error Log Collection Is Enabled for RDS Instances
- Error Log Collection Is Enabled for RDS Instances
- RDS Instances Support Slow Query Logs
- Single-AZ Cluster Check
- RDS Instances Do Not Have EIPs Attached
- RDS Instances Use KMS Encryption
- RDS Instances Are in the Specified VPC
- Both Error Logs and Slow Query Logs Are Collected for RDS Instances
- Flavor Check
- RDS Instances Have SSL Enabled
- RDS Instance Port Check
- Version Check for RDS Instance Engines
- RDS Instances Have Audit Log Enabled
- GaussDB
- TaurusDB
- GeminiDB
-
Cloud Search Service
- CSS Clusters Have the Security Mode Enabled
- The Snapshot Function Is Enabled for CSS Clusters
- Disk Encryption Is Enabled for CSS Clusters
- HTTPS Access Is Enabled for CSS Clusters
- CSS Clusters Are in Specified VPCs
- Single-AZ CSS Cluster Check
- A CSS Cluster Has at Least Two Instances
- CSS Clusters Are Not Publicly Accessible
- CSS Clusters Support the Security Mode
- CSS Clusters Have Access Control Enabled
- CSS Clusters Have Kibana Public Access Control Enabled
- CSS Clusters Have Slow Query Log Enabled
- Elastic Volume Service
- Cloud Certificate Manager
- Distributed Message Service for Kafka
- Distributed Message Service for RabbitMQ
- Distributed Message Service for RocketMQ
- Organizations
- Cloud Firewall
- Cloud Backup and Recovery
- Object Storage Service
- Image Management Service
- Bare Metal Server
- Graph Engine Service
- Resource Compliance Event Monitoring
-
Conformance Packages
- Overview
- Conformance Packages
- Organization Conformance Packages
- Custom Conformance Packages
-
Conformance Package Templates
- Overview
- Conformance Package for Classified Protection of Cybersecurity Level 3 (2.0)
- Conformance Package for the Financial Industry
- Conformance Package for Network Security
- Conformance Package for Identity and Access Management
- Conformance Package for Cloud Eye
- Conformance Package for Compute Services
- Conformance Package for ECS
- Conformance Package for ELB
- Conformance Package for Management and Regulatory Services
- Conformance Package for RDS
- Conformance Package for AS
- Conformance Package for CTS
- Conformance Package for AI and Machine Learning
- Conformance Package for Autopilot
- Conformance Package for Enabling Public Access
- Conformance Package for Logging and Monitoring
- Conformance Package for Architecture Reliability
- Conformance Package for Hong Kong Monetary Authority of China Requirements
- Conformance Package for ENISA Requirements
- Conformance Package for SWIFT CSP
- Conformance Package for Germany Cloud Computing Compliance Criteria Catalogue
- Conformance Package for PCI DSS
- Conformance Package for Healthcare Industry
- Best Practices of Network and Data Security
- Conformance Package for Landing Zone
- Architecture Security Best Practices
- Best Practices for Network and Content Delivery Service Operations
- Best Practices for Idle Asset Management
- Multi-AZ Deployment Best Practices
- Resource Stability Best Practices
- Best Practices for API Gateway
- Best Practices for Cloud Container Engine
- Best Practices for Content Delivery Network
- Best Practices for FunctionGraph
- Best Practices for GaussDB
- Best Practices for GeminiDB
- Best Practices for MapReduce Service
- Best Practices for NIST Requirements
- Best Practices for Singapore Financial Industry
- Best Practices for Secure Identity and Compliance Operations
- Conformance Package for Huawei Cloud Security Configuration Guide (Level 1)
- Conformance Package for Huawei Cloud Security Configuration Guide (Level 2)
- Best Practices for Static Data Encryption
- Best Practices for Data Transmission Encryption
- Best Practices for Cloud Backup and Recovery
- Best Practices for Cloud Search Service
- Best Practices for Distributed Cache Service
- Best Practices for Distributed Message Service
- Best Practices for Data Warehouse Service
- Best Practices for TaurusDB
- Best Practices for Object Storage Service
- Best Practices for Virtual Private Cloud
- Best Practices for Web Application Firewall
- Advanced Queries
- Resource Aggregation
- Cloud Trace Service
- Appendix
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs
-
Resource List
- Querying Resources of a Specific Type
- Querying Cloud Services
- Querying a Resource
- Querying All Resources Recorded by the Resource Recorder
- Querying How Many Resources Are Recorded by the Resource Recorder
- Querying Resource Tags Recorded by the Resource Recorder
- Querying Resource Overview Recorded by the Resource Recorder
- Querying a Specific Resource Recorded by the Resource Recorder
- Querying All Resources Under an Account
- Querying a Resource Under an Account
- Querying Resource Tags
- Querying the Number of Resources
- Querying Resource Overview
- Resource Recorder
- Resource Relationships
- Resource Change Records
-
Compliance
- Querying Built-in Policies
- Querying Specific Built-in Policy
- Adding a Rule
- Querying Rules
- Modifying a Rule
- Querying a Specific Rule
- Deleting a Rule
- Enabling a Rule
- Disabling a Rule
- Running a Resource Compliance Evaluation
- Querying the Evaluation Status of a Rule
- Querying the Compliance of a Resource
- Querying the Compliance of a Rule
- Querying Compliance of an Account
- Updating the Compliance Result
- Creating an Organization Rule
- Querying Organization Rules
- Querying a Specific Organization Rule
- Deleting an Organization Rule
- Updating an Organization Rule
- Querying the Deployment Status of an Organization Rule
- Querying Statuses of Organization Rule Deployment to Member Accounts
- Setting up or Updating Remediation Configurations
- Querying Remediation Configurations
- Deleting Remediation Configurations
- Batch Creating Remediation Exceptions
- Batch Deleting Remediation Exceptions
- Querying Remediation Exceptions
- Starting Remediation
- Querying Remediation Results
- Collect Remediation Results
- Region Management
- Advanced Queries
-
Resource Aggregators
- Creating a Resource Aggregator
- Querying Resource Aggregators
- Querying a Specific Resource Aggregator
- Querying Account Aggregation Statuses of a Specific Aggregator
- Updating a Resource Aggregator
- Deleting a Resource Aggregator
- Authorizing an Aggregator Account
- Querying Authorized Aggregator Accounts
- Deleting Authorization for an Aggregator Account
- Querying All Pending Aggregation Requests
- Deleting Pending Authorization Requests
- Querying the Number of Resources of an Aggregator Account
- Querying Resources of an Aggregator Account
- Querying Details About a Specific Resource in a Source Account
- Performing an Advanced Query on a Specific Aggregator
- Querying the Compliance Summary of One or More Source Accounts in an Aggregator
- Querying Aggregated Rules
- Querying Compliance Results of Aggregated Resources
- Querying Details About a Specified Aggregated Rule
-
Conformance Packages
- Querying Conformance Packages
- Creating a Conformance Package
- Querying a Specific Conformance Package
- Deleting a Conformance Package
- Updating Conformance Packages
- Querying Compliance of all Conformance Packages
- Querying Compliance of all Rules in a Conformance Package
- Querying Compliance of All Resources Evaluated with a Conformance Package
- Querying Scores of All Conformance Packages
- Querying Built-in Conformance Package Templates
- Querying the Template of a Built-in Conformance Package
- Creating organization conformance packages.
- Querying Organization Conformance Packages
- Querying an Organization Conformance Package
- Delete organization conformance packages.
- Updating Organization Conformance Packages
- Querying the Deployment Status of the Organization Conformance Package
- Querying the Statuses of Organization Conformance Package Deployment to Members.
- Resource Tags
-
Resource List
- Permissions Policies and Supported Actions
- Appendixes
- SDK Reference
-
Best Practices
- Creating Rules
- Querying Resource Details, Relationships, and Change Records
- Creating Alarm Rules for Noncompliant Resources with Cloud Eye
- Using Advanced Queries
- Querying Resources That Do Not Have Specific Tags
- Ensuring Resource Compliance by Tag, Region, and Organization
- Automating Resource Management
- FAQs
- General Reference
Copied.
Automating Resource Management
In this section, you will learn how to automate the detection and remediation of noncompliant resources with Config rules and the remediation function. This ensures that noncompliant resources whether resulting from intended or unintended actions can be remediated within minutes, enhancing resource security.
Applicable Scenario
Scenario: You can configure OBS bucket policies to block HTTP access to your buckets. For details Keeping Data in Transit Safe
Procedure
Create a rule.
- Log in to the Config Console.
- In the navigation pane on the left, choose Resource Compliance.
- On the Rules tab, click Add Rule.
- On the Basic Configurations page, select obs-bucket-ssl-requests-only in the Built-in Policy area, and click Next.
- On the Configure Rule Parameters page, remain the default settings for Resource Scope and select All for Region. Click Next to confirm the configurations and click Submit
- Return to the Rules tab to view evaluation results.
Configure mediation.
The following procedure shows how to use a FunctionGraph function to configure remediation. Python is used.
- Log in to the FunctionGraph console.
- In the navigation pane on the left, click Functions > Function List.
- On the Functions tab, click Create Function.
- Select Event Function for Function Type, select an agency, and select Python 3.9 for Runtime. The agency selected must contain at least the following permissions:
{ "Version": "1.1", "Statement": [ { "Effect": "Allow", "Action": [ "obs:bucket:PutBucketPolicy", "obs:bucket:GetBucketPolicy", "rms:resources:get" ] } ] }
- After the function is created, add the two dependencies: huaweicloudsdk_obs and huaweicloudsdkconfig, to the function.
- Add the following code to index.py:
import json from obs.client import ObsClient from huaweicloudsdkcore.auth.credentials import GlobalCredentials from huaweicloudsdkconfig.v1.region.config_region import ConfigRegion from huaweicloudsdkconfig.v1.config_client import ConfigClient from huaweicloudsdkconfig.v1 import ShowResourceDetailRequest def get_resource_region(context, domain_id, resource_id): auth = GlobalCredentials( ak=context.getSecurityAccessKey(), sk=context.getSecuritySecretKey(), domain_id=domain_id ).with_security_token(context.getSecurityToken()) client = ConfigClient.new_builder() \ .with_credentials(credentials=auth) \ .with_region(region=ConfigRegion.value_of(region_id="cn-north-4")) \ .build() resource = client.show_resource_detail(ShowResourceDetailRequest(resource_id)).to_json_object() return resource.get("region_id") def getBucketPolicy(obsClient, bucket_name): resp = obsClient.getBucketPolicy(bucket_name) if resp.status < 300: print("Get Bucket Policy Succeeded") return resp.body.policyJSON if resp.status == 404 and resp.errorCode == "NoSuchBucketPolicy": print("NoSuchBucketPolicy") return "{\"Statement\": []}" assert False, f"Get Bucket Policy Failed: {resp.errorCode} | {resp.errorMessage}" def ensurePolicySSL(obsClient, bucket_name, policy): policy["Statement"] = policy["Statement"] + [{ "Sid": "ensure_secure_transport", "Effect": "Deny", "Principal": {"ID": ["*"]}, "Action": ["*"], "Resource": [bucket_name, bucket_name + "/*"], "Condition": {"Bool": {"g:SecureTransport": ["false"]}} }] resp = obsClient.setBucketPolicy(bucket_name, policy) if resp.status < 300: print("Set Bucket Policy Succeeded") else: print(policy) assert False, f"Set Bucket Policy Failed: {resp.errorCode} | {resp.errorMessage}" def handler(event, context): domain_id = event.get("domain_id") bucket_name = event.get("bucket_name") print("domain_id", domain_id) print("bucket_name", bucket_name) region_id = get_resource_region(context, domain_id, bucket_name) print("region_id", region_id) server = f"https://obs.{region_id}.myhuaweicloud.com" obsClient = ObsClient( access_key_id=context.getSecurityAccessKey(), secret_access_key=context.getSecuritySecretKey(), server=server, security_token=context.getSecurityToken() ) policy = getBucketPolicy(obsClient, bucket_name) policy = json.loads(policy) ensurePolicySSL(obsClient, bucket_name, policy) obsClient.close()
- (Optional) Modify basic settings: Memory (MB) and Execution Timeout (s), and configure Log for the function. You are recommended to complete this step to ensure smooth resource remediation and enable logging in case of any errors that may occur.
Configuring Remediation
- Log in to the Config Console.
- In the navigation pane on the left, choose Resource Compliance.
- On the Rules tab, click the name of the rule.
- Click Remediation Management and click Remediation Configuration.
- Select Automatic or Manual for Method and remain the default settings for Retry Time Limit and Retries.
- Select FGS Template and select the function configured in the previous step.
- Set Dependent Resource Type to bucket_name and set the key of Parameter to domain_id and the value to the account ID.
- Click Save.
Manually Remediating Resources
The following procedure shows how to manually configure remediation:
- Go to the Remediation Management page.
- On the Resource Scope tab, select target resources.
- If you need to remediate the resources selected, click Execute Remediation.
- If you do not need to remediate the resources, click Add to Remediation Exception.
- Log in to the OBS console and go to the details page of the OBS bucket.
- Check if the bucket policy has been modified.
FAQs
What Are the Differences Between Manual Remediation and Automatic Remediation?
Manual remediation requires you to manually search for and remediate noncompliant resources. Automatic remediation automatically applies remediation to noncompliant resources detected by a rule.
You are recommended to select manual remediation if it is the first time you configure remediation. Manual remediation can prevent service interruptions caused by resource modifications.
If you change manual remediation to automatic, all noncompliant resources detected after the change will be automatically remediated.
Why Does a Resource Fail to Be Remediated After the Remediation Is Applied?
This is typically caused by incorrect code in the FunctionGraph function or insufficient permissions of FunctionGraph. You can check the reasons by looking at the logs.
Why Is a Resource Still Noncompliant After the Remediation Is Applied?
Typically, a resource modification is reported to Config within 5 minutes of when the resource is modified, and the rule will be automatically triggered to generate the latest evaluation results.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot