TMAegisBeta
Thêm quy tắc cho alibaba

Alibaba Cloud

TMA-ALIBABA-3.1

Ensure legacy networks does not exist

Trung bìnhCấp 1Tự độngalibaba

Mô tả

In order to prevent use of legacy networks, ECS instances should not have a legacy network configured. Legacy networks have a single network IPv4 prefix range and a single gateway IP address for the whole network. With legacy networks, you cannot create subnetworks or switch from legacy to auto or custom subnet networks. Counts ECS instances with InstanceNetworkType classic in every region; any instance on the legacy classic network fails. 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.

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
regs=$(aliyun ecs 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
  out=$(aliyun ecs DescribeInstances --RegionId "$r" --InstanceNetworkType classic --PageSize 10 2>/dev/null) || exit 1
  n=$(printf '%s\n' "$out" | sed -n 's/.*"TotalCount"[[:space:]]*:[[:space:]]*\([0-9]\{1,\}\).*/\1/p' | head -n 1)
  [ "${n:-0}" -eq 0 ] || { echo "classic-network instances in $r: $n"; bad=1; }
done
[ "$bad" -eq 0 ] && echo compliant
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

Migrate classic-network ECS instances to a VPC (ECS console > Instances > Migrate to VPC) and stop creating classic-network resources.

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
alibabanetwork
Tham chiếu
CIS Alibaba Cloud Foundation Benchmark v2.0.1 - 3.1 Ensure legacy networks does not exist

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target alibaba