-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathconfig.go
More file actions
160 lines (155 loc) · 4.71 KB
/
config.go
File metadata and controls
160 lines (155 loc) · 4.71 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// Copyright Mondoo, Inc. 2024, 2026
// SPDX-License-Identifier: BUSL-1.1
package config
import (
"go.mondoo.com/mql/v13/providers-sdk/v1/inventory"
"go.mondoo.com/mql/v13/providers-sdk/v1/plugin"
"go.mondoo.com/mql/v13/providers/azure/connection/azureinstancesnapshot"
"go.mondoo.com/mql/v13/providers/azure/provider"
"go.mondoo.com/mql/v13/providers/azure/resources"
)
var Config = plugin.Provider{
Name: "azure",
ID: "go.mondoo.com/cnquery/v9/providers/azure",
Version: "13.3.2",
ConnectionTypes: []string{
provider.ConnectionType,
string(azureinstancesnapshot.SnapshotConnectionType),
},
Connectors: []plugin.Connector{
{
Name: "azure",
Use: "azure",
Short: "an Azure subscription",
Long: `Use the azure provider to query resources within Microsoft Azure, including storage, compute instances, snapshots, databases, and more.
Examples run in your shell:
cnspec scan azure compute instance <instance-name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
cnspec scan azure compute snapshot <snapshot-name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
cnspec shell azure <subscription-name> --client-id <your-client-id> --tenant-id <your-tenant-id> --client-secret <your-client-secret-value>
Examples run in the Azure CLI:
cnspec shell azure
cnspec scan azure --subscription <specific-subscription-id>
`,
MinArgs: 0,
MaxArgs: 8,
Discovery: []string{
resources.DiscoverySubscriptions,
resources.DiscoveryInstances,
resources.DiscoveryInstancesApi,
resources.DiscoverySqlServers,
resources.DiscoveryPostgresServers,
resources.DiscoveryPostgresFlexibleServers,
resources.DiscoveryMySqlServers,
resources.DiscoveryMySqlFlexibleServers,
resources.DiscoveryAksClusters,
resources.DiscoveryAppServiceApps,
resources.DiscoveryCacheRedis,
resources.DiscoveryBatchAccounts,
resources.DiscoveryStorageAccounts,
resources.DiscoveryStorageContainers,
resources.DiscoveryKeyVaults,
resources.DiscoverySecurityGroups,
resources.DiscoveryCosmosDb,
resources.DiscoveryVirtualNetworks,
},
Flags: []plugin.Flag{
{
Long: "tenant-id",
Type: plugin.FlagType_String,
Default: "",
Desc: "Directory (tenant) ID of the service principal",
},
{
Long: "client-id",
Type: plugin.FlagType_String,
Default: "",
Desc: "Application (client) ID of the service principal",
},
{
Long: "client-secret",
Type: plugin.FlagType_String,
Default: "",
Desc: "Secret for application",
},
{
Long: "certificate-path",
Type: plugin.FlagType_String,
Default: "",
Desc: "Path (in PKCS #12/PFX or PEM format) to the authentication certificate",
},
{
Long: "certificate-secret",
Type: plugin.FlagType_String,
Default: "",
Desc: "Passphrase for the authentication certificate file",
},
{
Long: "subscription",
Type: plugin.FlagType_String,
Default: "",
Desc: "ID of the Azure subscription to scan",
Option: plugin.FlagOption_Hidden,
},
{
Long: "subscriptions",
Type: plugin.FlagType_String,
Default: "",
Desc: "Comma-separated list of Azure subscriptions to include",
},
{
Long: "subscriptions-exclude",
Type: plugin.FlagType_String,
Default: "",
Desc: "Comma-separated list of Azure subscriptions to exclude",
},
},
},
},
AssetUrlTrees: []*inventory.AssetUrlBranch{
{
PathSegments: []string{"technology=azure"},
Key: "tenant",
Title: "Tenant",
Values: map[string]*inventory.AssetUrlBranch{
"*": {
Key: "subscription",
Title: "Subscription",
Values: map[string]*inventory.AssetUrlBranch{
"*": {
Key: "service",
Values: map[string]*inventory.AssetUrlBranch{
"account": nil,
"compute": nil,
"mysql": nil,
"postgresql": nil,
"aks": nil,
"app-service": nil,
"cache": nil,
"batch": nil,
"sql": nil,
"storage": {
Key: "object",
Values: map[string]*inventory.AssetUrlBranch{
"account": nil,
"container": nil,
"other": nil,
},
},
"network": {
Key: "object",
Values: map[string]*inventory.AssetUrlBranch{
"security-group": nil,
"virtual-network": nil,
"other": nil,
},
},
"keyvault": nil,
"cosmosdb": nil,
},
},
},
},
},
},
},
}