0
1

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 3 years have passed since last update.

Shibboleth IdPとSimpleSAMLphpのSPを接続する

Posted at

概要

Shibboleth IdPとSimpleSAMLphpのSPを連携させるには、Shibboleth IdPで一部専用の設定を行う必要がある。その部分を含めての設定手順。今回の手順ではDSは利用しない。

設定方法

構築環境

  • IdP: Shibbpleth IdP 3.4.6、Tomcat 7、OpenJDK 8
  • SP: SimpleSAMLphp 1.18.7、PHP 5.6
  • 共通: CentOS 7.8、Apache httpd 2.4.6

IdPのホスト名: idp.mydomain
SPのホスト名: sp.mydomain

SimpleSAMLphpのインストール

Apache httpdの設定とサーバ証明書の導入は完了しているものとする。

# wget https://github.com/simplesamlphp/simplesamlphp/releases/download/v1.18.7/simplesamlphp-1.18.7.tar.gz
# tar xzvf simplesamlphp-1.18.7.tar.gz
# chown -R apache:apache simplesamlphp-1.18.7
# mv simplesamlphp-1.18.7 /var/www/
# vi /etc/httpd/conf.d/ssp.conf
Alias /simplesaml /var/www/simplesamlphp-1.18.7/www

# systemctl reload httpd

※パスを /simplesaml から変更する場合は、/var/www/simplesamlphp-1.18.7/config/config.php の baseurlpath の値も変更する。

/var/www/simplesamlphp-1.18.7/config/config.php の以下の値を適当に変更。
・secretsalt
・auth.adminpassword

Shibboleth IdPのメタデータをSimpleSAMLphpに登録

Shibboleth IdPで /opt/shibboleth-idp/metadata/idp-metadata.xml の内容をコピーする。学認IdPの場合は、このメタデータを利用せず、IdPのXMLを「学認申請システム」から拾ってくる。

ウェブブラウザで https://sp.mydomain/simplesaml にアクセスし、[連携]タブの「XMLをSimpleSAMLphpメタデータに変換」をクリック。「メタデータパーサ」でIdPのXMLをパースし、表示される saml20-idp-remote の値をコピーし、/var/www/simplesamlphp-1.18.7/metadata/saml20-idp-remote.php にコピーした値を追記する。
[連携]タブを再度開き、「SAML 2.0 IdPメタデータ(Trusted)」に追記したIdPが表示されていることを確認。

Shibboleth IdPにSimpleSAMLphp SP用メタデータ追加

SimpleSAMLphpで[連携]タブから「メタデータを表示」をクリック、「SAML 2.0 用のメタデータXMLフォーマット:」の値をコピーする。
コピーしたXMLをShibboleth IdPの /opt/shibboleth-idp/metadata/ のなかに任意の名前で保存する。ここでは simplesaml.xml とする。

/opt/shibboleth-idp/conf/metadata-providers.xml に以下を追記。idは適当に変更しても良い。

+       <MetadataProvider id="SimpleSAMLphpSP"
+           xsi:type="FilesystemMetadataProvider"
+           metadataFile="%{idp.home}/metadata/simplesaml.xml"/>
    </MetadataProvider>

/opt/shibboleth-idp/conf/attribute-filter.xml に以下を追記。Requesterとして記載するEntity IDはSimpleSAMLphpの[連携]タブで確認しておく。必要に応じてAttributeRuleを追加。

<AttributeFilterPolicy id="PolicyforSimpleSAMLphp">
    <PolicyRequirementRule xsi:type="Requester"
        value="https://sp.mydomain/simplesaml/module.php/saml/sp/metadata.php/default-sp" />
    <AttributeRule attributeID="eduPersonPrincipalName" permitAny="true" />
    <AttributeRule attributeID="eduPersonTargetedID" permitAny="true" />
</AttributeFilterPolicy>

/opt/shibboleth-idp/conf/relying-party.xml を編集して以下を追記。このencryptAssertionsencryptNameIDsがfalseになっていないと、SimpleSAMLphpとの連携ができない。

    <util:list id="shibboleth.RelyingPartyOverrides">
+       <bean parent="RelyingPartyByName" 
+           c:relyingPartyIds="#{{'https://sp.mydomain/simplesaml/module.php/saml/sp/metadata.php/default-sp'}}">
+           <property name="profileConfigurations">
+               <list>
+                   <bean parent="SAML2.SSO" p:encryptAssertions="false" p:encryptNameIDs="false" />
+               </list>
+           </property>
+       </bean>
    </util:list>

設定反映のため、tomcatを再起動。

# systemctl restart tomcat

simpleSAMLphp設定ページを開き、[認証]タブから「設定されている認証元をテスト」をクリック。「default-sp」をクリック。IdPの認証画面に遷移し、認証が成功すれば設定完了。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?