💈

Cloudflare Gateway で Microsoft コンシューマーアプリをブロック

2024/04/22に公開

Cloudflare Gateway の Tenant Control で Microsoft のアプリケーションに対し、下記の 2 つのコントロールを行えます。

  1. 組織の Entra テナントにのみアクセスを許可する
  2. コンシューマーアプリに接続させない

1 は Devdoc にサンプルの記載がありますが、2 は見当たらないので、書いておきます。

MS 本家のドキュメントに Fiddler での例がありますが、

これと同等のことを Cloudflare の API でやるとこうなります。

  1. 組織の Entra テナントにのみアクセスを許可する
{
    "name": "MS: Allows access to the listed tenants",
    "description" : "https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/tenant-restrictions#set-up-tenant-restrictions",
    "action": "allow",
    "filters": [
        "http"
    ],
    "traffic": "http.request.host in {\"login.microsoft.com\" \"login.microsoftonline.com\" \"login.windows.net\"}",
    "rule_settings": {
        "add_headers": {
            "Restrict-Access-Context": [
                "<Your directory ID>"
                ],
            "Restrict-Access-To-Tenants": [
                "<List of tenant identifiers>"
                ]
        }
    }
}
  1. コンシューマーアプリに接続させない
{
    "name": "MS: Blocks access to consumer apps",
    "description" : "https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/tenant-restrictions#blocking-consumer-applications",
    "action": "allow",
    "filters": [
        "http"
    ],
    "traffic": "http.request.host in {\"login.live.com\"}",
    "rule_settings": {
        "add_headers": {
           "Sec-Restrict-Tenant-Access-Policy": [
                "restrict-msa"
            ]
        }
    }
}

Dashboard の GUI だとこのような感じです。


Discussion