From b2dc839dfe3fd8825052db65f4be43f80964e747 Mon Sep 17 00:00:00 2001 From: Hossein Rouhani <56231339+HRouhani@users.noreply.github.com> Date: Fri, 15 Dec 2023 19:03:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20=20=20improve=20ms365=20resource?= =?UTF-8?q?s=20(#2821)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ⭐️ Add new ms365 teams and exchange online resources Signed-off-by: Preslav * Update providers/ms365/resources/ms365.lr Co-authored-by: Letha * Update providers/ms365/resources/ms365.lr Co-authored-by: Letha * Update providers/ms365/resources/ms365.lr Co-authored-by: Letha * Update providers/ms365/resources/ms365.lr Co-authored-by: Letha * Update providers/ms365/resources/ms365.lr Co-authored-by: Letha * Update providers/ms365/resources/ms365.lr Co-authored-by: Letha --------- Signed-off-by: Preslav Co-authored-by: Letha --- providers/ms365/connection/exchange_report.go | 45 +- providers/ms365/connection/teams_report.go | 34 +- providers/ms365/resources/ms365.go | 55 +++ providers/ms365/resources/ms365.lr | 56 +++ providers/ms365/resources/ms365.lr.go | 410 ++++++++++++++++++ .../ms365/resources/ms365.lr.manifest.yaml | 48 +- 6 files changed, 628 insertions(+), 20 deletions(-) diff --git a/providers/ms365/connection/exchange_report.go b/providers/ms365/connection/exchange_report.go index cffe8e43e3..7fead925d6 100644 --- a/providers/ms365/connection/exchange_report.go +++ b/providers/ms365/connection/exchange_report.go @@ -41,6 +41,8 @@ $Mailbox = (Get-Mailbox -ResultSize Unlimited) $AtpPolicyForO365 = (Get-AtpPolicyForO365) $SharingPolicy = (Get-SharingPolicy) $RoleAssignmentPolicy = (Get-RoleAssignmentPolicy) +$ExternalInOutlook = (Get-ExternalInOutlook) + $exchangeOnline = New-Object PSObject Add-Member -InputObject $exchangeOnline -MemberType NoteProperty -Name MalwareFilterPolicy -Value @($MalwareFilterPolicy) @@ -60,6 +62,8 @@ Add-Member -InputObject $exchangeOnline -MemberType NoteProperty -Name Mailbox - Add-Member -InputObject $exchangeOnline -MemberType NoteProperty -Name AtpPolicyForO365 -Value @($AtpPolicyForO365) Add-Member -InputObject $exchangeOnline -MemberType NoteProperty -Name SharingPolicy -Value @($SharingPolicy) Add-Member -InputObject $exchangeOnline -MemberType NoteProperty -Name RoleAssignmentPolicy -Value @($RoleAssignmentPolicy) +Add-Member -InputObject $exchangeOnline -MemberType NoteProperty -Name ExternalInOutlook -Value @($ExternalInOutlook) + Disconnect-ExchangeOnline -Confirm:$false @@ -123,21 +127,28 @@ func (c *Ms365Connection) getReport(outlookToken, organization string) (*Exchang } type ExchangeOnlineReport struct { - MalwareFilterPolicy []interface{} `json:"MalwareFilterPolicy"` - HostedOutboundSpamFilterPolicy []interface{} `json:"HostedOutboundSpamFilterPolicy"` - TransportRule []interface{} `json:"TransportRule"` - RemoteDomain []interface{} `json:"RemoteDomain"` - SafeLinksPolicy []interface{} `json:"SafeLinksPolicy"` - SafeAttachmentPolicy []interface{} `json:"SafeAttachmentPolicy"` - OrganizationConfig interface{} `json:"OrganizationConfig"` - AuthenticationPolicy interface{} `json:"AuthenticationPolicy"` - AntiPhishPolicy []interface{} `json:"AntiPhishPolicy"` - DkimSigningConfig interface{} `json:"DkimSigningConfig"` - OwaMailboxPolicy interface{} `json:"OwaMailboxPolicy"` - AdminAuditLogConfig interface{} `json:"AdminAuditLogConfig"` - PhishFilterPolicy []interface{} `json:"PhishFilterPolicy"` - Mailbox []interface{} `json:"Mailbox"` - AtpPolicyForO365 []interface{} `json:"AtpPolicyForO365"` - SharingPolicy []interface{} `json:"SharingPolicy"` - RoleAssignmentPolicy []interface{} `json:"RoleAssignmentPolicy"` + MalwareFilterPolicy []interface{} `json:"MalwareFilterPolicy"` + HostedOutboundSpamFilterPolicy []interface{} `json:"HostedOutboundSpamFilterPolicy"` + TransportRule []interface{} `json:"TransportRule"` + RemoteDomain []interface{} `json:"RemoteDomain"` + SafeLinksPolicy []interface{} `json:"SafeLinksPolicy"` + SafeAttachmentPolicy []interface{} `json:"SafeAttachmentPolicy"` + OrganizationConfig interface{} `json:"OrganizationConfig"` + AuthenticationPolicy interface{} `json:"AuthenticationPolicy"` + AntiPhishPolicy []interface{} `json:"AntiPhishPolicy"` + DkimSigningConfig interface{} `json:"DkimSigningConfig"` + OwaMailboxPolicy interface{} `json:"OwaMailboxPolicy"` + AdminAuditLogConfig interface{} `json:"AdminAuditLogConfig"` + PhishFilterPolicy []interface{} `json:"PhishFilterPolicy"` + Mailbox []interface{} `json:"Mailbox"` + AtpPolicyForO365 []interface{} `json:"AtpPolicyForO365"` + SharingPolicy []interface{} `json:"SharingPolicy"` + RoleAssignmentPolicy []interface{} `json:"RoleAssignmentPolicy"` + ExternalInOutlook []*ExternalSender `json:"ExternalInOutlook"` +} + +type ExternalSender struct { + Identity string `json:"Identity"` + Enabled bool `json:"Enabled"` + AllowList []string `json:"AllowList"` } diff --git a/providers/ms365/connection/teams_report.go b/providers/ms365/connection/teams_report.go index 2c2911d8e8..1c6d36b00f 100644 --- a/providers/ms365/connection/teams_report.go +++ b/providers/ms365/connection/teams_report.go @@ -24,12 +24,15 @@ Import-Module MicrosoftTeams Connect-MicrosoftTeams -AccessTokens @("$graphToken", "$teamsToken") $CsTeamsClientConfiguration = (Get-CsTeamsClientConfiguration) +$CsTenantFederationConfiguration = (Get-CsTenantFederationConfiguration) +$CsTeamsMeetingPolicy = (Get-CsTeamsMeetingPolicy -Identity Global) $msteams = New-Object PSObject Add-Member -InputObject $msteams -MemberType NoteProperty -Name CsTeamsClientConfiguration -Value $CsTeamsClientConfiguration +Add-Member -InputObject $msteams -MemberType NoteProperty -Name CsTenantFederationConfiguration -Value $CsTenantFederationConfiguration +Add-Member -InputObject $msteams -MemberType NoteProperty -Name CsTeamsMeetingPolicy -Value $CsTeamsMeetingPolicy Disconnect-MicrosoftTeams -Confirm:$false - ConvertTo-Json -Depth 4 $msteams ` @@ -98,5 +101,32 @@ func (c *Ms365Connection) getTeamsReport(accessToken, teamsToken string) (*MsTea } type MsTeamsReport struct { - CsTeamsClientConfiguration interface{} `json:"CsTeamsClientConfiguration"` + CsTeamsClientConfiguration interface{} `json:"CsTeamsClientConfiguration"` + CsTenantFederationConfiguration *CsTenantFederationConfiguration `json:"CsTenantFederationConfiguration"` + CsTeamsMeetingPolicy *CsTeamsMeetingPolicy `json:"CsTeamsMeetingPolicy"` +} + +type CsTenantFederationConfiguration struct { + Identity string `json:"Identity"` + AllowFederatedUsers bool `json:"AllowFederatedUsers"` + AllowPublicUsers bool `json:"AllowPublicUsers"` + AllowTeamsConsumer bool `json:"AllowTeamsConsumer"` + AllowTeamsConsumerInbound bool `json:"AllowTeamsConsumerInbound"` + TreatDiscoveredPartnersAsUnverified bool `json:"TreatDiscoveredPartnersAsUnverified"` + SharedSipAddressSpace bool `json:"SharedSipAddressSpace"` + RestrictTeamsConsumerToExternalUserProfiles bool `json:"RestrictTeamsConsumerToExternalUserProfiles"` + // TODO: we need to figure out how to get this right when using Convert-ToJson + // it currently comes back as an empty json object {} but the pwsh cmdlet spits out a string-looking value + AllowedDomains interface{} `json:"AllowedDomains"` + BlockedDomains interface{} `json:"BlockedDomains"` +} + +type CsTeamsMeetingPolicy struct { + AllowAnonymousUsersToJoinMeeting bool `json:"AllowFederatedUsers"` + AllowAnonymousUsersToStartMeeting bool `json:"AllowAnonymousUsersToStartMeeting"` + AutoAdmittedUsers string `json:"AutoAdmittedUsers"` + AllowPSTNUsersToBypassLobby bool `json:"AllowPSTNUsersToBypassLobby"` + MeetingChatEnabledType string `json:"MeetingChatEnabledType"` + DesignatedPresenterRoleMode string `json:"DesignatedPresenterRoleMode"` + AllowExternalParticipantGiveRequestControl bool `json:"AllowExternalParticipantGiveRequestControl"` } diff --git a/providers/ms365/resources/ms365.go b/providers/ms365/resources/ms365.go index 24ad432b7f..ba3d07de80 100644 --- a/providers/ms365/resources/ms365.go +++ b/providers/ms365/resources/ms365.go @@ -17,6 +17,10 @@ import ( "go.mondoo.com/cnquery/v9/types" ) +func (m *mqlMs365ExchangeonlineExternalSender) id() (string, error) { + return m.Identity.Data, nil +} + func initMs365Exchangeonline(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) { conn := runtime.Connection.(*connection.Ms365Connection) ctx := context.Background() @@ -61,6 +65,20 @@ func initMs365Exchangeonline(runtime *plugin.Runtime, args map[string]*llx.RawDa sharingPolicy, _ := convert.JsonToDictSlice(report.SharingPolicy) roleAssignmentPolicy, _ := convert.JsonToDictSlice(report.RoleAssignmentPolicy) + externalInOutlook := []interface{}{} + for _, e := range report.ExternalInOutlook { + mql, err := CreateResource(runtime, "ms365.exchangeonline.externalSender", + map[string]*llx.RawData{ + "identity": llx.StringData(e.Identity), + "enabled": llx.BoolData(e.Enabled), + "allowList": llx.ArrayData(llx.TArr2Raw(e.AllowList), types.Any), + }) + if err != nil { + return args, nil, err + } + + externalInOutlook = append(externalInOutlook, mql) + } args["malwareFilterPolicy"] = llx.ArrayData(malwareFilterPolicy, types.Any) args["hostedOutboundSpamFilterPolicy"] = llx.ArrayData(hostedOutboundSpamFilterPolicy, types.Any) args["transportRule"] = llx.ArrayData(transportRule, types.Any) @@ -78,6 +96,7 @@ func initMs365Exchangeonline(runtime *plugin.Runtime, args map[string]*llx.RawDa args["atpPolicyForO365"] = llx.ArrayData(atpPolicyForO365, types.Any) args["sharingPolicy"] = llx.ArrayData(sharingPolicy, types.Any) args["roleAssignmentPolicy"] = llx.ArrayData(roleAssignmentPolicy, types.Any) + args["externalInOutlook"] = llx.ArrayData(externalInOutlook, types.ResourceLike) return args, nil, nil } @@ -139,5 +158,41 @@ func initMs365Teams(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[ csTeamsClientConfiguration, _ := convert.JsonToDict(report.CsTeamsClientConfiguration) args["csTeamsClientConfiguration"] = llx.DictData(csTeamsClientConfiguration) + tenantConfig := report.CsTenantFederationConfiguration + teamsPolicy := report.CsTeamsMeetingPolicy + tenantConfigBlockedDomains, _ := convert.JsonToDict(tenantConfig.BlockedDomains) + + mqlTenantConfig, err := CreateResource(runtime, "ms365.teams.tenantFederationConfig", + map[string]*llx.RawData{ + "identity": llx.StringData(tenantConfig.Identity), + "blockedDomains": llx.DictData(tenantConfigBlockedDomains), + "allowFederatedUsers": llx.BoolData(tenantConfig.AllowFederatedUsers), + "allowPublicUsers": llx.BoolData(tenantConfig.AllowPublicUsers), + "allowTeamsConsumer": llx.BoolData(tenantConfig.AllowTeamsConsumer), + "allowTeamsConsumerInbound": llx.BoolData(tenantConfig.AllowTeamsConsumerInbound), + "treatDiscoveredPartnersAsUnverified": llx.BoolData(tenantConfig.TreatDiscoveredPartnersAsUnverified), + "sharedSipAddressSpace": llx.BoolData(tenantConfig.SharedSipAddressSpace), + "restrictTeamsConsumerToExternalUserProfiles": llx.BoolData(tenantConfig.RestrictTeamsConsumerToExternalUserProfiles), + }) + if err != nil { + return args, nil, err + } + mqlTeamsPolicy, err := CreateResource(runtime, "ms365.teams.teamsMeetingPolicyConfig", + map[string]*llx.RawData{ + "allowAnonymousUsersToJoinMeeting": llx.BoolData(teamsPolicy.AllowAnonymousUsersToJoinMeeting), + "allowAnonymousUsersToStartMeeting": llx.BoolData(teamsPolicy.AllowAnonymousUsersToStartMeeting), + "autoAdmittedUsers": llx.StringData(teamsPolicy.AutoAdmittedUsers), + "allowPSTNUsersToBypassLobby": llx.BoolData(teamsPolicy.AllowPSTNUsersToBypassLobby), + "meetingChatEnabledType": llx.StringData(teamsPolicy.MeetingChatEnabledType), + "designatedPresenterRoleMode": llx.StringData(teamsPolicy.DesignatedPresenterRoleMode), + "allowExternalParticipantGiveRequestControl": llx.BoolData(teamsPolicy.AllowExternalParticipantGiveRequestControl), + }) + if err != nil { + return args, nil, err + } + + args["csTenantFederationConfiguration"] = llx.ResourceData(mqlTenantConfig, mqlTenantConfig.MqlName()) + args["csTeamsMeetingPolicy"] = llx.ResourceData(mqlTeamsPolicy, mqlTeamsPolicy.MqlName()) + return args, nil, nil } diff --git a/providers/ms365/resources/ms365.lr b/providers/ms365/resources/ms365.lr index f4e67362e2..37f9b8580d 100644 --- a/providers/ms365/resources/ms365.lr +++ b/providers/ms365/resources/ms365.lr @@ -378,6 +378,18 @@ ms365.exchangeonline { sharingPolicy []dict // List of role assignment policies roleAssignmentPolicy []dict + // List of external sender configurations + externalInOutlook []ms365.exchangeonline.externalSender +} + +// Microsoft 365 ExchangeOnline ExternalSender +private ms365.exchangeonline.externalSender { + // The identity of the external sender + identity string + // The list of specified senders that do not receive the External icon in the area of subject line + allowList []string + // Whether the feature is enabled + enabled bool } // Microsoft 365 SharePoint Online @@ -392,4 +404,48 @@ ms365.sharepointonline { ms365.teams { // CS Teams client configuration csTeamsClientConfiguration dict + // CS Teams tenant federated configuration + csTenantFederationConfiguration ms365.teams.tenantFederationConfig + // CS Teams meeting policy configuration + csTeamsMeetingPolicy ms365.teams.teamsMeetingPolicyConfig +} + +// Microsoft 365 Teams tenant federation configuration +private ms365.teams.tenantFederationConfig { + // ID of the collection of tenant federation configuration settings + identity string + // Blocked domains + blockedDomains dict + // Whether federated users are allowed + allowFederatedUsers bool + // Whether public users are allowed + allowPublicUsers bool + // Whether to allow external Teams consumers + allowTeamsConsumer bool + // Whether to allow inbound communication with external Teams consumers + allowTeamsConsumerInbound bool + // Whether to treat discovered partners as unverified + treatDiscoveredPartnersAsUnverified bool + // Whether shared SIP address space is enabled + sharedSipAddressSpace bool + // Whether to restrict Teams consumer to external user profiles + restrictTeamsConsumerToExternalUserProfiles bool +} + +// Teams meeting policy configuration +private ms365.teams.teamsMeetingPolicyConfig { + // Whether anonymous users are allowed to join + allowAnonymousUsersToJoinMeeting bool + // Whether anonymous users are allowed to start the meeting + allowAnonymousUsersToStartMeeting bool + // Who can bypass the lobby + autoAdmittedUsers string + // Whether public switched telephone network (PSTN) users can bypass the lobby + allowPSTNUsersToBypassLobby bool + // Whether meeting chat is enabled + meetingChatEnabledType string + // Designated presenter role mode + designatedPresenterRoleMode string + // Whether external participants can give or request control of the meeting + allowExternalParticipantGiveRequestControl bool } \ No newline at end of file diff --git a/providers/ms365/resources/ms365.lr.go b/providers/ms365/resources/ms365.lr.go index d8bb0ce920..778ed1ba4b 100644 --- a/providers/ms365/resources/ms365.lr.go +++ b/providers/ms365/resources/ms365.lr.go @@ -94,6 +94,10 @@ func init() { Init: initMs365Exchangeonline, Create: createMs365Exchangeonline, }, + "ms365.exchangeonline.externalSender": { + // to override args, implement: initMs365ExchangeonlineExternalSender(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) + Create: createMs365ExchangeonlineExternalSender, + }, "ms365.sharepointonline": { Init: initMs365Sharepointonline, Create: createMs365Sharepointonline, @@ -102,6 +106,14 @@ func init() { Init: initMs365Teams, Create: createMs365Teams, }, + "ms365.teams.tenantFederationConfig": { + // to override args, implement: initMs365TeamsTenantFederationConfig(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) + Create: createMs365TeamsTenantFederationConfig, + }, + "ms365.teams.teamsMeetingPolicyConfig": { + // to override args, implement: initMs365TeamsTeamsMeetingPolicyConfig(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[string]*llx.RawData, plugin.Resource, error) + Create: createMs365TeamsTeamsMeetingPolicyConfig, + }, } } @@ -620,6 +632,18 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "ms365.exchangeonline.roleAssignmentPolicy": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlMs365Exchangeonline).GetRoleAssignmentPolicy()).ToDataRes(types.Array(types.Dict)) }, + "ms365.exchangeonline.externalInOutlook": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365Exchangeonline).GetExternalInOutlook()).ToDataRes(types.Array(types.Resource("ms365.exchangeonline.externalSender"))) + }, + "ms365.exchangeonline.externalSender.identity": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365ExchangeonlineExternalSender).GetIdentity()).ToDataRes(types.String) + }, + "ms365.exchangeonline.externalSender.allowList": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365ExchangeonlineExternalSender).GetAllowList()).ToDataRes(types.Array(types.String)) + }, + "ms365.exchangeonline.externalSender.enabled": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365ExchangeonlineExternalSender).GetEnabled()).ToDataRes(types.Bool) + }, "ms365.sharepointonline.spoTenant": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlMs365Sharepointonline).GetSpoTenant()).ToDataRes(types.Dict) }, @@ -629,6 +653,60 @@ var getDataFields = map[string]func(r plugin.Resource) *plugin.DataRes{ "ms365.teams.csTeamsClientConfiguration": func(r plugin.Resource) *plugin.DataRes { return (r.(*mqlMs365Teams).GetCsTeamsClientConfiguration()).ToDataRes(types.Dict) }, + "ms365.teams.csTenantFederationConfiguration": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365Teams).GetCsTenantFederationConfiguration()).ToDataRes(types.Resource("ms365.teams.tenantFederationConfig")) + }, + "ms365.teams.csTeamsMeetingPolicy": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365Teams).GetCsTeamsMeetingPolicy()).ToDataRes(types.Resource("ms365.teams.teamsMeetingPolicyConfig")) + }, + "ms365.teams.tenantFederationConfig.identity": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetIdentity()).ToDataRes(types.String) + }, + "ms365.teams.tenantFederationConfig.blockedDomains": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetBlockedDomains()).ToDataRes(types.Dict) + }, + "ms365.teams.tenantFederationConfig.allowFederatedUsers": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetAllowFederatedUsers()).ToDataRes(types.Bool) + }, + "ms365.teams.tenantFederationConfig.allowPublicUsers": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetAllowPublicUsers()).ToDataRes(types.Bool) + }, + "ms365.teams.tenantFederationConfig.allowTeamsConsumer": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetAllowTeamsConsumer()).ToDataRes(types.Bool) + }, + "ms365.teams.tenantFederationConfig.allowTeamsConsumerInbound": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetAllowTeamsConsumerInbound()).ToDataRes(types.Bool) + }, + "ms365.teams.tenantFederationConfig.treatDiscoveredPartnersAsUnverified": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetTreatDiscoveredPartnersAsUnverified()).ToDataRes(types.Bool) + }, + "ms365.teams.tenantFederationConfig.sharedSipAddressSpace": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetSharedSipAddressSpace()).ToDataRes(types.Bool) + }, + "ms365.teams.tenantFederationConfig.restrictTeamsConsumerToExternalUserProfiles": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTenantFederationConfig).GetRestrictTeamsConsumerToExternalUserProfiles()).ToDataRes(types.Bool) + }, + "ms365.teams.teamsMeetingPolicyConfig.allowAnonymousUsersToJoinMeeting": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetAllowAnonymousUsersToJoinMeeting()).ToDataRes(types.Bool) + }, + "ms365.teams.teamsMeetingPolicyConfig.allowAnonymousUsersToStartMeeting": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetAllowAnonymousUsersToStartMeeting()).ToDataRes(types.Bool) + }, + "ms365.teams.teamsMeetingPolicyConfig.autoAdmittedUsers": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetAutoAdmittedUsers()).ToDataRes(types.String) + }, + "ms365.teams.teamsMeetingPolicyConfig.allowPSTNUsersToBypassLobby": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetAllowPSTNUsersToBypassLobby()).ToDataRes(types.Bool) + }, + "ms365.teams.teamsMeetingPolicyConfig.meetingChatEnabledType": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetMeetingChatEnabledType()).ToDataRes(types.String) + }, + "ms365.teams.teamsMeetingPolicyConfig.designatedPresenterRoleMode": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetDesignatedPresenterRoleMode()).ToDataRes(types.String) + }, + "ms365.teams.teamsMeetingPolicyConfig.allowExternalParticipantGiveRequestControl": func(r plugin.Resource) *plugin.DataRes { + return (r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).GetAllowExternalParticipantGiveRequestControl()).ToDataRes(types.Bool) + }, } func GetData(resource plugin.Resource, field string, args map[string]*llx.RawData) *plugin.DataRes { @@ -1317,6 +1395,26 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlMs365Exchangeonline).RoleAssignmentPolicy, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) return }, + "ms365.exchangeonline.externalInOutlook": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365Exchangeonline).ExternalInOutlook, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) + return + }, + "ms365.exchangeonline.externalSender.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365ExchangeonlineExternalSender).__id, ok = v.Value.(string) + return + }, + "ms365.exchangeonline.externalSender.identity": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365ExchangeonlineExternalSender).Identity, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "ms365.exchangeonline.externalSender.allowList": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365ExchangeonlineExternalSender).AllowList, ok = plugin.RawToTValue[[]interface{}](v.Value, v.Error) + return + }, + "ms365.exchangeonline.externalSender.enabled": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365ExchangeonlineExternalSender).Enabled, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, "ms365.sharepointonline.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { r.(*mqlMs365Sharepointonline).__id, ok = v.Value.(string) return @@ -1337,6 +1435,86 @@ var setDataFields = map[string]func(r plugin.Resource, v *llx.RawData) bool { r.(*mqlMs365Teams).CsTeamsClientConfiguration, ok = plugin.RawToTValue[interface{}](v.Value, v.Error) return }, + "ms365.teams.csTenantFederationConfiguration": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365Teams).CsTenantFederationConfiguration, ok = plugin.RawToTValue[*mqlMs365TeamsTenantFederationConfig](v.Value, v.Error) + return + }, + "ms365.teams.csTeamsMeetingPolicy": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365Teams).CsTeamsMeetingPolicy, ok = plugin.RawToTValue[*mqlMs365TeamsTeamsMeetingPolicyConfig](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).__id, ok = v.Value.(string) + return + }, + "ms365.teams.tenantFederationConfig.identity": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).Identity, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.blockedDomains": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).BlockedDomains, ok = plugin.RawToTValue[interface{}](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.allowFederatedUsers": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).AllowFederatedUsers, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.allowPublicUsers": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).AllowPublicUsers, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.allowTeamsConsumer": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).AllowTeamsConsumer, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.allowTeamsConsumerInbound": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).AllowTeamsConsumerInbound, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.treatDiscoveredPartnersAsUnverified": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).TreatDiscoveredPartnersAsUnverified, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.sharedSipAddressSpace": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).SharedSipAddressSpace, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.tenantFederationConfig.restrictTeamsConsumerToExternalUserProfiles": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTenantFederationConfig).RestrictTeamsConsumerToExternalUserProfiles, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.__id": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).__id, ok = v.Value.(string) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.allowAnonymousUsersToJoinMeeting": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).AllowAnonymousUsersToJoinMeeting, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.allowAnonymousUsersToStartMeeting": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).AllowAnonymousUsersToStartMeeting, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.autoAdmittedUsers": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).AutoAdmittedUsers, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.allowPSTNUsersToBypassLobby": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).AllowPSTNUsersToBypassLobby, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.meetingChatEnabledType": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).MeetingChatEnabledType, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.designatedPresenterRoleMode": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).DesignatedPresenterRoleMode, ok = plugin.RawToTValue[string](v.Value, v.Error) + return + }, + "ms365.teams.teamsMeetingPolicyConfig.allowExternalParticipantGiveRequestControl": func(r plugin.Resource, v *llx.RawData) (ok bool) { + r.(*mqlMs365TeamsTeamsMeetingPolicyConfig).AllowExternalParticipantGiveRequestControl, ok = plugin.RawToTValue[bool](v.Value, v.Error) + return + }, } func SetData(resource plugin.Resource, field string, val *llx.RawData) error { @@ -3009,6 +3187,7 @@ type mqlMs365Exchangeonline struct { AtpPolicyForO365 plugin.TValue[[]interface{}] SharingPolicy plugin.TValue[[]interface{}] RoleAssignmentPolicy plugin.TValue[[]interface{}] + ExternalInOutlook plugin.TValue[[]interface{}] } // createMs365Exchangeonline creates a new instance of this resource @@ -3111,6 +3290,69 @@ func (c *mqlMs365Exchangeonline) GetRoleAssignmentPolicy() *plugin.TValue[[]inte return &c.RoleAssignmentPolicy } +func (c *mqlMs365Exchangeonline) GetExternalInOutlook() *plugin.TValue[[]interface{}] { + return &c.ExternalInOutlook +} + +// mqlMs365ExchangeonlineExternalSender for the ms365.exchangeonline.externalSender resource +type mqlMs365ExchangeonlineExternalSender struct { + MqlRuntime *plugin.Runtime + __id string + // optional: if you define mqlMs365ExchangeonlineExternalSenderInternal it will be used here + Identity plugin.TValue[string] + AllowList plugin.TValue[[]interface{}] + Enabled plugin.TValue[bool] +} + +// createMs365ExchangeonlineExternalSender creates a new instance of this resource +func createMs365ExchangeonlineExternalSender(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { + res := &mqlMs365ExchangeonlineExternalSender{ + MqlRuntime: runtime, + } + + err := SetAllData(res, args) + if err != nil { + return res, err + } + + if res.__id == "" { + res.__id, err = res.id() + if err != nil { + return nil, err + } + } + + if runtime.HasRecording { + args, err = runtime.ResourceFromRecording("ms365.exchangeonline.externalSender", res.__id) + if err != nil || args == nil { + return res, err + } + return res, SetAllData(res, args) + } + + return res, nil +} + +func (c *mqlMs365ExchangeonlineExternalSender) MqlName() string { + return "ms365.exchangeonline.externalSender" +} + +func (c *mqlMs365ExchangeonlineExternalSender) MqlID() string { + return c.__id +} + +func (c *mqlMs365ExchangeonlineExternalSender) GetIdentity() *plugin.TValue[string] { + return &c.Identity +} + +func (c *mqlMs365ExchangeonlineExternalSender) GetAllowList() *plugin.TValue[[]interface{}] { + return &c.AllowList +} + +func (c *mqlMs365ExchangeonlineExternalSender) GetEnabled() *plugin.TValue[bool] { + return &c.Enabled +} + // mqlMs365Sharepointonline for the ms365.sharepointonline resource type mqlMs365Sharepointonline struct { MqlRuntime *plugin.Runtime @@ -3166,6 +3408,8 @@ type mqlMs365Teams struct { __id string // optional: if you define mqlMs365TeamsInternal it will be used here CsTeamsClientConfiguration plugin.TValue[interface{}] + CsTenantFederationConfiguration plugin.TValue[*mqlMs365TeamsTenantFederationConfig] + CsTeamsMeetingPolicy plugin.TValue[*mqlMs365TeamsTeamsMeetingPolicyConfig] } // createMs365Teams creates a new instance of this resource @@ -3203,3 +3447,169 @@ func (c *mqlMs365Teams) MqlID() string { func (c *mqlMs365Teams) GetCsTeamsClientConfiguration() *plugin.TValue[interface{}] { return &c.CsTeamsClientConfiguration } + +func (c *mqlMs365Teams) GetCsTenantFederationConfiguration() *plugin.TValue[*mqlMs365TeamsTenantFederationConfig] { + return &c.CsTenantFederationConfiguration +} + +func (c *mqlMs365Teams) GetCsTeamsMeetingPolicy() *plugin.TValue[*mqlMs365TeamsTeamsMeetingPolicyConfig] { + return &c.CsTeamsMeetingPolicy +} + +// mqlMs365TeamsTenantFederationConfig for the ms365.teams.tenantFederationConfig resource +type mqlMs365TeamsTenantFederationConfig struct { + MqlRuntime *plugin.Runtime + __id string + // optional: if you define mqlMs365TeamsTenantFederationConfigInternal it will be used here + Identity plugin.TValue[string] + BlockedDomains plugin.TValue[interface{}] + AllowFederatedUsers plugin.TValue[bool] + AllowPublicUsers plugin.TValue[bool] + AllowTeamsConsumer plugin.TValue[bool] + AllowTeamsConsumerInbound plugin.TValue[bool] + TreatDiscoveredPartnersAsUnverified plugin.TValue[bool] + SharedSipAddressSpace plugin.TValue[bool] + RestrictTeamsConsumerToExternalUserProfiles plugin.TValue[bool] +} + +// createMs365TeamsTenantFederationConfig creates a new instance of this resource +func createMs365TeamsTenantFederationConfig(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { + res := &mqlMs365TeamsTenantFederationConfig{ + MqlRuntime: runtime, + } + + err := SetAllData(res, args) + if err != nil { + return res, err + } + + // to override __id implement: id() (string, error) + + if runtime.HasRecording { + args, err = runtime.ResourceFromRecording("ms365.teams.tenantFederationConfig", res.__id) + if err != nil || args == nil { + return res, err + } + return res, SetAllData(res, args) + } + + return res, nil +} + +func (c *mqlMs365TeamsTenantFederationConfig) MqlName() string { + return "ms365.teams.tenantFederationConfig" +} + +func (c *mqlMs365TeamsTenantFederationConfig) MqlID() string { + return c.__id +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetIdentity() *plugin.TValue[string] { + return &c.Identity +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetBlockedDomains() *plugin.TValue[interface{}] { + return &c.BlockedDomains +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetAllowFederatedUsers() *plugin.TValue[bool] { + return &c.AllowFederatedUsers +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetAllowPublicUsers() *plugin.TValue[bool] { + return &c.AllowPublicUsers +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetAllowTeamsConsumer() *plugin.TValue[bool] { + return &c.AllowTeamsConsumer +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetAllowTeamsConsumerInbound() *plugin.TValue[bool] { + return &c.AllowTeamsConsumerInbound +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetTreatDiscoveredPartnersAsUnverified() *plugin.TValue[bool] { + return &c.TreatDiscoveredPartnersAsUnverified +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetSharedSipAddressSpace() *plugin.TValue[bool] { + return &c.SharedSipAddressSpace +} + +func (c *mqlMs365TeamsTenantFederationConfig) GetRestrictTeamsConsumerToExternalUserProfiles() *plugin.TValue[bool] { + return &c.RestrictTeamsConsumerToExternalUserProfiles +} + +// mqlMs365TeamsTeamsMeetingPolicyConfig for the ms365.teams.teamsMeetingPolicyConfig resource +type mqlMs365TeamsTeamsMeetingPolicyConfig struct { + MqlRuntime *plugin.Runtime + __id string + // optional: if you define mqlMs365TeamsTeamsMeetingPolicyConfigInternal it will be used here + AllowAnonymousUsersToJoinMeeting plugin.TValue[bool] + AllowAnonymousUsersToStartMeeting plugin.TValue[bool] + AutoAdmittedUsers plugin.TValue[string] + AllowPSTNUsersToBypassLobby plugin.TValue[bool] + MeetingChatEnabledType plugin.TValue[string] + DesignatedPresenterRoleMode plugin.TValue[string] + AllowExternalParticipantGiveRequestControl plugin.TValue[bool] +} + +// createMs365TeamsTeamsMeetingPolicyConfig creates a new instance of this resource +func createMs365TeamsTeamsMeetingPolicyConfig(runtime *plugin.Runtime, args map[string]*llx.RawData) (plugin.Resource, error) { + res := &mqlMs365TeamsTeamsMeetingPolicyConfig{ + MqlRuntime: runtime, + } + + err := SetAllData(res, args) + if err != nil { + return res, err + } + + // to override __id implement: id() (string, error) + + if runtime.HasRecording { + args, err = runtime.ResourceFromRecording("ms365.teams.teamsMeetingPolicyConfig", res.__id) + if err != nil || args == nil { + return res, err + } + return res, SetAllData(res, args) + } + + return res, nil +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) MqlName() string { + return "ms365.teams.teamsMeetingPolicyConfig" +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) MqlID() string { + return c.__id +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetAllowAnonymousUsersToJoinMeeting() *plugin.TValue[bool] { + return &c.AllowAnonymousUsersToJoinMeeting +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetAllowAnonymousUsersToStartMeeting() *plugin.TValue[bool] { + return &c.AllowAnonymousUsersToStartMeeting +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetAutoAdmittedUsers() *plugin.TValue[string] { + return &c.AutoAdmittedUsers +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetAllowPSTNUsersToBypassLobby() *plugin.TValue[bool] { + return &c.AllowPSTNUsersToBypassLobby +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetMeetingChatEnabledType() *plugin.TValue[string] { + return &c.MeetingChatEnabledType +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetDesignatedPresenterRoleMode() *plugin.TValue[string] { + return &c.DesignatedPresenterRoleMode +} + +func (c *mqlMs365TeamsTeamsMeetingPolicyConfig) GetAllowExternalParticipantGiveRequestControl() *plugin.TValue[bool] { + return &c.AllowExternalParticipantGiveRequestControl +} diff --git a/providers/ms365/resources/ms365.lr.manifest.yaml b/providers/ms365/resources/ms365.lr.manifest.yaml index 0c98ec5e06..8e1f032f61 100755 --- a/providers/ms365/resources/ms365.lr.manifest.yaml +++ b/providers/ms365/resources/ms365.lr.manifest.yaml @@ -244,6 +244,7 @@ resources: atpPolicyForO365: {} authenticationPolicy: {} dkimSigningConfig: {} + externalInOutlook: {} hostedOutboundSpamFilterPolicy: {} mailbox: {} malwareFilterPolicy: {} @@ -260,6 +261,16 @@ resources: platform: name: - microsoft365 + ms365.exchangeonline.externalSender: + fields: + allowList: {} + enabled: {} + identity: {} + is_private: true + min_mondoo_version: latest + platform: + name: + - microsoft365 ms365.sharepointonline: fields: spoTenant: {} @@ -270,9 +281,44 @@ resources: - microsoft365 ms365.teams: fields: - csOAuthConfiguration: {} csTeamsClientConfiguration: {} + csTeamsMeetingPolicy: + min_mondoo_version: 9.0.0 + csTenantFederationConfiguration: + min_mondoo_version: 9.0.0 min_mondoo_version: 5.15.0 platform: name: - microsoft365 + ms365.teams.teamsMeetingPolicyConfig: + fields: + allowAnonymousUsersToJoinMeeting: {} + allowAnonymousUsersToStartMeeting: {} + allowExternalParticipantGiveRequestControl: {} + allowPSTNUsersToBypassLobby: {} + autoAdmittedUsers: {} + designatedPresenterRoleMode: {} + meetingChatEnabledType: {} + is_private: true + min_mondoo_version: latest + platform: + name: + - microsoft365 + ms365.teams.tenantFederationConfig: + fields: + allowFederatedUsers: {} + allowPublicUsers: {} + allowTeamsConsumer: {} + allowTeamsConsumerInbound: {} + allowedDomains: {} + blockedDomains: {} + identity: {} + restrictTeamsConsumerToExternalUserProfiles: {} + sestrictTeamsConsumerToExternalUserProfiles: {} + sharedSipAddressSpace: {} + treatDiscoveredPartnersAsUnverified: {} + is_private: true + min_mondoo_version: 9.0.0 + platform: + name: + - microsoft365