Full SLO(Single Logout)の設定方法

Full SLO(Single Logout)の設定方法

本稿でSLOの設定方法を説明していますが、学認のIdP/SPに対してSLOの実装を強制もしくは推奨するものではありません。

2016年9月時点で学認が把握している範囲においてSLOを実装しているIdP/SPは少数であり、対向のIdPもしくはSPが全てSLOに対応していることを期待することはできません。すなわち、仮に自組織の学認参加IdPでSLO対応したとしても、それにより学認の全てのSPからログアウトできるかのような説明は避けてください。

ひとまず、学内サービスと学内IdPのように限られた範囲でSLOを有効化する際の参考として、ご利用いただければと思います。

なお、学認のスタンスとは異なりますが、SLOについてShibboleth開発元では以下のように表現しております。短期的に何かあるというわけではございませんがご留意のほどお願いいたします。詳細はリンク先をご確認ください。
https://wiki.shibboleth.net/confluence/display/IDP4/LogoutConfiguration

以下の手順でメタデータにフロントチャネルのエンドポイントのみを記載していますが、これはユーザにSLOを実行するか否かの選択肢を残すためです。もしかしたら「IdPからもログアウトしたくない」という要望があるかもしれませんが、それは今後の検討課題です。

なお、IdPがSPからのリクエストをバックチャネルを用いて受けることは可能ですが、IdPからSPへバックチャネルリクエストを送る機能は3.xでは実装されていません。IdPv4からの新機能となります(IDP-964)。また、前者を使う際にはIdPのセッションストレージがサーバ側のものを用いていることを確認してください。

ShibbolethにおけるSLO (Single Logout) の設定方法を記載します。

前提

IdP/SPはそれぞれ以下のバージョンであることを前提とします。

  • IdP: 3.2.1

  • SP : 2.6.0

IdPの設定

メタデータへ<SingleLogoutService>を追加

IdPのメタデータに <IDPSSODescriptor> の子要素として <SingleLogoutService> を追加します。LocationのIdPのホスト名部分は適宜読み替え適切に設定して下さい。IdPが特殊な設定でなければ、ホスト名部分のみ合わせれば問題ありません。

       </ds:KeyInfo>
    </KeyDescriptor>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://IdPのホスト名/idp/profile/SAML2/POST/SLO"
                         xmlns:aslo="urn:oasis:names:tc:SAML:2.0:protocol:ext:async-slo" aslo:supportsAsynchronous="true"/>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://IdPのホスト名/idp/profile/SAML2/Redirect/SLO"
                         xmlns:aslo="urn:oasis:names:tc:SAML:2.0:protocol:ext:async-slo" aslo:supportsAsynchronous="true"/>
        ↑上記4行を追加
    <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat>
    <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
    <SingleSignOnService Binding="urn:mace:shibboleth:1.0:profiles:AuthnRequest" Location="https://IdPのホスト名/idp/profile/Shibboleth/SSO"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://IdPのホスト名/profile/SAML2/POST/SSO"/>
    <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://IdPのホスト名/idp/profile/SAML2/Redirect/SSO"/>
  </IDPSSODescriptor>

メタデータ内の要素は並び順が決まっているものがありますので注意してください。特に<IDPSSODescriptor>の子要素については下記の順番となるように<SingleLogoutService>を挿入してください。

  • <KeyDescriptor>

  • <ArtifactResolutionService>

  • <SingleLogoutService>

  • <NameIDFormat>

  • <SingleSignOnService>

idp.propertiesの変更

idp.propertiesの以下の箇所を変更します。

/opt/shibboleth-idp/conf/idp.properties の設定

# Configuration of client- and server-side storage plugins
#idp.storage.cleanupInterval = PT10M
idp.storage.htmlLocalStorage = true ← アンコメントして変更

# Set to true to expose more detailed errors in responses to SPs
(省略)
# Track information about SPs logged into
idp.session.trackSPSessions = true ← アンコメントして変更
# Support lookup by SP for SAML logout
idp.session.secondaryServiceIndex = true ← アンコメントして変更
# Length of time to track SP sessions
#idp.session.defaultSPlifetime = PT2H

また、SLOとして必須ではありませんが、以下の箇所を変更することでSLO実行時に画面に表示されるSPの情報がURLからメタデータ由来のDisplayNameに変化します。

/opt/shibboleth-idp/conf/idp.properties の変更

# Whether to lookup metadata, etc. for every SP involved in a logout
# for use by user interface logic; adds overhead so off by default.
idp.logout.elaboration = true ← アンコメントして変更

idp.logout.elaboration の影響

idp.logout.elaboration=false の場合

idp.logout.elaboration=true の場合

SPの設定

shibboleth2.xmlの設定

SPでのログアウトをトリガーとしてSLOを駆動するためには、shibboleth2.xmlのSessions要素内のLogout要素に以下のように"SAML2"が設定されている必要があります。デフォルト設定ですので、変更していない場合は追加設定は不要ですが、"SAML2"の部分が削除されている場合は追加してください。

            <!-- SAML and local-only logout. -->
            <Logout>SAML2 Local</Logout>

メタデータへ<SingleLogoutService>を追加

SPのメタデータに <SPSSODescriptor> の子要素として <SingleLogoutService> を追加します。LocationのSPのホスト名部分は適宜読み替え適切に設定して下さい。SPが特殊な設定でなければ、ホスト名部分のみ合わせれば問題ありません。

      </ds:KeyInfo>
    </KeyDescriptor>
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://SPのホスト名/Shibboleth.sso/SLO/POST"/> ← 追加
    <SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://SPのホスト名/Shibboleth.sso/SLO/Redirect"/> ← 追加
    <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://SPのホスト名/Shibboleth.sso/SAML2/POST" index="1" isDefault="true"/>
    <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign" Location="https://SPのホスト名/Shibboleth.sso/SAML2/POST-SimpleSign" index="2"/>
    <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" Location="https://SPのホスト名/Shibboleth.sso/SAML2/Artifact" index="3"/>
    <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post" Location="https://SPのホスト名/Shibboleth.sso/SAML/POST" index="4"/>
    <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01" Location="https://SPのホスト名/Shibboleth.sso/SAML/Artifact" index="5"/>
    <AttributeConsumingService index="1" isDefault="true">
(省略)
  </SPSSODescriptor>

メタデータ内の要素は並び順が決まっているものがありますので注意してください。特に<SPSSODescriptor>の子要素については下記の順番となるように<SingleLogoutService>を挿入してください。

  • <KeyDescriptor>

  • <SingleLogoutService>

  • <NameIDFormat>

  • <AssertionConsumerService>

  • <AttributeConsumingService>

SLOの実行

SP-initiatedのSLO