-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #412 from Snozzberries/cis
First CIS test
- Loading branch information
Showing
7 changed files
with
195 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
1.1.1 (L1) Ensure Administrative accounts are separate and cloud-only | ||
|
||
Administrative accounts are special privileged accounts that could have varying levels of access to data, users, and settings. Regular user accounts should never be utilized for administrative tasks and care should be taken, in the case of a hybrid environment, to keep Administrative accounts separated from on-prem accounts. Administrative accounts should not have applications assigned so that they have no access to potentially vulnerable services (EX. email, Teams, SharePoint, etc.) and only access to perform tasks as needed for administrative purposes. | ||
|
||
#### Remediation action: | ||
|
||
To created licensed, separate Administrative accounts for Administrative users: | ||
|
||
1. Navigate to **Microsoft 365 admin center**. | ||
2. Click to expand **Users** select **Active users** | ||
3. Click **Add a user**. | ||
4. Fill out the appropriate fields for Name, user, etc. | ||
5. When prompted to assign licenses select as needed **Microsoft Entra ID P1** or | ||
**Microsoft Entra ID P2**, then click **Next**. | ||
6. Under the **Option settings** screen you may choose from several types of | ||
Administrative access roles. Choose **Admin center access** followed by the | ||
appropriate role then click **Next**. | ||
7. Select **Finish adding**. | ||
|
||
#### Related links | ||
|
||
* [Microsoft 365 Admin Center](https://admin.microsoft.com) | ||
* [CIS Microsoft 365 Foundations Benchmark v3.1.0 - Page 16](https://www.cisecurity.org/benchmark/microsoft_365) | ||
|
||
<!--- Results ---> | ||
%TestResult% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<# | ||
.SYNOPSIS | ||
Checks if Global Admins are cloud users | ||
.DESCRIPTION | ||
Ensure Administrative accounts are separate and cloud-only | ||
CIS Microsoft 365 Foundations Benchmark v3.1.0 | ||
.EXAMPLE | ||
Test-MtCisCloudAdmin | ||
Returns true if no global admins are hybrid sync | ||
.LINK | ||
https://maester.dev/docs/commands/Test-MtCisCloudAdmin | ||
#> | ||
function Test-MtCisCloudAdmin { | ||
[CmdletBinding()] | ||
[OutputType([bool])] | ||
param() | ||
|
||
Write-Verbose "Getting Global Admin role" | ||
$role = Get-MtRole | Where-Object {` | ||
$_.id -eq "62e90394-69f5-4237-9190-012177145e10" } # Global Administrator | ||
|
||
Write-Verbose "Getting role members" | ||
$assignments = Get-MtRoleMember -roleId $role.id | ||
|
||
Write-Verbose "Filtering for users" | ||
$globalAdministrators = $assignments | Where-Object {` | ||
$_.'@odata.type' -eq "#microsoft.graph.user" | ||
} | ||
|
||
$userIds = @($globalAdministrators.Id) | ||
|
||
Write-Verbose "Requesting users onPremisesSyncEnabled property" | ||
$users = Invoke-MtGraphRequest -RelativeUri "users" -UniqueId $userIds -Select id,displayName,onPremisesSyncEnabled | ||
|
||
Write-Verbose "Filtering users for onPremisesSyncEnabled" | ||
$result = $users | Where-Object {` | ||
$_.onPremisesSyncEnabled -eq $true | ||
} | ||
|
||
$testResult = ($result|Measure-Object).Count -eq 0 | ||
|
||
$sortSplat = @{ | ||
Property = @( | ||
@{ | ||
Expression = "onPremisesSyncEnabled" | ||
Descending = $true | ||
}, | ||
@{ | ||
Expression = "displayName" | ||
} | ||
) | ||
} | ||
|
||
if ($testResult) { | ||
$testResultMarkdown = "Well done. Your tenant has no hybrid Global Administrators:`n`n%TestResult%" | ||
} else { | ||
$testResultMarkdown = "Your tenant has 1 or more hybrid Global Administrators:`n`n%TestResult%" | ||
} | ||
|
||
$resultMd = "| Display Name | Cloud Only |`n" | ||
$resultMd += "| --- | --- |`n" | ||
foreach($item in $users | Sort-Object @sortSplat){ | ||
$itemResult = "❌ Fail" | ||
if($item.id -notin $result.id){ | ||
$itemResult = "✅ Pass" | ||
} | ||
$resultMd += "| $($item.displayName) | $($itemResult) |`n" | ||
} | ||
$testResultMarkdown = $testResultMarkdown -replace "%TestResult%", $resultMd | ||
|
||
Add-MtTestResultDetail -Result $testResultMarkdown | ||
|
||
return $testResult | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Describe "CIS" -Tag "CIS 1.1.1", "CIS E3 Level 1", "CIS E3", "CIS", "Security", "All", "CIS M365 v3.1.0" { | ||
It "CIS 1.1.1: Ensure Administrative accounts are separate and cloud-only" { | ||
|
||
$result = Test-MtCisCloudAdmin | ||
|
||
if($null -ne $result) { | ||
$result | Should -Be $true -Because "admin accounts are separate and cloud-only" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
id: overview | ||
title: CIS Microsoft 365 Foundations Benchmark Tests | ||
sidebar_label: 🏢 CIS Overview | ||
description: Implementation of CIS Microsoft 365 Foundations Benchmark Controls | ||
--- | ||
|
||
# CIS Microsoft 365 Foundations Benchmark | ||
|
||
## Overview | ||
|
||
The tests in this section verifies that a Micorosft 365 tenant's configuration conforms to the [CIS Microsoft 365 Foundations Benchmark](https://www.cisecurity.org/benchmark/microsoft_365) recommendations (v3.1.0). | ||
|
||
The CIS published material is shared for these tests as it aligns with their licensing of [CC BY-NC-SA 4.0](https://www.cisecurity.org/terms-and-conditions-table-of-contents). | ||
|
||
## Connecting to Azure, Exchange and other services | ||
|
||
In order to run all the CIS tests, you need to install and connect to the Azure and Exchange Online modules. | ||
|
||
See the [Installation guide](/docs/installation#optional-modules-and-permissions) for more information. | ||
|
||
## Tests | ||
|
||
| Cmdlet Name | CIS Recommendation ID | | ||
| - | - | | ||
| Test-MtCisCloudAdmin | CIS 1.1.1: Ensure Administrative accounts are separate and cloud-only | |