pikesaku’s blog

個人的な勉強メモです。記載内容について一切の責任は持ちません。

AWS Site-To-Site VPN接続メモ

AWS STSメモ

メモ

AWS Security Token Serviceの略

IAM同様にリソースへの認可を制御

※信頼されたユーザーにAWSリソースへの一時的な資格情報(credentials)を提供

IAMとの違いは以下

1) アクセスキーの有効期間
 IAM→Long Term
 STS→Short Term(数分〜数時間。定義可能)
2) 資格情報(credentials)の管理方法
 IAM→ユーザーに紐付き保管
 STS→ユーザーに紐付き保管されず、リクエスト毎にダイナミックに生成

STSによる一時的な資格情報が適用される主なシーン

1) 外部IdP連携(Identity federation)
 2種類実装パターンあり
 Enterprise identity federation→オンプレ認証基盤との連携(SAML、カスタム認証基盤)
 Web identity federation→Amazon(Cognito)、FacebookGoogle、もしくはOIDC互換IdP
2) ロール(クロスアカウントアクセス)
 アカウントAのユーザーAがアカウントBのリソースにアクセス可能にできる。※delegation(委任) 
 Creating a role to delegate permissions to an IAM user - AWS Identity and Access Management
3) ロール(EC2)
 EC2起動時にロール割り当てAWSリソースにアクセス可能にできる。

STSでアクセス可能なAWSリソース一覧は以下で確認できる。

AWS services that work with IAM - AWS Identity and Access Management

リージョンエンドポイントの利用が推奨

STSはデフォルトでグローバルサービスだが、対応済みリージョンにはエンドポイントがある。
グローバルエンドポイント→https://sts.amazonaws.com
東京リージョンエンドポイント→https://sts.ap-northeast-1.amazonaws.com

以下メリットあり
・低レイテンシ
・リージョン障害時の冗長化実装ができる
 自動冗長化されない。アプリ内で複数リージョンのエンドポイントをみるようコードする必要あり。
・セッショントークンの信頼性の増大
 グローバルエンドポイントのセッショントークンはデフォルトだと一部リージョン(honkong等)で利用できない。
 リージョンエンドポイントのセッショントークンは全リージョンで有効

対応リージョンは以下参照
Managing AWS STS in an AWS Region - AWS Identity and Access Management
 
上記URLより引用

常時SSL/TLSの時代におけるVPNの必要性について

インターネット上のHTTPSサイトに直接アクセスする場合と、VPN経由でアクセスする場合の違いは?

①接続元IPの隠蔽
 VPN使うと接続元IPを隠蔽できる。IPヘッダも暗号化されるので。
 自宅→VPNサーバ→Webサイト
 上記の通信の場合に、接続先のWebサーバ側では接続元IPがVPN機器のIPになる。自宅のグローバルIP情報はなくなる。

②SNI悪用区間の違い
 端末HTTPSサイト
 端末→VPNサーバHTTPSサイト
 ※赤字区間がSNI悪用できるところ。SNI悪用する場合、通信傍受は必須。

企業ユースでは、どちらもニーズなさそう。
VPN経由の場合、VPNTLS/SSLの2重の仕組みで暗号化される点が優位か?と思ったが、VPNサーバ→HTTPSサイトの間はTLS/SSLのみ。※上記の②と同じ。

AWS IAMメモ

ユーザーガイドの内容をまとめる。

What is IAM? - AWS Identity and Access Management

AWS Identity and Access Managementの略
AWSリソースへの認証・認可を制御するWebサービス

特徴

・複数ユーザーできめ細かいアクセス制御
・EC2で動作するアプリにセキュアなリソースへのアクセス方法を提供
・MFA
・外部IdP連携(Identity federation)
・CloudTrailで監査ログを取得可能
PCI DSS対応
・多くのAWSサービスとの統合 ※以下情報は要チェック
 AWS services that work with IAM - AWS Identity and Access Management
・更新反映に時間がかかる。
・利用料無料

IAM関連機能で、セキュアな一時的な資格情報(credentials)を提供するAWS Security Token Service(STS)があり。
ロールや外部IdP連携(Identity federation)のセッションに適用される。
詳細は以下URL参照。
AWS STSメモ - pikesaku’s blog




基本事項

  • IAM=Identity and Access Management
  • AWSアカウント=ルートユーザーアカウント
  • ルートユーザーアカウントで作成したユーザー=IAMユーザー
  • ルートユーザー、IAMユーザーともにオペレーション実行方法により以下2種類の認証情報を使い分ける。
実行方法 認証情報
AWSマネジメントコンソール パスワード
AWS CLI アクセスキー

IAMアーキテクチャ

IAM の仕組みについて - AWS Identity and Access Management より引用

https://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/intro-diagram%20_policies_800.png

 

キーワード 説明
IAMリソース IAMの構成要素(ユーザー、グループ、ロール、ポリシー、IDプロバイダ等)
IAMアイデンティティ 識別されたもの=IAMポリシーをアタッチする対象(ユーザー、グループ、ロール)
IAMエンティティ 認証されるもの(ユーザー、ロール)
プリンシパル リクストの実行主体。IAMユーザー・ロール・アプリケーション。フェデレーション構成の場合、

 
https://d1.awsstatic.com/webinars/jp/pdf/services/20190129_AWS-BlackBelt_IAM_Part1.pdf より引用。

IAMポリシーとは?(作成中)

https://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/access_policies.html


クロスアカウントの場合は、&がいいでしょ。
勝手な推測。andの方が明示的=直感的&クロスアカウントは別組織扱いだし。意図しない動きを減らす実装があるべき。
awsブラックベルトがやっぱり良かった。
こっちを見ろ!

IAMロールとは?(作成中)

Trust & Permissions
ヘルメット=かぶりもの
サービスに付与されるケースが多い
別アカウント or 同一アカウント内のIAMユーザーへの割り当ても可能。この場合、スイッチロール操作が必要。
 マネジメントコンソールの場合は"ロールの切り替え"、CLIの場合は、--proifileオプションでスイッチロールが可能


フェデレーティッドユーザーとロール
フェデレーティッドユーザーが AWS にサインインすると、そのユーザーはロールに関連付けられ、ロールで定義されているアクセス許可が付与されます。





処理の流れ(作成中)

ベストプラクティクス(作成中)

  • ルートユーザーは業務で使わない。IAMユーザー作成 & 必要な権限付与して利用がベストプラクティクス。

  ※以下操作が必要な場合のみルートユーザー利用
  AWS アカウント ルートユーザーの認証情報と IAM ユーザーの認証情報 - AWS 全般のリファレンス

  • ルートユーザーにアクセスキーは設定しない。
  • アクセスキーは有効期限なし。漏洩すると悪用され大変。必要な場合のみ適切なアクセス制限した上で利用する。

作成中メモなので、関係ないけどメモ


ダイレクトコネクトgwとトランジットgwの違い



https://www.fujitsu.com/jp/solutions/infrastructure/construction/multi-cloud/aws/event-column/aws-transit-gateway.html#:~:text=%E3%83%BBDirect%20Connect%20Gateway%E3%81%A8%E3%81%AE,%E3%81%AE%E5%85%B1%E6%9C%89%E3%81%AF%E5%8F%AF%E8%83%BD%E3%81%A7%E3%81%99%E3%80%82

OpenAMとO365のSAML連携(動作確認)

参考

OpenAMとO365のSAML連携 - pikesaku’s blog
上記手順で構成。

前提情報

O365(SP)メタファイル

https://nexus.microsoftonline-p.com/federationmetadata/saml20/federationmetadata.xml

<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport" ID="_e1f359fb-13fb-4264-9047-177f62360717" entityID="urn:federation:MicrosoftOnline">
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_e1f359fb-13fb-4264-9047-177f62360717">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>LhwJ4fdEzmYQo4AgLM33skv8EhM=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>CmzuV+PjHZAYEHIEPDgmnXtIwKaiBuwdPctJfwp57VBKZRPB+bM7Yrlxm2osn4T8AjLBNxV64I8t5tAALYhJuBnUW7hQwONVetovkAT07fN53Ybjc8uIvJWx0ZkJ4gyAVCwdEzGd7dUJmuqRbImyfaNkTnjWtFXCtj0JJOb7kNMXGxCbjcGXMTPvsItNmZ/goiKAPIGgnAWeJQlXRLBNj3VncEo2rmfFGsaKtqoFKx19JrzI70vxRTcQyCB4Qf6ID+EHrWfMr0crZ94ttJ50wrsS9aIvPgH/Px7mHFKSjC0N4tc7cuVC09/PHCy/hBIfvaWGnjcJOXku2XCNdkbvZw==</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIIC/TCCAeWgAwIBAgIQN/GPegnT8blP2EcSdMMbBzANBgkqhkiG9w0BAQsFADApMScwJQYDVQQDEx5MaXZlIElEIFNUUyBTaWduaW5nIFB1YmxpYyBLZXkwHhcNMjEwMjE4MDAwMDAwWhcNMjYwMjE4MDAwMDAwWjApMScwJQYDVQQDEx5MaXZlIElEIFNUUyBTaWduaW5nIFB1YmxpYyBLZXkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDXdLGU2Ll5RPdDUnKQ+f/HS5qiTay2cCh9U2AS6oDM6SOxVhYGtoeJ1VPebcLnpgLfhPxzrwWoVzXSEF+VRQbnYID2Jb4khjgyEeoThk3VqrThwhahpSbBg2vo06vIOp1TS2R1BiwHKTLoB1i1IJnaIFSC3BN6pY4flXWyLQt/5ABXElv2XZLqXM9Eefj6Ji40nLIsiW4dWw3BDa/ywWW0MsiW5ojGq4vovcAgENe/4NUbju70gHP/WS5D9bW5p+OIQi7/unrlWe/h3A6jtBbbRlXYXlN+Z22uTTyyCD/W8zeXaACLvHagwEMrQePDXBZqc/iX2kI+ooZr1sC/H39RAgMBAAGjITAfMB0GA1UdDgQWBBSrX2dm3LwT9jb/p+bAAdYQpE+/NjANBgkqhkiG9w0BAQsFAAOCAQEAeqJfYHnsA9qhGttXFfFpPW4DQLh5w6JCce7vGvWINr5fr1DnQdcOr+wwjQ/tqbckAL2v6z1AqjhS78kbfegnAQDwioJZ1olYYvLOxKoa6HF+b1/p0Mlub8Zukk2n1b2lKPBBOibOasSY7gQDwlIZi7tl9nMTxUfdYK+E5Axv7DVnmUCwcnnpV5/1SFdNyW2kWO4C68rrjMOvECfwrKkbfVJM8f9krEUBuoBF8dTDv7D2ZM4Q2buC70NbfaNWUX0yFvKI0IuTqk8RBfGTRQ4fZAbhMPaykEpBu6dNjTi5YOa0lNqFGS7Ax7leCh5x9lV8elcLkXs8ySo8AOQJk0hgIw==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
<SPSSODescriptor WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor use="signing">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>MIIC/TCCAeWgAwIBAgIQbgDHfi3t1JN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>
</KeyInfo>
</KeyDescriptor>
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://login.microsoftonline.com/login.srf"/>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
<NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
<AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://login.microsoftonline.com/login.srf" index="0" isDefault="true"/>
<AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign" Location="https://login.microsoftonline.com/login.srf" index="1"/>
<AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS" Location="https://login.microsoftonline.com/login.srf" index="2"/>
</SPSSODescriptor>
<Extensions>
<alg:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<alg:SigningMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
</Extensions>
</EntityDescriptor>

OpenAM(IdP)メタファイル

ドメインhoge.comでレルムはo365の場合、公開URL文字列は以下となる。
https://hoge.com/openam/saml2/jsp/exportmetadata.jsp?entityid=https%3A%2F%2Fhoge.com%3A443%2Fopenam&realm=%2Fo365

EntityDescriptor entityID="https://hoge.com:443/openam">
<IDPSSODescriptor WantAuthnRequestsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor use="signing">
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
〜省略〜
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</KeyDescriptor>
<ArtifactResolutionService index="0" isDefault="true" Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://hoge.com:443/openam/ArtifactResolver/metaAlias/o365/idp"/>
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://hoge.com:443/openam/IDPSloRedirect/metaAlias/o365/idp" ResponseLocation="https://hoge.com:443/openam/IDPSloRedirect/metaAlias/o365/idp"/>
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://hoge.com:443/openam/IDPSloPOST/metaAlias/o365/idp" ResponseLocation="https://hoge.com:443/openam/IDPSloPOST/metaAlias/o365/idp"/>
<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://hoge.com:443/openam/IDPSloSoap/metaAlias/o365/idp"/>
<ManageNameIDService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://hoge.com:443/openam/IDPMniRedirect/metaAlias/o365/idp" ResponseLocation="https://hoge.com:443/openam/IDPMniRedirect/metaAlias/o365/idp"/>
<ManageNameIDService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://hoge.com:443/openam/IDPMniPOST/metaAlias/o365/idp" ResponseLocation="https://hoge.com:443/openam/IDPMniPOST/metaAlias/o365/idp"/>
<ManageNameIDService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://hoge.com:443/openam/IDPMniSoap/metaAlias/o365/idp"/>
<NameIDFormat>
urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
</NameIDFormat>
<NameIDFormat>
urn:oasis:names:tc:SAML:2.0:nameid-format:transient
</NameIDFormat>
<NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
</NameIDFormat>
<NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
</NameIDFormat>
<NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName
</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos</NameIDFormat>
<NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName
</NameIDFormat>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://hoge.com:443/openam/SSORedirect/metaAlias/o365/idp"/>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://hoge.com:443/openam/SSOPOST/metaAlias/o365/idp"/>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://hoge.com:443/openam/SSOSoap/metaAlias/o365/idp"/>
<NameIDMappingService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://hoge.com:443/openam/NIMSoap/metaAlias/o365/idp"/>
<AssertionIDRequestService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://hoge.com:443/openam/AIDReqSoap/IDPRole/metaAlias/o365/idp"/>
<AssertionIDRequestService Binding="urn:oasis:names:tc:SAML:2.0:bindings:URI" Location="https://hoge.com:443/openam/AIDReqUri/IDPRole/metaAlias/o365/idp"/>
</IDPSSODescriptor>
</EntityDescriptor>

SP Initiated SSOの場合

以下フローとなる。
①ブラウザがO365(SP)のサインイン画面にアクセスしサインイン(IDのみ入力)
②O365がブラウザをOpenAM(IdP)のレルムのサインイン画面にリダイレクト
③ブラウザがOpenAMサインイン画面にアクセス(SAMLリクエスト送付)
④ブラウザがOpenAMサインイン画面でID/PW入力しサインイン
⑤OpenAMがブラウザをO365にリダイレクト
⑦ブラウザがO365 SAMLにアクセス(SAMLレスポンス送付)
⑥O365にサインイン

SAMLトレーサーの情報で採取した情報は以下の通り。

SAMLリクエスト(③)

<samlp:AuthnRequest ID="_77eeb8fe-8b2b-4752-9ed4-4fc0c3fbf8e9"
                    Version="2.0"
                    IssueInstant="2022-05-15T14:51:07.739Z"
                    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                    >
    <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">urn:federation:MicrosoftOnline</Issuer>
    <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" />
</samlp:AuthnRequest>

SAMLレスポンス(⑦)

<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                ID="s2faee0cb2cdbb0c40204f41c0613ff54d25cc543c"
                InResponseTo="_77eeb8fe-8b2b-4752-9ed4-4fc0c3fbf8e9"
                Version="2.0"
                IssueInstant="2022-05-15T14:51:13Z"
                Destination="https://login.microsoftonline.com/login.srf"
                >
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://hoge.com:443/openam</saml:Issuer>
    <samlp:Status xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
        <samlp:StatusCode xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                          Value="urn:oasis:names:tc:SAML:2.0:status:Success"
                          />
    </samlp:Status>
    <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                    ID="s26a1ee234251e7b5de92ad22ceecb14a112d9191c"
                    IssueInstant="2022-05-15T14:51:13Z"
                    Version="2.0"
                    >
        <saml:Issuer>https://hoge.com:443/openam</saml:Issuer>
        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
                <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                <ds:Reference URI="#s26a1ee234251e7b5de92ad22ceecb14a112d9191c">
                    <ds:Transforms>
                        <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                        <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                    </ds:Transforms>
                    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                    <ds:DigestValue>o+/KyOny4iHd+yikTkDxWliPlVk=</ds:DigestValue>
                </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>〜省略〜</ds:SignatureValue>
            <ds:KeyInfo>
                <ds:X509Data>
                    <ds:X509Certificate>〜省略〜</ds:X509Certificate>
                </ds:X509Data>
            </ds:KeyInfo>
        </ds:Signature>
        <saml:Subject>
            <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
                         NameQualifier="https://hoge.com:443/openam"
                         SPNameQualifier="urn:federation:MicrosoftOnline"
                         >10000</saml:NameID>
            <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
                <saml:SubjectConfirmationData InResponseTo="_77eeb8fe-8b2b-4752-9ed4-4fc0c3fbf8e9"
                                              NotOnOrAfter="2022-05-15T15:01:13Z"
                                              Recipient="https://login.microsoftonline.com/login.srf"
                                              />
            </saml:SubjectConfirmation>
        </saml:Subject>
        <saml:Conditions NotBefore="2022-05-15T14:41:13Z"
                         NotOnOrAfter="2022-05-15T15:01:13Z"
                         >
            <saml:AudienceRestriction>
                <saml:Audience>urn:federation:MicrosoftOnline</saml:Audience>
            </saml:AudienceRestriction>
        </saml:Conditions>
        <saml:AuthnStatement AuthnInstant="2022-05-15T14:51:13Z"
                             SessionIndex="s22aa3ab0b20f4d83859d1aa1528391652e0dde201"
                             >
            <saml:AuthnContext>
                <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
            </saml:AuthnContext>
        </saml:AuthnStatement>
        <saml:AttributeStatement>
            <saml:Attribute Name="IDPEmail">
                <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
                                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                     xsi:type="xs:string"
                                     >hoge@hoge.com</saml:AttributeValue>
            </saml:Attribute>
        </saml:AttributeStatement>
    </saml:Assertion>
</samlp:Response>

SAMLログアウトリクエスト(おまけ)

<samlp:LogoutRequest ID="_12385893-eebb-45eb-87de-4c023d0230a7"
                     Version="2.0"
                     IssueInstant="2022-05-15T14:51:28.302Z"
                     Destination="https://hoge.com:443/openam/IDPSloRedirect/metaAlias/o365/idp"
                     xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                     >
    <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">urn:federation:MicrosoftOnline</Issuer>
    <NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
            xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
            >10000</NameID>
    <samlp:SessionIndex>s22aa3ab0b20f4d83859d1aa1528391652e0dde201</samlp:SessionIndex>
</samlp:LogoutRequest>

SAMLログアウトレスポンス(おまけ)

<samlp:LogoutRequest ID="_12385893-eebb-45eb-87de-4c023d0230a7"
                     Version="2.0"
                     IssueInstant="2022-05-15T14:51:28.302Z"
                     Destination="https://hoge.com:443/openam/IDPSloRedirect/metaAlias/o365/idp"
                     xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                     >
    <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">urn:federation:MicrosoftOnline</Issuer>
    <NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
            xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
            >10000</NameID>
    <samlp:SessionIndex>s22aa3ab0b20f4d83859d1aa1528391652e0dde201</samlp:SessionIndex>
</samlp:LogoutRequest>

IDP Initiated SSOの場合

以下フローとなる。
①ブラウザがレルムのOpenAMサインイン画面でID/PW入力しサインイン
 URLは以下
 https://hoge.com:443/openam/XUI/?realm=%2Fo365#login
②ブラウザがO365 SAMLにアクセス(SAMLレスポンス送付)
 https://hoge.com:443/openam/saml2/jsp/idpSSOInit.jsp?metaAlias=%2Fo365%2Fidp&spEntityID=urn%3Afederation%3AMicrosoftOnline&NameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
③O365にサインイン

SAMLトレーサーの情報で採取した情報は以下の通り。

SAMLレスポンス(②)

<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                ID="s207635788d55874ec055af470c14588ac4d8d151d"
                Version="2.0"
                IssueInstant="2022-05-15T15:52:58Z"
                Destination="https://login.microsoftonline.com/login.srf"
                >
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://hoge.com:443/openam</saml:Issuer>
    <samlp:Status xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
        <samlp:StatusCode xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                          Value="urn:oasis:names:tc:SAML:2.0:status:Success"
                          />
    </samlp:Status>
    <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                    ID="s2bd1c86eb6c0ab8f840b6f8eb2f20ab4210b7da2f"
                    IssueInstant="2022-05-15T15:52:58Z"
                    Version="2.0"
                    >
        <saml:Issuer>https://hoge.com:443/openam</saml:Issuer>
        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
                <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                <ds:Reference URI="#s2bd1c86eb6c0ab8f840b6f8eb2f20ab4210b7da2f">
                    <ds:Transforms>
                        <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                        <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                    </ds:Transforms>
                    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                    <ds:DigestValue>IxMkFO2rdzhOk9/t2blfaIE2b6k=</ds:DigestValue>
                </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>〜省略〜</ds:SignatureValue>
            <ds:KeyInfo>
                <ds:X509Data>
                    <ds:X509Certificate>〜省略〜</ds:X509Certificate>
                </ds:X509Data>
            </ds:KeyInfo>
        </ds:Signature>
        <saml:Subject>
            <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
                         NameQualifier="https://hoge.com:443/openam"
                         SPNameQualifier="urn:federation:MicrosoftOnline"
                         >10000</saml:NameID>
            <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
                <saml:SubjectConfirmationData NotOnOrAfter="2022-05-15T16:02:58Z"
                                              Recipient="https://login.microsoftonline.com/login.srf"
                                              />
            </saml:SubjectConfirmation>
        </saml:Subject>
        <saml:Conditions NotBefore="2022-05-15T15:42:58Z"
                         NotOnOrAfter="2022-05-15T16:02:58Z"
                         >
            <saml:AudienceRestriction>
                <saml:Audience>urn:federation:MicrosoftOnline</saml:Audience>
            </saml:AudienceRestriction>
        </saml:Conditions>
        <saml:AuthnStatement AuthnInstant="2022-05-15T15:52:26Z"
                             SessionIndex="s2b52578651e4b29cf4b304eceb2475cae0259eb01"
                             >
            <saml:AuthnContext>
                <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
            </saml:AuthnContext>
        </saml:AuthnStatement>
        <saml:AttributeStatement>
            <saml:Attribute Name="IDPEmail">
                <saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
                                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                     xsi:type="xs:string"
                                     >hoge@hoge.com</saml:AttributeValue>
            </saml:Attribute>
        </saml:AttributeStatement>
    </saml:Assertion>
</samlp:Response>

SAMLログアウトリクエスト(おまけ)

<samlp:LogoutRequest ID="_19e69436-931a-403e-95d8-c506945df67f"
                     Version="2.0"
                     IssueInstant="2022-05-15T15:53:14.166Z"
                     Destination="https://hoge.com:443/openam/IDPSloRedirect/metaAlias/o365/idp"
                     xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                     >
    <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">urn:federation:MicrosoftOnline</Issuer>
    <NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
            xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
            >10000</NameID>
    <samlp:SessionIndex>s2b52578651e4b29cf4b304eceb2475cae0259eb01</samlp:SessionIndex>
</samlp:LogoutRequest>

SAMLログアウトレスポンス(おまけ)

<samlp:LogoutResponse xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                      ID="se60d6f6c2dc845c912c51b187496499ebdb0d10b"
                      Version="2.0"
                      IssueInstant="2022-05-15T15:53:14Z"
                      Destination="https://login.microsoftonline.com/login.srf"
                      InResponseTo="_19e69436-931a-403e-95d8-c506945df67f"
                      >
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://hoge.com:443/openam</saml:Issuer>
    <samlp:Status xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
        <samlp:StatusCode xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                          Value="urn:oasis:names:tc:SAML:2.0:status:Success"
                          />
        <samlp:StatusMessage xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
Session did not exist. Already logged-out
</samlp:StatusMessage>
    </samlp:Status>
</samlp:LogoutResponse>

ログアウト時、以下エラーになる。

※原因調査中。

Azureメモ(Microsoft Sentinel)

Microsoft Sentinel とは | Microsoft Docs

Microsoft Sentinelとは?

クラウドネイティブSIEM & SOARソリューション
LogAnalysticsやLogic Appsとネイティブに連携
※SIEMはsecurity information and event managementの略
※SOARはsecurity orchestration, automation, and response

できること

No 項目 意味 説明
1 Collect データ収集 自環境のオンプレ・クラウドにあるユーザー、デバイス、アプリケーション、インフラストラクチャが対象
2 Detect 脅威検知 MSの莫大な知見を利用し誤判定を最小化
3 Investigate 調査 AI利用・全体調査
4 Respond 自動対応 組み込みオーケストレーション利用可

上記URLより引用

Connect to all your data

Microsoft 365 Defender、Office 365、Azure AD、Microsoft Defender for Identity、Microsoft 365とリアルタイム統合するコネクタがあり
Microsoft 以外のソリューションとのコネクタもあり
コネクタでソースと接続してデータを収集
Syslog、REST-APIでもデータ収集可能

Microsoft Sentinel data connectors | Microsoft Docs
Find your Microsoft Sentinel data connector | Microsoft Docs

Workbooks

WorkBookは収集データを可視化する為のもの。コード不要で作成できる。
Azure Monitor WorkBookで全体的なカスタムブックが作成できる
Microsoft Sentinel WorkBookも作成できる。データ収集したら即時利用可能になるテンプレあり。
⭐️全体可視化を即時に実現できる。これがないと、構成要素毎の担当エンジニアが可視化し、それをまとめる必要あり。負担軽減・対応迅速化⭐️

Azure Monitor Workbooks Overview - Azure Monitor | Microsoft Docs

Analytics

インシデントはエンジニアによる要調査課題の単位
関連性のある複数のアラートを集約して1つのインシデントを自動生成する。
集約ルールはビルトインである。それをカスタマイズし独自ルールの作成も可能。
⭐️多数の軽度なアラートの背後にある潜在的なクリティカルな脅威の発見を支援⭐️

Detect threats with built-in analytics rules in Microsoft Sentinel | Microsoft Docs

Security automation & orchestration

ワークフロー自動化機能を提供するLogic Appsでトリガー・アクションを指定し、フローを作成できる。
Logic Appsのコネクタ活用し、Slack通知や他ワークフローシステムに連携等ができる。
⭐️負担軽減・対応迅速化⭐️

Use playbooks with automation rules in Microsoft Sentinel | Microsoft Docs

Investigation ※2022/5時点プレビュー中

1つのEntityからドリルダウンで関連Entityをつなげて、根本原因と全体スコープを明らかにする
上記URLより引用

Investigate incidents with Microsoft Sentinel | Microsoft Docs

Hunt

MITRE ATT&CKフレームワークをベースにしたビルトインのクエリツールがあり、それを活用して潜在するインシデントを発見する

※Huntはアラートを待たず、能動的に潜在的なインシデントを見つけ出すこと。予防的アクション。
 Threat Huntingとは何か?(2019年度版) - セキュリティコンサルタントの日誌から

※MITRE ATT&CKフレーム
 ATT&CKは"Adversarial Tactics, Techniques, and Common Knowledge"の略
 攻撃者の攻撃方法や行動、目的を明文化したフレームワーク
 MITRE ATT&CKフレームワーク | セキュリティ用語集 | サイバーセキュリティ | NECソリューションイノベータ

Hunting capabilities in Microsoft Sentinel | Microsoft Docs

Notebook

Jupyter notebooks in Azure Machine Learning workspacesとの連携機能
独自に機械学習ライブラリで解析ができる

Use notebooks with Microsoft Sentinel for security hunting | Microsoft Docs

Community

GithubにMSセキュリティアナリストがworkbooks, hunting queries, notebooks, playbooksをアップしており、それらを活用できる。

GitHub - Azure/Azure-Sentinel: Cloud-native SIEM for intelligent security analytics for your entire enterprise.