認証方法の変更、設定(証明書による認証)
LDAPを利用したID/パスワード認証の他に、様々な認証方法を利用することが可能です。以下では、クライアント証明書を利用した認証の設定方法を示します。
この例では、
- クライアント証明書を発行するキャンパス認証局のCA証明書=Camp-CA.crt
- クライアント証明書のサブジェクト”o”の値=“Test_University_A”
として設定を行い、クライアント証明書が有効な証明書であり、かつ、上記の条件を満たす場合に認証を行う設定としています。
また、eduPersonPrincipalNameをキーとして、クライアント証明書のサブジェクト“CN”の値によりLDAPから各属性を取得し ます。そのため、クライアント証明書のサブジェクト”CN”の値を、LDAPのeduPersonPrincipalNameに格納しておくことが必要で す。
・/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/attribute-resolver.xmlの変更
クライアント証明書のサブジェクト“CN”の値をSP へ送出する属性edupersonPrincipalNameに設定するため、下記の設定を行います。
※「eduPersonPrincipalName」を検索し、場所を特定してください。
(省略) <resolver:AttributeDefinition xsi:type="ad:Scoped" id="eduPersonPrincipalName" scope="%{idp.scope}" sourceAttributeID="remoteUser"> ←変更
<resolver:Dependency ref="remoteUser" /> ←変更 <resolver:AttributeEncoder xsi:type="enc:SAML1ScopedString"
name="urn:mace:dir:attribute-def:eduPersonPrincipalName" encodeType="false" />
<resolver:AttributeEncoder xsi:type="enc:SAML2ScopedString"
name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" friendlyName="eduPersonPrincipalName" encodeType="false" /> </resolver:AttributeDefinition> (省略) <resolver:AttributeDefinition xsi:type="PrincipalName" xmlns="urn:mace:shibboleth:2.0:resolver:ad" id="remoteUser" /> ←追加
※端末のサイズによっては表記がずれる可能性がございます。画面を広くしてご覧ください。
・/opt/shibboleth-idp/conf/ldap.propertiesの変更
クライアント証明書のサブジェクト"CN"の値をキーにしてLDAPのeduPersonPrincipalNameと比較を行い属性を取得するため、下記の設定を行います。
(省略)
idp.attribute.resolver.LDAP.trustCertificates = %{idp.authn.LDAP.trustCertificates:undefined}
idp.attribute.resolver.LDAP.searchFilter = (eduPersonPrincipalName=$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="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をインストールする