RDS instance has SQL auditing enabled
Alibaba Cloud RDS instances should have SQL auditing (SQL Explorer) enabled to track database events in an audit log. This helps maintain regulatory compliance, understand database activity, and detect anomalies indicating security violations. Applies to all RDS engines except SQL Server 2012/2016/2017 and MariaDB TX.
Risk
Without SQL auditing, it is difficult to detect unauthorized access, data breaches, or malicious activity within the database. The absence of audit logs hinders forensic investigations, compliance reporting, and the ability to identify data exfiltration or privilege escalation attempts, impacting confidentiality and integrity.
Run this check with Prowler
Run in Prowler Cloudprowler alibabacloud --checks rds_instance_sql_audit_enabledRecommendation
Enable SQL auditing (SQL Explorer) on all applicable RDS instances to track database events and maintain audit logs for security monitoring and compliance.
Remediation
CLI
aliyun rds ModifySQLCollectorPolicy --DBInstanceId <instance_id> --SQLCollectorStatus Enable --StoragePeriod <days>Other
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.rds.rds_client import rds_client
class rds_instance_sql_audit_enabled(Check):
"""Check if 'Auditing' is set to 'On' for applicable database instances."""
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
for instance in rds_client.instances:
report = CheckReportAlibabaCloud(
metadata=self.metadata(), resource=instance
)
report.region = instance.region
report.resource_id = instance.id
report.resource_arn = f"acs:rds:{instance.region}:{rds_client.audited_account}:dbinstance/{instance.id}"
if instance.audit_log_enabled:
report.status = "PASS"
report.status_extended = (
f"RDS Instance {instance.name} has SQL audit enabled."
)
else:
report.status = "FAIL"
report.status_extended = (
f"RDS Instance {instance.name} does not have SQL audit enabled."
)
findings.append(report)
return findings