RHEL8
Shibboleth用のrepositoryファイルをダウンロード.
# wget https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_8
yum に repository ファイルを追加
# cp sp_repo.cgi\?platform=* /etc/yum.repos.d/shibboleth.repo
Shibbolethのインストール
# yum install shibboleth
**httpd 設定
/etc/httpd/conf.d/ssl.conf にて,ServerNameを設定.
ServerName shib-sp.example.jp:443
# systemctl start shibd # systemctl enable shibd # systemctl restart httpd
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=21443867
shibboleth2.xml の編集
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=12158266
学認運用フェデレーションのメタデータ検証用証明書をダウンロード
https://metadata.gakunin.nii.ac.jp/gakunin-signer-2017.cer
/etc/shibboleth/cert 配下にメタデータ検証用をコピー
# cp gakunin-signer-2017.cer /etc/shibboleth/cert/
/etc/shibboleth/cert 配下にサーバ証明書と秘密鍵をコピー
# mkdir /etc/shibboleth/cert # cp /etc/pki/tls/private/server.key /etc/shibboleth/cert/ # cp /etc/pki/tls/certs/server.crt /etc/shibboleth/cert/
/etc/shibboleth/cert/server.key はユーザ shibd によって読み取れる必要がある. Shibboleth SP のデフォルト設定である以下を参考にパーミッションを限定する.
# chown shibd:shibd /etc/shibboleth/cert/server.key # chmod 440 /etc/shibboleth/cert/server.key
/etc/shibboleth/shibboleth2.xml の該当する部分を変更
<!-- Simple file-based resolvers for separate signing/encryption keys. --> <CredentialResolver type="File" use="signing" key="cert/server.key" certificate="cert/server.crt"/> ↑秘密鍵の格納先 ↑サーバ証明書の格納先 <CredentialResolver type="File" use="encryption" key="cert/server.key" certificate="cert/server.crt"/> ↑秘密鍵の格納先 ↑サーバ証明書の格納先
/var/www/html/moodle/auth/shibboleth/README.txt
1. moodle/auth/shibboleth/index.php をShibboleth で保護.
<Directory /var/www/html/auth/shibboleth/index.php> AuthType shibboleth ShibRequireSession On require valid-user </Directory>
2. Moodle に admin でログインし,'サイト管理 > プラグイン > 認証'を表示, 'Shibboleth' をクリック.
3. 必要事項を入力.
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=12158282
メタデータ中の特定のIdPのみ利用を許可する方法
idp のメタデータ(学認の一覧から切り取り)を mahara の /etc/shibboleth/idp-metadata.xml に置く.
で,/etc/shibboleth2.xml の編集
<!-- Example of locally maintained metadata. --> <!-- コメントアウト解除 --> <MetadataProvider type="XML" file="idp-metadata.xml"/> <!-- コメントアウト解除 --> (中略) <SSO entityID="https://shibboleth-idp.example.jp/idp/shibboleth" discoveryProtocol="SAMLDS" discoveryURL="https://ds.example.org/DS/WAYF"> SAML2 </SSO>
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=12158282
/etc/shibboleth2.xml の編集
<MetadataProvider type="XML" uri="https://metadata.gakunin.nii.ac.jp/gakunin-metadata.xml" backingFilePath="federation-metadata.xml" reloadInterval="7200"> <MetadataFilter type="RequireValidUntil" maxValidityInterval="1296000"/> <MetadataFilter type="Signature" certificate="/etc/shibboleth/cert/gakunin-signer-2010.cer"/> <MetadataFilter type="Whitelist"> <Include>(...IdPのentityID...)</Include> <Include>https://shibboleth-idp.example.jp/idp/shibboleth</Include> → Includeの行を増やすことで、連携するIdPを増やすことができます </MetadataFilter> </MetadataProvider> <!-- コメントアウト解除 --> (中略) <SSO entityID="https://shibboleth-idp.example.jp/idp/shibboleth" discoveryProtocol="SAMLDS" discoveryURL="https://ds.example.org/DS/WAYF"> SAML2 </SSO> (中略) <!-- コメントアウト <SessionInitiator type="Chaining" Location="/DS" isDefault="true " id="DS"> <SessionInitiator type="SAML2" template="bindingTemplate.html"/> <SessionInitiator type="Shib1"/> <SessionInitiator type="SAMLDS" URL="https://ds.gakunin.nii.ac.jp/WAYF"/> </SessionInitiator> コメントアウト -->
https://shib-sp.example.jp/Shibboleth.sso/Metadata
で取得できる SP のメタデータ(shib-sp-metadata.xml)を IdP の /opt/shibboleth-idp/metadata/ に転送する.
IdP の conf/metadata-providers.xml を編集
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=12158282 を参照
最後から 2行目ぐらいに以下を追加
<MetadataProvider id="sp-shib" xsi:type="FilesystemMetadataProvider" metadataFile="%{idp.home}/metadata/shib-sp-metadata.xml"/>
/opt/shibboleth-idp/conf/attribute-filter.xml に開示する属性を追記.
参考) https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=20021644
で tomcat をリスタート