-
Notifications
You must be signed in to change notification settings - Fork 0
/
ram_user_report_mfa.sp
62 lines (51 loc) · 1.24 KB
/
ram_user_report_mfa.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
dashboard "ram_user_mfa_report" {
title = "AliCloud RAM User MFA Report"
documentation = file("./dashboards/ram/docs/ram_user_report_mfa.md")
tags = merge(local.ram_common_tags, {
type = "Report"
category = "Security"
})
container {
card {
query = query.ram_user_count
width = 3
}
card {
query = query.ram_user_no_mfa_count
width = 3
}
}
table {
column "Account ID" {
display = "none"
}
column "ARN" {
display = "none"
}
column "User Name" {
href = "${dashboard.ram_user_detail.url_path}?input.user_arn={{.ARN | @uri}}"
}
query = query.ram_user_mfa_table
}
}
query "ram_user_mfa_table" {
sql = <<-EOQ
select
u.name as "User Name",
u.arn as "ARN",
mfa ->> 'SerialNumber' as "MFA Serial Number",
case when u.mfa_enabled then 'Active' else null end as "MFA Status",
mfa ->> 'ActivateDate' as "Activate Date",
a.title as "Account",
a.account_id as "Account ID"
from
alicloud_ram_user as u,
alicloud_account as a,
jsonb_array_elements(virtual_mfa_devices) as mfa
where
u.account_id = a.account_id
order by
u.mfa_enabled desc,
u.name;
EOQ
}