BOD-25-01-CSA-Microsoft-Policy-MCP

BOD-25-01-CSA-Microsoft-Policy-MCP

这个 MCP 服务器根据 CSA BOD 25-01 要求,为 Microsoft 365 云服务实施了各种策略。

远程shell执行
AI集成系统
访问服务器

Tools

configure_authenticator_context

Configure Microsoft Authenticator to show login context (MS.AAD.3.3v1)

complete_auth_methods_migration

Set Authentication Methods Manage Migration to Complete (MS.AAD.3.4v1)

enforce_pam

Enforce PAM system for privileged role assignments (MS.AAD.7.5v1)

enforce_privileged_mfa

Enforce phishing-resistant MFA for privileged roles (MS.AAD.3.6v1)

restrict_app_registration

Allow only administrators to register applications (MS.AAD.5.1v1)

restrict_app_consent

Allow only administrators to consent to applications (MS.AAD.5.2v1)

configure_admin_consent

Configure admin consent workflow for applications (MS.AAD.5.3v1)

restrict_group_consent

Prevent group owners from consenting to applications (MS.AAD.5.4v1)

enforce_granular_roles

Enforce use of granular roles instead of Global Administrator (MS.AAD.7.2v1)

disable_password_expiry

Disable password expiration (MS.AAD.6.1v1)

enforce_cloud_accounts

Enforce cloud-only accounts for privileged users (MS.AAD.7.3v1)

configure_global_admin_approval

Configure approval requirement for Global Administrator activation (MS.AAD.7.6v1)

configure_role_alerts

Configure alerts for privileged role assignments (MS.AAD.7.7v1)

configure_admin_alerts

Configure alerts for Global Administrator activation (MS.AAD.7.8v1)

get_policy_status

Get current status of all CISA M365 security policies

block_legacy_auth

Block legacy authentication (MS.AAD.1.1v1)

block_high_risk_users

Block users detected as high risk (MS.AAD.2.1v1)

configure_global_admins

Configure Global Administrator role assignments (MS.AAD.7.1v1)

block_high_risk_signins

Block sign-ins detected as high risk (MS.AAD.2.3v1)

enforce_phishing_resistant_mfa

Enforce phishing-resistant MFA for all users (MS.AAD.3.1v1)

enforce_alternative_mfa

Enforce alternative MFA method if phishing-resistant MFA not enforced (MS.AAD.3.2v1)

README

CISA M365 MCP 服务器

smithery badge 一个模型上下文协议 (MCP) 服务器,实现了 CISA 绑定操作指令 25-01 中针对 Microsoft 365 (Azure AD/Entra ID) 的安全控制。

目录

概述

此 MCP 服务器提供用于根据 BOD 25-01 要求配置和管理 Microsoft 365 安全设置的工具。它与 Microsoft Graph API 集成,以强制执行安全控制、监控合规性并提供详细的报告。

主要特性

  • 旧版身份验证控制
  • 基于风险的访问控制
  • 多因素身份验证管理
  • 应用程序注册和同意控制
  • 密码策略管理
  • 特权角色管理
  • 仅云帐户强制执行
  • PAM 系统集成
  • 全面的合规性报告
  • 基于令牌的身份验证
  • 类型安全的参数验证
  • 详细的错误处理和日志记录

安全控制

MS.AAD.1.1v1

到期日:06/20/2025

阻止旧版身份验证:

  • 禁用旧版身份验证协议
  • 减少攻击面
  • 提高安全态势

实施细节:

await graphClient
  .api('/policies/authenticationMethodsPolicy')
  .patch({
    allowLegacyAuthentication: false,
    blockLegacyAuthenticationMethods: true,
  });

MS.AAD.2.1v1 & MS.AAD.2.3v1

到期日:06/20/2025

阻止高风险用户和登录:

  • 阻止检测为高风险的用户
  • 阻止检测为高风险的登录
  • 利用 Microsoft 的威胁情报

实施细节:

await graphClient
  .api('/policies/identitySecurityDefaultsEnforcementPolicy')
  .patch({
    blockHighRiskUsers: true,
    riskLevelForBlocking: 'high',
  });

MS.AAD.3.1v1, MS.AAD.3.2v1, MS.AAD.3.3v1

到期日:06/20/2025

MFA 配置:

  • 强制执行防网络钓鱼 MFA
  • 配置备用 MFA 方法
  • 在 Microsoft Authenticator 中显示登录上下文

实施细节:

await graphClient
  .api('/policies/authenticationMethodsPolicy')
  .patch({
    policies: {
      fido2: {
        isEnabled: true,
        isSelfServiceRegistrationAllowed: true,
      },
      windowsHelloForBusiness: {
        isEnabled: true,
        isSelfServiceRegistrationAllowed: true,
      },
    },
  });

MS.AAD.5.1v1, MS.AAD.5.2v1, MS.AAD.5.3v1, MS.AAD.5.4v1

到期日:06/20/2025

应用程序控制:

  • 将应用程序注册限制为管理员
  • 将应用程序同意限制为管理员
  • 配置管理员同意工作流
  • 阻止组所有者同意

实施细节:

await graphClient
  .api('/policies/applicationRegistrationManagement')
  .patch({
    restrictAppRegistration: true,
    restrictNonAdminUsers: true,
  });

MS.AAD.6.1v1

到期日:06/20/2025

密码策略:

  • 禁用密码过期
  • 遵循现代安全最佳实践

实施细节:

await graphClient
  .api('/policies/passwordPolicy')
  .patch({
    passwordExpirationPolicy: {
      passwordExpirationDays: 0,
      neverExpire: true,
    },
  });

MS.AAD.7.1v1 through MS.AAD.7.8v1

到期日:06/20/2025

特权角色管理:

  • 限制全局管理员数量
  • 强制执行精细角色
  • 需要仅云帐户
  • 强制执行 PAM 系统使用
  • 配置审批工作流
  • 设置警报

实施细节:

await graphClient
  .api('/policies/roleManagementPolicies')
  .patch({
    enforceGranularRoles: true,
    blockGlobalAdminForGeneralUse: true,
    requireApprovalForGlobalAdmin: true,
  });

架构

组件

  1. 服务器类

    • 处理 MCP 协议实现
    • 管理工具注册和执行
    • 实施错误处理和日志记录
  2. 身份验证

    • 使用 Microsoft Graph API 的基于令牌的身份验证
    • 自动令牌刷新
    • 安全凭据管理
  3. Graph 客户端

    • Microsoft Graph API 的包装器
    • 类型安全的请求/响应处理
    • 重试逻辑和错误处理
  4. 工具

    • 旧版身份验证控制
    • 基于风险的访问管理
    • MFA 配置
    • 应用程序控制
    • 密码策略管理
    • 角色管理
    • 警报配置
    • 策略状态报告

数据流

graph TD
    A[MCP 客户端] -->|请求| B[MCP 服务器]
    B -->|身份验证| C[令牌管理器]
    C -->|访问令牌| D[Graph 客户端]
    D -->|API 调用| E[Microsoft Graph]
    E -->|响应| D
    D -->|结果| B
    B -->|响应| A

先决条件

  • Node.js 18.x 或更高版本
  • 具有管理员访问权限的 Microsoft 365 租户
  • 具有所需权限的 Azure AD 应用程序:
    • Policy.ReadWrite.All
    • RoleManagement.ReadWrite.All
    • User.Read.All
    • Application.ReadWrite.All

安装

通过 Smithery 安装

要通过 Smithery 自动安装 CISA M365 MCP 服务器:

npx -y @smithery/cli install cisa-m365

您还可以直接从 Smithery 协议目录 复制 MCP 设置和定义,并将 MCP 服务器添加到支持 MCP 协议的 Claude 或 LLM 设置中。

  1. 克隆存储库:
git clone https://github.com/DynamicEndpoints/BOD-25-01-CSA-MCP.git
cd cisa-m365
  1. 安装依赖项:
npm install
  1. 构建服务器:
npm run build

配置

  1. 创建 Azure AD 应用程序:

    • 导航到 Azure 门户 > Azure Active Directory
    • 注册新应用程序
    • 添加所需的 API 权限
    • 创建客户端密钥
  2. 配置环境变量:

cp .env.example .env

编辑 .env 文件:

TENANT_ID=your-tenant-id
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
  1. 配置 MCP 设置:
{
  "mcpServers": {
    "cisa-m365": {
      "command": "node",
      "args": ["path/to/cisa-m365/build/index.js"],
      "env": {
        "TENANT_ID": "your-tenant-id",
        "CLIENT_ID": "your-client-id",
        "CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

用法

可用工具

block_legacy_auth

阻止旧版身份验证方法。

{}

block_high_risk_users

阻止检测为高风险的用户。

{}

enforce_phishing_resistant_mfa

为所有用户强制执行防网络钓鱼 MFA。

{}

configure_global_admins

配置全局管理员角色分配。

{
  "userIds": ["user1-id", "user2-id"]
}

get_policy_status

获取所有安全策略的当前状态。

{}

用法示例

// 阻止旧版身份验证
const result = await client.callTool('block_legacy_auth', {});

// 获取策略状态
const status = await client.callTool('get_policy_status', {});

API 参考

策略设置 API

interface PolicySettings {
  legacyAuthentication: {
    blocked: boolean;
    compliant: boolean;
  };
  highRiskUsers: {
    blocked: boolean;
    compliant: boolean;
  };
  mfa: {
    phishingResistant: boolean;
    alternativeEnabled: boolean;
    compliant: boolean;
  };
  applications: {
    registrationRestricted: boolean;
    consentRestricted: boolean;
    compliant: boolean;
  };
  passwords: {
    expirationDisabled: boolean;
    compliant: boolean;
  };
  roles: {
    globalAdminCount: number;
    granularRolesEnforced: boolean;
    pamEnforced: boolean;
    compliant: boolean;
  };
}

错误处理

服务器实现了全面的错误处理:

  1. 身份验证错误

    • 令牌获取失败
    • 权限问题
    • 租户配置问题
  2. API 错误

    • Graph API 请求失败
    • 速率限制
    • 服务不可用
  3. 验证错误

    • 无效参数
    • 缺少必需参数
    • 类型不匹配
  4. 运行时错误

    • 网络问题
    • 超时问题
    • 资源约束

错误响应示例:

{
  "error": {
    "code": "InvalidParams",
    "message": "Invalid role assignment arguments",
    "details": {
      "parameter": "userIds",
      "constraint": "Must have between 2 and 8 users",
      "received": "1 user"
    }
  }
}

测试

  1. 运行单元测试:
npm test
  1. 运行集成测试:
npm run test:integration
  1. 运行合规性测试:
npm run test:compliance

安全注意事项

  1. 身份验证

    • 使用安全令牌存储
    • 实施令牌轮换
    • 监控可疑活动
  2. API 访问

    • 遵循最小权限原则
    • 定期权限审计
    • 监控 API 使用情况
  3. 数据保护

    • 无敏感数据日志记录
    • 安全配置存储
    • 定期安全扫描
  4. 合规性

    • 定期合规性检查
    • 自动化策略验证
    • 审计日志记录

贡献

  1. Fork 存储库
  2. 创建一个功能分支
  3. 进行更改
  4. 运行测试
  5. 提交拉取请求

准则:

  • 遵循现有的代码风格
  • 为新功能添加测试
  • 更新文档
  • 保持提交原子性

许可证

MIT

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
AIO-MCP Server

AIO-MCP Server

🚀 集成了 AI 搜索、RAG 和多服务(GitLab/Jira/Confluence/YouTube)的一体化 MCP 服务器,旨在增强 AI 驱动的开发工作流程。来自 Folk。

精选
本地
https://github.com/Streen9/react-mcp

https://github.com/Streen9/react-mcp

react-mcp 与 Claude Desktop 集成,能够根据用户提示创建和修改 React 应用程序。

精选
本地
MCP Atlassian

MCP Atlassian

适用于 Atlassian Cloud 产品(Confluence 和 Jira)的 Model Context Protocol (MCP) 服务器。此集成专为 Atlassian Cloud 实例设计,不支持 Atlassian Server 或 Data Center 部署。

精选
any-chat-completions-mcp

any-chat-completions-mcp

将 Claude 与任何 OpenAI SDK 兼容的聊天完成 API 集成 - OpenAI、Perplexity、Groq、xAI、PyroPrompts 等。

精选
Exa MCP Server

Exa MCP Server

一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。

精选
MySQL MCP Server

MySQL MCP Server

允许人工智能助手通过受控界面列出表格、读取数据和执行 SQL 查询,从而使数据库探索和分析更安全、更有条理。

精选