参考: https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=20021624
環境: RHEL7
# yum install java-1.8.0-openjdk
# yum install tomcat # systemctl enable tocmat
/etc/sysconfig/tomcatを編集し、JAVA_OPTSを設定
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" JAVA_OPTS="-server -Xmx1500m -XX:+UseG1GC "
/etc/profile.d/java-tomcat.sh という新規ファイルを以下の内容で作成
# /etc/profile.d/java-tomcat.sh JAVA_HOME=/usr/lib/jvm/jre #export MANPATH=$MANPATH:/usr/java/default/man CATALINA_HOME=/usr/share/tomcat CATALINA_BASE=$CATALINA_HOME PATH=$JAVA_HOME/bin:$CATALINA_BASE/bin:$CATALINA_HOME/bin:$PATH export PATH JAVA_HOME CATALINA_HOME CATALINA_BASE
server.xmlの修正
<!-- <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> Connector port="8009"に以下のように追加 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" enableLookups="false" tomcatAuthentication="false" address="127.0.0.1" maxPostSize="100000" />
/etc/httpd/conf/httpd.conf の修正
#ServerName idp.example.jp:80 ←ホスト名 ↑コメントアウト(#)を削除
/etc/httpd/conf.d/ssl.conf の修正
<VirtualHost _default_:443>
(省略)
#ServerName idp.example.jp:443 ←ホスト名 ↑コメントアウト(#)を削除 ProxyPass /idp/ ajp://localhost:8009/idp/ ←追加
(省略)
SSLProtocol all -SSLv2 -SSLv3
/etc/httpd/conf.d/virtualhost-localhost80.conf を以下の内容で作成
<VirtualHost localhost:80> ProxyPass /idp/ ajp://localhost:8009/idp/ </VirtualHost>
# tar xzvf shibboleth-identity-provider-3.?.?.tar.gz # cd shibboleth-identity-provider-3.?.? # ./bin/install.sh -Didp.conf.filemode=640 Source (Distribution) Directory: [/root/PKG/shibboleth-identity-provider-3.1.2] [Enter] ←入力なし Installation Directory: [/opt/shibboleth-idp] [Enter] ←入力なし Hostname: [idp.example.jp] [Enter] ←入力なし SAML EntityID: [https://idp.example.jp/idp/shibboleth] [Enter] ←入力なし Attribute Scope: [example.jp] [Enter] ←入力なし Backchannel PKCS12 Password: *******[Enter] ←任意のパスワード Re-enter password: ******[Enter] Cookie Encryption Key Password: ******[Enter] ←任意のパスワード Re-enter password: *******[Enter] (省略) BUILD SUCCESSFUL Total time: 2 minutes 9 seconds
# chown -R tomcat:tomcat /opt/shibboleth-idp/logs # chgrp -R tomcat /opt/shibboleth-idp/conf # chmod -R g+r /opt/shibboleth-idp/conf # find /opt/shibboleth-idp/conf -type d -exec chmod -R g+s {} \; # chgrp tomcat /opt/shibboleth-idp/metadata # chmod g+w /opt/shibboleth-idp/metadata # chmod +t /opt/shibboleth-idp/metadata
# yum install jakarta-taglibs-standard # ln -s /usr/share/java/jakarta-taglibs-core.jar /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/jakarta-taglibs-core.jar # ln -s /usr/share/java/jakarta-taglibs-standard.jar /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/jakarta-taglibs-standard.jar # /opt/shibboleth-idp/bin/build.sh Installation Directory: [/opt/shibboleth-idp] [Enter] ←入力なし Rebuilding /opt/shibboleth-idp/war/idp.war ... ...done BUILD SUCCESSFUL Total time: 3 seconds
${CATALINA_BASE}/conf/Catalina/localhost/idp.xml という 新規ファイルを以下の内容で作成し,idp.war を Tomcat が認識できるようにする.
<Context docBase="/opt/shibboleth-idp/war/idp.war" privileged="true" antiResourceLocking="false" swallowOutput="true"> <Manager pathname="" /> <!-- For Tomcat 8.0: work around lack of Max-Age support in IE/Edge --> <CookieProcessor alwaysAddExpires="true" /> </Context>
以下のエラーは無視してよい
WARNING: No rules found matching 'Context/CookieProcessor'.
httpd の再起動と Tomcat の起動
# systemctl restart httpd # systemctl start tomcat
運用フェデレーション
メタデータのダウンロード URL:
https://metadata.gakunin.nii.ac.jp/gakunin-metadata.xml
検証用証明書
/opt/shibboleth-idp/credentials/gakunin-signer-2017.cer
IdPのentityIDやScopeや証明書などのプロパティ値を idp.properties ファイルに設定
entityID や Scope は,インストール時に入力した値で設定されているので, 証明書の設定だけでいいはず.
参照先ディレクトリ(/opt/shibboleth-idp/credentials/)に, サーバ証明書(server.crt)と秘密鍵(server.key)をそれぞれのファイル名でコピー.
また,Tomcat が "tomcat" ユーザで起動されるようになっている場合は, 秘密鍵にアクセス権限をかけるとともに "tomcat" ユーザで参照できるように設定する.
chown root:tomcat /opt/shibboleth-idp/credentials/server.key chmod 640 /opt/shibboleth-idp/credentials/server.key
/opt/shibboleth-idp/conf/idp.properties ファイルを以下のように編集.
idp.signing.key= %{idp.home}/credentials/server.key idp.signing.cert= %{idp.home}/credentials/server.crt idp.encryption.key= %{idp.home}/credentials/server.key idp.encryption.cert= %{idp.home}/credentials/server.ctr
idp.entityID.metadataFile を空にし, entityID を URL としてアクセスした際に /opt/shibboleth-idp/metadata/idp-metadata.xml の内容が返される機能を無効化する.
認証先LDAPの設定
(ldapURL,useStartTLS, baseDN, subtreeSearch, userFilter, bindDN, bindDNCredential idp.authn.LDAP.authenticator = ldapURL idp.authn.LDAP.ldapURL = ldap://ldap01.example.jp ldap://ldap02.example.jp idp.authn.LDAP.useStartTLS = false #idp.authn.LDAP.trustCertificates = %{idp.home}/credentials/ldap-server.crt #idp.authn.LDAP.trustStore = %{idp.home}/credentials/ldap-server.truststore idp.authn.LDAP.baseDN = ou=Poeple,dc=ldap,dc=example,dc=jp idp.authn.LDAP.subtreeSearch = true idp.authn.LDAP.bindDN = cn=ldapProxy,dc=ldap,dc=example.jp idp.authn.LDAP.bindDNCredential = ******
主な設定内容: idp.persistentIdの設定
現状は設定変更していない感じだが...学認の手順どおりに変更しておく
idp.persistentId.sourceAttribute = uid idp.persistentId.salt = *********************** idp.persistentId.encoding = BASE64
主な設定内容: IdPで取り扱う属性情報の設定
属性情報の取得元の設定(LDAP,ComputedID等)
学認のテンプレートと入れ替える
主な設定内容: attribute-resolverで設定した属性情報のうち,送信する属性を各SP毎に設定.
学認のテンプレートと入れ替える