Skip to content

Commit

Permalink
Protobuf and configuration for Access Graph Azure Discovery (#50364)
Browse files Browse the repository at this point in the history
* Protobuf and configuration for Access Graph Azure Discovery

* Adding godoc and removing Integration field from fileconf
  • Loading branch information
mvbrock committed Feb 5, 2025
1 parent 18a4578 commit 5d4e804
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 44 deletions.
12 changes: 11 additions & 1 deletion api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8109,12 +8109,14 @@ message OktaOptions {
message AccessGraphSync {
// AWS is a configuration for AWS Access Graph service poll service.
repeated AccessGraphAWSSync AWS = 1 [(gogoproto.jsontag) = "aws,omitempty"];
// PollInterval is the frequency at which to poll for AWS resources
// PollInterval is the frequency at which to poll for resources
google.protobuf.Duration PollInterval = 2 [
(gogoproto.jsontag) = "poll_interval,omitempty",
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true
];
// Azure is a configuration for Azure Access Graph service poll service.
repeated AccessGraphAzureSync Azure = 3 [(gogoproto.jsontag) = "azure,omitempty"];
}

// AccessGraphAWSSync is a configuration for AWS Access Graph service poll service.
Expand All @@ -8126,3 +8128,11 @@ message AccessGraphAWSSync {
// Integration is the integration name used to generate credentials to interact with AWS APIs.
string Integration = 4 [(gogoproto.jsontag) = "integration,omitempty"];
}

// AccessGraphAzureSync is a configuration for Azure Access Graph service poll service.
message AccessGraphAzureSync {
// SubscriptionID Is the ID of the Azure subscription to sync resources from
string SubscriptionID = 1 [(gogoproto.jsontag) = "subscription_id,omitempty"];
// Integration is the integration name used to generate credentials to interact with AWS APIs.
string Integration = 2 [(gogoproto.jsontag) = "integration,omitempty"];
}
107 changes: 66 additions & 41 deletions api/types/discoveryconfig/derived.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen/proto/go/accessgraph/v1alpha/azure.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,12 @@ kubernetes matchers are present`)
AssumeRole: assumeRole,
})
}
for _, azureMatcher := range fc.Discovery.AccessGraph.Azure {
subscriptionID := azureMatcher.SubscriptionID
tMatcher.Azure = append(tMatcher.Azure, &types.AccessGraphAzureSync{
SubscriptionID: subscriptionID,
})
}
if fc.Discovery.AccessGraph.PollInterval > 0 {
tMatcher.PollInterval = fc.Discovery.AccessGraph.PollInterval
}
Expand Down
8 changes: 8 additions & 0 deletions lib/config/fileconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,8 @@ type GCPMatcher struct {
type AccessGraphSync struct {
// AWS is the AWS configuration for the AccessGraph Sync service.
AWS []AccessGraphAWSSync `yaml:"aws,omitempty"`
// Azure is the Azure configuration for the AccessGraph Sync service.
Azure []AccessGraphAzureSync `yaml:"azure,omitempty"`
// PollInterval is the frequency at which to poll for AWS resources
PollInterval time.Duration `yaml:"poll_interval,omitempty"`
}
Expand All @@ -1538,6 +1540,12 @@ type AccessGraphAWSSync struct {
ExternalID string `yaml:"external_id,omitempty"`
}

// AccessGraphAzureSync represents the configuration for the Azure AccessGraph Sync service.
type AccessGraphAzureSync struct {
// SubscriptionID is the Azure subscription ID configured for syncing
SubscriptionID string `yaml:"subscription_id,omitempty"`
}

// CommandLabel is `command` section of `ssh_service` in the config file
type CommandLabel struct {
Name string `yaml:"name"`
Expand Down
2 changes: 1 addition & 1 deletion proto/accessgraph/v1alpha/azure.proto
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ message AzureRoleDefinition {
string type = 9;
}

// AzurePermission defines the actions and not (disallowed) actions for a role definition
// AzureRBACPermission defines the actions and not (disallowed) actions for a role definition
message AzureRBACPermission {
// actions define the resources and verbs allowed on the resources
repeated string actions = 1;
Expand Down

0 comments on commit 5d4e804

Please sign in to comment.