TMAegisBeta
Više pravila za alibaba

Alibaba Cloud

TMA-ALIBABA-6.4

Ensure that 'Auditing' Retention is 'greater than 6 months'

SrednjaNivo 1Automatskaalibaba

Opis

Database SQL Audit Retention should be configured to be greater than 90 days. Audit Logs can be used to check for anomalies and give insight into suspected breaches or misuse of information and access. DescribeSQLCollectorRetention ConfigValue (days) must be 180 (6 months) or more for every instance. Iterates every RDS region and instance (DescribeDBInstances). Read-only aliyun CLI calls; credentials and default region come from the CLI's normal profile (aliyun configure, ~/.aliyun/config.json or ALIBABA_CLOUD_* environment variables). JSON output is parsed with sed/awk. A missing CLI or credential fails the check.

Kako se proverava

Metod provere: Komanda ljuske

shell
regs=$(aliyun rds DescribeRegions 2>/dev/null) || exit 1
regions=$(printf '%s\n' "$regs" | sed -n 's/.*"RegionId"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | sort -u)
[ -n "$regions" ] || exit 1
bad=0
for r in $regions; do
  page=1
  while :; do
    out=$(aliyun rds DescribeDBInstances --RegionId "$r" --PageSize 100 --PageNumber "$page" 2>/dev/null) || exit 1
    ids=$(printf '%s\n' "$out" | sed -n 's/.*"DBInstanceId"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | sort -u)
    [ -n "$ids" ] || break
    for i in $ids; do
      s=$(aliyun rds DescribeSQLCollectorRetention --DBInstanceId "$i" 2>/dev/null) || exit 1
      d=$(printf '%s\n' "$s" | sed -n 's/.*"ConfigValue"[[:space:]]*:[[:space:]]*"\{0,1\}\([0-9]\{1,\}\).*/\1/p' | head -n 1)
      [ "${d:-0}" -ge 180 ] || { echo "SQL audit retention ${d:-unset} days: $r $i"; bad=1; }
    done
    set -- $ids
    [ "$#" -lt 100 ] && break
    page=$((page + 1))
  done
done
[ "$bad" -eq 0 ] && echo compliant
Očekivani izlaz
compliant

Kako se ispravlja

Metod ispravke: Smernica ili zakrpa infrastrukture

aliyun rds ModifySQLCollectorRetention --DBInstanceId <id> --ConfigValue 180 (or longer), or SQL Explorer > Service Settings > storage duration 6 months or more.

Svojstva

Operativni sistemi
Bilo koji
Oznake
alibabards
Referenca
CIS Alibaba Cloud Foundation Benchmark v2.0.1 - 6.4 Ensure that 'Auditing' Retention is 'greater than 6 months'

Proverite ovaj računar

Pokrenite ovo na računaru za koji imate dozvolu za proveru. Skeniranje radi u režimu samo za čitanje.

shell
tmaegis scan --target alibaba