-
Notifications
You must be signed in to change notification settings - Fork 40
26T1-BAC-WY-002 – Add CIS 1.2.2 shared mailbox sign-in blocked policy #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
williamywccc
wants to merge
5
commits into
main
Choose a base branch
from
feature/add-cis-1.2.2-policy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b4c12b7
Add CIS 1.2.2 shared mailbox sign-in blocked policy
williamywccc e7fcc40
Switch CIS 1.2.2 mailbox collector to Microsoft Graph (User.Read.All)
williamywccc 6d1da45
Tighten style in 1.2.2 collector and Rego policy
williamywccc aa981d8
Address reviewer feedback on CIS 1.2.2
williamywccc f3e7293
Address PR 174 reviewer feedback
williamywccc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
67 changes: 67 additions & 0 deletions
67
...ne/policies/cis/microsoft-365-foundations/v6.0.0/1.2.2_shared_mailbox_signin_blocked.rego
This file contains hidden or 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,67 @@ | ||
| # METADATA | ||
| # title: Ensure sign-in to shared mailboxes is blocked | ||
| # description: | | ||
| # Shared mailboxes should not allow direct sign-in. Enabling sign-in on a | ||
| # shared mailbox creates an unnecessary authentication surface that bypasses | ||
| # individual user accountability and increases the risk of credential abuse. | ||
| # related_resources: | ||
| # - ref: https://www.cisecurity.org/benchmark/microsoft_365 | ||
| # description: CIS Microsoft 365 Foundations Benchmark | ||
| # custom: | ||
| # control_id: CIS-1.2.2 | ||
| # framework: cis | ||
| # benchmark: microsoft-365-foundations | ||
| # version: v6.0.0 | ||
| # severity: medium | ||
| # service: Exchange | ||
| # requires_permissions: | ||
| # - User.Read.All | ||
|
|
||
| package cis.microsoft_365_foundations.v6_0_0.control_1_2_2 | ||
|
|
||
| import rego.v1 | ||
|
|
||
| default result := { | ||
| "compliant": false, | ||
| "message": "Evaluation failed: unable to retrieve shared mailbox data", | ||
| "details": {}, | ||
| } | ||
|
|
||
| result := output if { | ||
| mailboxes := get_array(input, "shared_mailboxes") | ||
| violating := [m | | ||
| some m in mailboxes | ||
| object.get(m, "SignInBlocked", null) != true | ||
| ] | ||
|
|
||
| compliant := count(violating) == 0 | ||
| msg := build_message(mailboxes, violating) | ||
| affected := [m.UserPrincipalName | | ||
| some m in violating | ||
| m.UserPrincipalName != null | ||
| ] | ||
|
|
||
| output := { | ||
| "compliant": compliant, | ||
| "message": msg, | ||
| "affected_resources": affected, | ||
| "details": { | ||
| "total_shared_mailboxes": count(mailboxes), | ||
| "violating_count": count(violating), | ||
| "violations": [ | ||
| { | ||
| "UserPrincipalName": m.UserPrincipalName, | ||
| "DisplayName": object.get(m, "DisplayName", null), | ||
| "SignInBlocked": object.get(m, "SignInBlocked", null), | ||
| } | | ||
| some m in violating | ||
| ], | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| get_array(obj, key) := obj[key] if { obj[key] } else := [] | ||
|
|
||
| build_message(all_mailboxes, violating) := sprintf("All %d shared mailbox(es) have sign-in blocked", [count(all_mailboxes)]) if { | ||
| count(violating) == 0 | ||
| } else := sprintf("%d shared mailbox(es) do not have sign-in blocked", [count(violating)]) |
This file contains hidden or 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
|
williamywccc marked this conversation as resolved.
|
This file contains hidden or 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,43 @@ | ||
| { | ||
| "collector_id": "exchange.mailbox.mailboxes", | ||
| "description": "Sample Graph-based output for CIS 1.2.2 evaluation", | ||
| "data": { | ||
| "shared_mailboxes": [ | ||
| { | ||
| "UserPrincipalName": "finance@contoso.com", | ||
| "DisplayName": "Finance", | ||
| "PrimarySmtpAddress": "finance@contoso.com", | ||
| "accountEnabled": false, | ||
| "SignInBlocked": true | ||
| }, | ||
| { | ||
| "UserPrincipalName": "reception@contoso.com", | ||
| "DisplayName": "Reception", | ||
| "PrimarySmtpAddress": "reception@contoso.com", | ||
| "accountEnabled": true, | ||
| "SignInBlocked": false | ||
| } | ||
| ], | ||
| "total_shared_mailboxes": 2, | ||
| "mailboxes_with_signin_blocked": 1, | ||
| "mailboxes_with_signin_allowed": 1, | ||
| "detection_method": "graph_user_heuristic_unlicensed_mail_members", | ||
| "detection_limitations": "Shared mailbox identification is approximate without Exchange recipient metadata. Only member users with mail and no assignedLicenses are evaluated; licensed shared mailboxes may be omitted." | ||
| }, | ||
| "opa_result": { | ||
| "compliant": false, | ||
| "message": "1 shared mailbox(es) do not have sign-in blocked", | ||
| "affected_resources": ["reception@contoso.com"], | ||
| "details": { | ||
| "total_shared_mailboxes": 2, | ||
| "violating_count": 1, | ||
| "violations": [ | ||
| { | ||
| "UserPrincipalName": "reception@contoso.com", | ||
| "DisplayName": "Reception", | ||
| "SignInBlocked": false | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.