比較バージョン

キー

  • この行は追加されました。
  • この行は削除されました。
  • 書式設定が変更されました。

認証方法の変更、設定(証明書による認証)

注意

本ページの内容はIdPバージョン2時代のものでありIdPv3では未検証です。
IdPv3での設定方法については、idp.propertiesで
idp.authn.flows= X509

とし、以下のssl.confの設定でパスを/idp/Authn/RemoteUserから /idp/Authn/X509 に変更すれば良い、という情報があります。

LDAPを利用したID/パスワード認証の他に、様々な認証方法を利用することが可能です。以下では、クライアント証明書を利用した認証の設定方法を示します。

...

として設定を行い、クライアント証明書が有効な証明書であり、かつ、上記の条件を満たす場合に認証を行う設定としています。
また、eduPersonPrincipalNameをキーとして、クライアント証明書のサブジェクト“CN”の値によりLDAPから各属性を取得してい また、eduPersonPrincipalNameをキーとして、クライアント証明書のサブジェクト“CN”の値によりLDAPから各属性を取得し ます。そのため、クライアント証明書のサブジェクト”CN”の値を、LDAPのeduPersonPrincipalNameに格納しておくことが必要で す。

 

・/opt/shibboleth-idp/conf/handler.xml の変更(IdPインストール直後の状態に戻す)idp.properties の変更 

クライアント証明書を用いた認証のためにidp.properties クライアント証明書を用いた認証のためにhandler.xml ファイルを変更します。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
(省略)
    <!-- Login Handlers -->
    <!-- --> ←コメントアウトを閉じて、こちらを有効にします
    <LoginHandler xsi:type="RemoteUser">
        <AuthenticationMethod>urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient</AuthenticationMethod>
                     TLSクライアント証明書認証であることをSPに対して明示する↑
    </LoginHandler>
    <!-- --> ←コメントアウト 
    <!--  Username/password login handler -->
 <!-- ← コメントアウト
    <LoginHandler xsi:type="UsernamePassword"
           jaasConfigurationLocation="file:///opt/shibboleth-idp-2.0.0/conf/login.config">
        <AuthenticationMethod>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</AuthenticationMethod>
    </LoginHandler>
    --> ← コメントアウト

...

# Regular expression matching login flows to enable, e.g. IPAddress|Password    
idp.authn.flows= X509
(省略)

 

・/etc/httpd/conf.d/ssl.confへの追加(赤文字の個所を追加)

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
(省略)
(省略) <VirtualHost _default_:443> (省略)
(省略)
ProxyPass /idp ajp://localhost:8009/idp
<Location /idp/Authn/RemoteUser>X509>
  SSLCACertificateFile /opt/shibboleth-idp/credentials/Camp-CA.crt
SSLVerifyClient SSLVerifyClient require
SSLVerifyDepth SSLVerifyDepth 3
SSLRequireSSL SSLRequireSSL
SSLOptions SSLOptions +ExportCertData +StdEnvVars
SSLUserName SSLUserName SSL_CLIENT_S_DN_CN
     SSLRequire SSLRequire %{SSL_CLIENT_S_DN_O} eq "Test_University_A"
</Location>

(省略) (省略) </VirtualHost>

 

・/opt/shibboleth-idp/conf/attribute-resolver.xmlの修正1xmlの変更

また、クライアント証明書のサブジェクト“CN”の値をedupersonPrincipalNameに設定して、これをキーとしてLDAPから属性を取得するため、下記の設定を行います。クライアント証明書のサブジェクト“CN”の値をSP へ送出する属性edupersonPrincipalNameに設定するため、下記の設定を行います。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
※「eduPersonPrincipalName」を検索し、場所を特定してください。  
(省略) <resolver:AttributeDefinition id="eduPersonPrincipalName" xsi:type="ad:Scoped" xmlnsid="urn:mace:shibboleth:2.0:resolver:ad" eduPersonPrincipalName" scope="nii.ac.jp%{idp.scope}" sourceAttributeID="eduPersonPrincipalNameremoteUser">         <resolver ←変更
        <resolver:Dependency ref="remoteUser" /> ←変更           <resolver        <resolver:AttributeEncoder xsi:type="enc:SAML1ScopedString" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"         
name="urn:mace:dir:attribute-def:eduPersonPrincipalName" encodeType="false" />           <resolver
        <resolver:AttributeEncoder xsi:type="enc:SAML2ScopedString" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"         
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/attribute-resolver.xmlの修正2ldap.propertiesの変更

クライアント証明書のサブジェクト"CN"の値をキーにしてLDAPのeduPersonPrincipalNameと比較を行い属性を取得するため、下記の設定を行います。

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
※「LDAP Connector」を検索し、場所を特定してください。
    <!-- Example LDAP Connector -->
    <!-- --> 
    <resolver:DataConnector id="myLDAP" xsi:type="LDAPDirectory" xmlns="urn:mace:shibboleth:2.0:resolver:dc"
        ldapURL="ldap://localhost" baseDN="o=test_o,dc=ac,c=JP" principal="cn=olmgr,o=test_o,dc=ac,c=JP"
        principalCredential="csildap">   
        <FilterTemplate>
            <![CDATA[
                (eduPersonPrincipalName=$requestContext.principalName)  ←変更
            ]]>
        </FilterTemplate>
    </resolver:DataConnector>
    <!-- -->

   ※端末のサイズによっては表記がずれる可能性がございます。画面を広くしてご覧ください。

 

・${CATALINA_HOME}/webapp/idp/WEB-INF/web.xmlへの追加(赤文字の箇所を追加)

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
(省略)
    <!-- Servlet protected by container used for RemoteUser authentication -->
    <servlet>
        <servlet-name>RemoteUserAuthHandler</servlet-name>
        <servlet-class>edu.internet2.middleware.shibboleth.idp.authn.provider.RemoteUserAuthServlet</servlet-class>
        <load-on-startup>3</load-on-startup>

        <init-param>
            <param-name>authnMethod</param-name>
            <param-value>urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient</param-value>
        </init-param>

    </servlet>
(省略)(省略)
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の修正

...

パネル
borderColor#cccccc
bgColor#eeeeee
borderStylesolid
※「DefaultRelyingParty」を検索し、場所を特定してください。
    <rp:DefaultRelyingParty provider="https://idp.example.ac.jp/idp/shibboleth" defaultSigningCredentialRef="IdPCredential" ↑前行の末尾の > の直前で改行し、↓を追加 defaultAuthenticationMethod<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"が設定されていることを確認してください。
参考: jdk6、tomcat6をインストールする jdk 7、tomcat 7をインストールする

参考URL(証明書認証の別実装): https://wiki.shibboleth.net/confluence/display/SHIB2/X.509+Login+Handler