Wer sich in Office 365 mit dem Secure Score beschäftigt, stolpert relativ schnell über den Punkt Mailbox Auditing aktivieren. Wenn man nun bereits alle administrativen Accounts mit Multifactor Authentifizierung (MFA) aktiviert hat, funktionieren die normalen Schritte nicht mehr und die Microsoft Dokumentation ist falsch.
Deshalb habe ich hier beschrieben, wie man das Mailbox Auditing mit einem MFA aktivierten Account aktivieren kann.
Secure Score
Im Admin Center – Security and Compliance Portal (aktuell https://securescore.microsoft.com/#!/score) ist einer der Punkte „Enable Mailbox Auditing“. Damit wird die Überwachung eingeschaltet, wenn ein fremder Benutzer auf die eigene Mailbox/Postfach zugreift – und auch nur dafür. Dann wird natürlich auch protokolliert, wenn die Sekretärin das Postfach ihres Chef’s öffnet, da dies mittlerweile eher selten ist, müsste man diese ausnehmen (das habe ich hier nicht berücksichtigt).
Dieser Schritt ist für die Erfüllung von ISO27001 und GDPR Kriterien notwendig. Details findet man hierzu im Secure Score Analyzer.
Mailbox Auditing aktivieren
Im Grunde gibt es eine PowerShell, nachdem der originale Link zu https://github.com/OfficeDev/O365-InvestigationTooling/blob/master/EnableMailboxAuditing.ps1 nach heutigem Stand nicht mit MFA funktioniert, habe ich es entsprechend angepasst:
#This script will enable non-owner mailbox access auditing on every mailbox in your tenancy #First, let's get us a cred! #https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/mfa-connect-to-exchange-online-powershell?view=exchange-ps Import-Module Microsoft.Exchange.Management.ExoPowershellModule -ErrorAction Stop # If needed run: Install-Module Microsoft.Exchange.Management.ExoPowershellModule $userUPN = Read-Host -Prompt "Please provide UserPrincipalName" $ExoSession = New-EXOPSSession -UserPrincipalName $userUPN Import-Pssession $ExoSession #legacy way without MFA <# $userCredential = Get-Credential #This gets us connected to an Exchange remote powershell service $ExoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $userCredential -Authentication Basic -AllowRedirection Import-PSSession $ExoSession #> #Enable global audit logging Get-Mailbox -ResultSize Unlimited -Filter {RecipientTypeDetails -eq "UserMailbox" -or RecipientTypeDetails -eq "SharedMailbox" -or RecipientTypeDetails -eq "RoomMailbox" -or RecipientTypeDetails -eq "DiscoveryMailbox"} | Set-Mailbox -AuditEnabled $true -AuditLogAgeLimit 180 -AuditAdmin Update, MoveToDeletedItems, SoftDelete, HardDelete, SendAs, SendOnBehalf, Create, UpdateFolderPermission -AuditDelegate Update, SoftDelete, HardDelete, SendAs, Create, UpdateFolderPermissions, MoveToDeletedItems, SendOnBehalf -AuditOwner UpdateFolderPermission, MailboxLogin, Create, SoftDelete, HardDelete, Update, MoveToDeletedItems #Double-Check It! Get-Mailbox -ResultSize Unlimited | Select Name, AuditEnabled, AuditLogAgeLimit | Out-Gridview # Cleanup Get-PSSession | Remove-PSSession
Gerne auch als Download bei mir: https://github.com/Hobmaier/Scripts/blob/master/Exchange/EnableMailboxAuditingMFA.ps1
Review mailbox forwarding rules weekly
Dieser Punkt gehört mehr oder weniger noch dazu, gleiches Problem. Laut Secure Score kann man damit eine bzw. drei CSV Dateien (MailboxDelegatePermissions.csv, Mailboxsmtpforwarding.csv, MailForwardingRulesToExternalDomains.csv) erzeugen, um zu sehen wer E-Mails weiterleitet:
#Import the right module to talk with AAD import-module MSOnline -ErrorAction Stop #Let's get us an admin cred! Import-Module Microsoft.Exchange.Management.ExoPowershellModule -ErrorAction Stop # If needed run: Install-Module Microsoft.Exchange.Management.ExoPowershellModule #This connects to Azure Active Directory Connect-MsolService $userUPN = Read-Host -Prompt "Please provide UserPrincipalName" $ExoSession = New-EXOPSSession -UserPrincipalName $userUPN Import-Pssession $ExoSession $allUsers = @() $AllUsers = Get-MsolUser -All -EnabledFilter EnabledOnly | select ObjectID, UserPrincipalName, FirstName, LastName, StrongAuthenticationRequirements, StsRefreshTokensValidFrom, StrongPasswordRequired, LastPasswordChangeTimestamp | Where-Object {($_.UserPrincipalName -notlike "*#EXT#*")} $UserInboxRules = @() $UserDelegates = @() foreach ($User in $allUsers) { Write-Host "Checking inbox rules and delegates for user: " $User.UserPrincipalName; $UserInboxRules += Get-InboxRule -Mailbox $User.UserPrincipalname | Select Name, Description, Enabled, Priority, ForwardTo, ForwardAsAttachmentTo, RedirectTo, DeleteMessage | Where-Object {($_.ForwardTo -ne $null) -or ($_.ForwardAsAttachmentTo -ne $null) -or ($_.RedirectsTo -ne $null)} $UserDelegates += Get-MailboxPermission -Identity $User.UserPrincipalName | Where-Object {($_.IsInherited -ne "True") -and ($_.User -notlike "*SELF*")} } $SMTPForwarding = Get-Mailbox -ResultSize Unlimited | select DisplayName,ForwardingAddress,ForwardingSMTPAddress,DeliverToMailboxandForward | where {$_.ForwardingSMTPAddress -ne $null} $UserInboxRules | Export-Csv MailForwardingRulesToExternalDomains.csv $UserDelegates | Export-Csv MailboxDelegatePermissions.csv $SMTPForwarding | Export-Csv Mailboxsmtpforwarding.csv # Cleanup Get-PSSession | Remove-PSSession
Ebenfalls hier zum Download: https://github.com/Hobmaier/Scripts/blob/master/Exchange/DumpDelegatesandForwardingRulesMFA.ps1
Zusammenfassung
Mit diesem PowerShell Skript aktiviere ich das Auditing für mithilfe eines administrativen Accounts, der mit Multifaktor Authentifizierung geschützt ist.