0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MCAS (Microsoft Cloud App Security) と Cloudflare Zero Trust を連携する

Last updated at Posted at 2023-09-13

目的

以下の内容を理解するために、やってみます。

API Token 準備

以下の手順を実施し、MCAS 側で API Token を準備します。

パーミッションは、discovery.read を指定します。

OAuth トークンは以下のコマンドで取得できます。

export APPLICATION_ID='YOUR_APPLICATION_ID'
export CLIENT_SECRET='YOUR_CLIENT_SECRET'
export TENANT_ID='YOUR_TENANT_ID'

TOKEN=$(curl -X POST -H "Content-Type:application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$APPLICATION_ID" \
-d "scope=05a65629-4c1b-48c1-a78b-804c4abdd4af/.default" \
-d "client_secret=$CLIENT_SECRET" \
"https://login.microsoftonline.com/$TENANT_ID/oauth2/v2.0/token" -sk \
| jq -r .access_token)
echo $TOKEN

API URL 準備

MCAS の API URL は以下の画面で確認できます。

image.png

export MCAS_API_URL='xxx.us2.portal.cloudappsecurity.com'

クラウド アプリ カタログ

以下のように「承認されていない」クラウドアプリを定義がある場合を想定します。

image.png

ブロックスクリプトの生成

以下のコマンドで「承認されていない」クラウドアプリのホスト名一覧が取得できます。

curl -v "https://$MCAS_API_URL/api/discovery_block_scripts/?format=120&type=banned" \
-H "Authorization: Bearer $TOKEN"
result.txt
.app.chime.aws
.chime.aws.amazon.com
.biba.com
.meet.google.com
.zoom.us
.api.solvvy.com

CSV ファイル作成

以下の要領で CSV 形式でファイル作成します。

curl -v "https://$MCAS_API_URL/api/discovery_block_scripts/?format=120&type=banned" \
-H "Authorization: Bearer $TOKEN" > mcas.txt

sed -i '' 's/^.//' mcas.txt

mv mcas.txt mcas.csv

CSV アップロード

ホスト名リストとして、CSV をインポートしてリストを作成します。

image.png

image.png

ポリシー設定

MCAS リストにあるホスト名をブロックする HTTP ポリシーを設定します。

image.png

動作確認

以下のように期待通りブロックする動作が確認できました。

image.png

まとめ

すでに MCAS (Microsoft Cloud App Security) で定義済みの社内ポリシーがあれば、そちらに準拠する形で Cloudflare Zero Trust と連携して動作させることができます。

参考になればと思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?