認証方法の変更、設定(証明書による認証)
LDAPを利用したID/パスワード認証の他に、様々な認証方法を利用することが可能です。以下では、クライアント証明書を利用した認証の設定方法を示します。
この例では、
- クライアント証明書を発行するキャンパス認証局のCA証明書=Camp-CA.crt
- クライアント証明書のサブジェクト”o”の値=“Test_University_A”
として設定を行い、クライアント証明書が有効な証明書であり、かつ、上記の条件を満たす場合に認証を行う設定としています。
・/opt/shibboleth-idp/conf/idp.properties の変更
クライアント証明書を用いた認証のために idp.properties ファイルを変更します。
(省略)
# Regular expression matching login flows to enable, e.g. IPAddress|Password
idp.authn.flows= X509
(省略)
・/etc/httpd/conf.d/ssl.confへの追加(赤文字の個所を追加)
(省略)
<VirtualHost _default_:443>
(省略)
ProxyPass /idp ajp://localhost:8009/idp
<Location /idp/Authn/X509>
SSLCACertificateFile /opt/shibboleth-idp/credentials/Camp-CA.crt
SSLVerifyClient require
SSLVerifyDepth 3
SSLRequireSSL
SSLOptions +ExportCertData +StdEnvVars
SSLUserName SSL_CLIENT_S_DN_CN
SSLRequire %{SSL_CLIENT_S_DN_O} eq "Test_University_A"
</Location>
(省略) </VirtualHost>
・/opt/shibboleth-idp/conf/ldap.propertiesの変更
LDAP から属性を取得する際のキーとなる属性はデフォルトでは uid ですが変更したい場合は下記の場所を変更します。
(省略)
idp.attribute.resolver.LDAP.trustCertificates = %{idp.authn.LDAP.trustCertificates:undefined}
idp.attribute.resolver.LDAP.searchFilter = (uid=$resolutionContext.principal) ←必要に応じて変更
idp.attribute.resolver.LDAP.returnAttributes = cn,homephone,mail (省略)
・/opt/shibboleth-idp/conf/relying-party.xmlの修正
複数の認証手段を使うのでなければ必須ではありませんが、デフォルトの認証手段を指定しておきましょう。
※「DefaultRelyingParty」を検索し、場所を特定してください。
<bean id="shibboleth.DefaultRelyingParty" parent="RelyingParty">
<property name="profileConfigurations">
<list>
(省略)
<bean parent="Shibboleth.SSO" p:defaultAuthenticationMethods="urn:ietf:rfc:2246"/>
(省略)
<bean parent="SAML2.SSO" p:postAuthenticationFlows="attribute-release"
p:defaultAuthenticationMethods="urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient"/>
(省略)
※端末のサイズによっては表記がずれる可能性がございます。画面を広くしてご覧ください。
※Apacheではクライアント証明書が認識されているがその情報がTomcatに伝わっていない場合、/usr/java/tomcat/conf/server.xmlの8009番ポートConnectorにtomcatAuthentication="false"が設定されていることを確認してください。
参考: jdk 7、tomcat 7をインストールする