[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[upki-fed:00991] Re: (自己解決) Re: Shibboleth IdP 3.2.0におけるStoredIDの定義について



慶應義塾ITC本部の細川です。

とりあえず、折衷案を取ってテーブルの定義は

CREATE TABLE IF NOT EXISTS shibpid (
  localEntity VARCHAR(255) NOT NULL,
  peerEntity VARCHAR(255) NOT NULL,
  principalName VARCHAR(255) NOT NULL default '',
  localId VARCHAR(255) NOT NULL,
  persistentId VARCHAR(36) NOT NULL,
  peerProvidedId VARCHAR(255) default NULL,
  creationDate timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  deactivationDate timestamp NULL default NULL,
  PRIMARY KEY (localEntity, peerEntity, persistentId),
  KEY persistentId_2 (persistentId, deactivationDate),
  KEY localEntity (localEntity, peerEntity,localId),
  KEY localEntity_2 (localEntity, peerEntity, localId, deactivationDate)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

にしてみました。一応、問題なく動作しているようです。

細川


On 2015/12/17 17:55, Tatsumi Hosokawa wrote:
> 慶應義塾ITC本部の細川です。
> 
> すみません、またしても投稿した直後に自らの間違いに気がついてしまいました。
> 
> 最初、computedIDでテストしていたので、ePTIDの定義の
> 
>      <resolver:AttributeDefinition id="eduPersonTargetedID" xsi:type="SAML2NameID" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
>          nameIdFormat="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
>          sourceAttributeID="computedID">
>          <resolver:Dependency ref="computedID" />
>          <resolver:AttributeEncoder xsi:type="SAML1XMLObject" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>                  name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" />
> 
>          <resolver:AttributeEncoder xsi:type="SAML2XMLObject" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>                  name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" friendlyName="eduPersonTargetedID" />
>      </resolver:AttributeDefinition>
> 
> にcomputedIDが残っていたという問題でした。
> これを修正したところ、きちんとshibpidテーブルにpersistentIDが記録されました。
> 
> とりあえず、3.2.0ではテーブルの定義に以下のプライマリキー定義を足すとうまくstodedIDが使えるようです。
> 
> PRIMARY KEY (localEntity, peerEntity, persistentId)
> 
> 皆様お気をつけ下さい。
> 
> お騒がせして申し訳ありませんでした。
> 
> 細川
> 
> On 2015/12/17 17:46, Tatsumi Hosokawa wrote:
>> 慶應義塾ITC本部の細川です。
>>
>> 現在、テストフェデレーションで学認のIdPのShibolleth 3化実験を行っているのですが、
>> IdP 3.2.0を用いたStoredIDのところで躓いています。
>>
>> とりあえず新しくMySQLサーバを起こして、今までどおり
>>
>> CREATE TABLE IF NOT EXISTS shibpid (
>> localEntity TEXT NOT NULL,
>> peerEntity TEXT NOT NULL,
>> principalName VARCHAR(255) NOT NULL default '',
>> localId VARCHAR(255) NOT NULL,
>> persistentId VARCHAR(36) NOT NULL,
>> peerProvidedId VARCHAR(255) default NULL,
>> creationDate timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
>> deactivationDate timestamp NULL default NULL,
>> KEY persistentId (persistentId),
>> KEY persistentId_2 (persistentId, deactivationDate),
>> KEY localEntity (localEntity(16), peerEntity(16),localId),
>> KEY localEntity_2 (localEntity(16), peerEntity(16), localId, deactivationDate) )
>> ENGINE=MyISAM DEFAULT CHARSET=utf8;
>>
>> でテーブルを作り、attritbute-resolver.xmlで、ComputedIDを無効化し、
>>
>>       <resolver:DataConnector xsi:type="StoredId" xmlns="urn:mace:shibboleth:2.0:resolver:dc"
>>                               id="storedID"
>>                               generatedAttributeID="storedID"
>>                               sourceAttributeID="eduPersonPrincipalName"
>>                               salt="ソルトの値">
>>           <resolver:Dependency ref="myLDAP" />
>>           <ApplicationManagedConnection jdbcDriver="com.mysql.jdbc.Driver"
>>                                         jdbcURL="jdbc:mysql://サーバのIPアドレス:3306/データベース名?autoReconnect=true"
>>                                         jdbcUserName="storedID"
>>                                         jdbcPassword="パスワード" />
>>       </resolver:DataConnector>
>>
>> のエントリを有効化しました(sourceAttributeIDにuidではなくEPPNを使っているのはうちの事情です)。
>>
>> この状態で、認証が成功した後のWebブラウザには次のエラーメッセージが出力されます。
>>
>> opensaml::FatalProfileException
>>
>> The system encountered an error at Thu Dec 17 16:54:46 2015
>>
>> To report this problem, please contact the site administrator at root@localhost.
>>
>> Please include the following message in any email:
>>
>> opensaml::FatalProfileException at (https://test-sp1.gakunin.nii.ac.jp/Shibboleth.sso/SAML2/POST)
>>
>> SAML response reported an IdP error.
>>
>> Error from identity provider:
>>
>> Status: urn:oasis:names:tc:SAML:2.0:status:Responder
>> Message: An error occurred.
>>
>> 実際にはShibboleth起動時に次の警告とエラーがidp-process.logに出ており、
>> そもそもStoredIDの処理が初期化できていないようです。
>>
>> 2015-12-17 16:54:20,364 - WARN [net.shibboleth.idp.saml.nameid.impl.JDBCPersistentIdStoreEx:474] - Stored Id Store: The database was not reachable or was not defined with an appropriate table + primary key
>> java.sql.SQLException: Duplicate insertion succeeded, primary key missing from table
>>           at net.shibboleth.idp.saml.nameid.impl.JDBCPersistentIdStoreEx.verifyDatabase(JDBCPersistentIdStoreEx.java:799)
>> 2015-12-17 16:54:20,373 - INFO [net.shibboleth.ext.spring.context.FilesystemGenericApplicationContext:957] - Closing ApplicationContext:shibboleth.AttributeResolverService: startup date [Thu Dec 17 16:54:19 JST 2015]; parent: Root WebApplicationContext
>> 2015-12-17 16:54:20,440 - ERROR [net.shibboleth.utilities.java.support.service.AbstractReloadableService:181] - Service 'shibboleth.AttributeResolverService': Initial load failed
>> net.shibboleth.utilities.java.support.service.ServiceException: Failed to load [file [/opt/shibboleth-idp/conf/attribute-resolver.xml]]
>>           at net.shibboleth.ext.spring.service.ReloadableSpringService.doReload(ReloadableSpringService.java:344)
>> Caused by: net.shibboleth.utilities.java.support.service.ServiceException: Unable to initialize attribute resolver for ApplicationContext:shibboleth.AttributeResolverService
>>           at net.shibboleth.idp.attribute.resolver.spring.impl.AttributeResolverServiceStrategy.apply(AttributeResolverServiceStrategy.java:74)
>> Caused by: net.shibboleth.utilities.java.support.component.ComponentInitializationException: Attribute Resolver 'ShibbolethAttributeResolver': Plugin 'eduPersonTargetedID' has a dependency on plugin 'computedID' which doesn't exist
>>           at net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl.checkPlugInDependencies(AttributeResolverImpl.java:501)
>>
>> 要するに、
>>
>> java.sql.SQLException: Duplicate insertion succeeded, primary key missing from table
>>
>> と怒られているので、
>>
>> https://wiki.shibboleth.net/confluence/display/IDP30/PersistentNameIDGenerationConfiguration
>>
>> を見て、とりあえず
>>
>> CREATE TABLE shibpid (
>>       localEntity VARCHAR(255) NOT NULL,
>>       peerEntity VARCHAR(255) NOT NULL,
>>       persistentId VARCHAR(50) NOT NULL,
>>       principalName VARCHAR(50) NOT NULL,
>>       localId VARCHAR(50) NOT NULL,
>>       peerProvidedId VARCHAR(50) NULL,
>>       creationDate TIMESTAMP NOT NULL,
>>       deactivationDate TIMESTAMP NULL,
>>       PRIMARY KEY (localEntity, peerEntity, persistentId)
>> );
>>
>> でMySQLのテーブルを作りなおしてみました。すると、idp-process.logは、
>>
>> 2015-12-17 17:14:58,435 - WARN [net.shibboleth.idp.saml.nameid.impl.JDBCPersistentIdStoreEx:782] - Stored Id Store: Duplicate insert failed as required with SQL State '23000', ensure this value is configured as a retryable error
>> 2015-12-17 17:14:58,441 - INFO [net.shibboleth.idp.saml.nameid.impl.JDBCPersistentIdStoreEx:467] - Stored Id Store: Data source successfully verified
>> 2015-12-17 17:14:58,454 - INFO [net.shibboleth.ext.spring.context.FilesystemGenericApplicationContext:957] - Closing ApplicationContext:shibboleth.AttributeResolverService: startup date [Thu Dec 17 17:14:57 JST 2015]; parent: Root WebApplicationContext
>> 2015-12-17 17:14:58,537 - ERROR [net.shibboleth.utilities.java.support.service.AbstractReloadableService:181] - Service 'shibboleth.AttributeResolverService': Initial load failed
>> net.shibboleth.utilities.java.support.service.ServiceException: Failed to load [file [/opt/shibboleth-idp/conf/attribute-resolver.xml]]
>>           at net.shibboleth.ext.spring.service.ReloadableSpringService.doReload(ReloadableSpringService.java:344)
>> Caused by: net.shibboleth.utilities.java.support.service.ServiceException: Unable to initialize attribute resolver for ApplicationContext:shibboleth.AttributeResolverService
>>           at net.shibboleth.idp.attribute.resolver.spring.impl.AttributeResolverServiceStrategy.apply(AttributeResolverServiceStrategy.java:74)
>> Caused by: net.shibboleth.utilities.java.support.component.ComponentInitializationException: Attribute Resolver 'ShibbolethAttributeResolver': Plugin 'eduPersonTargetedID' has a dependency on plugin 'computedID' which doesn't exist
>>           at net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl.checkPlugInDependencies(AttributeResolverImpl.java:
>> 501)
>>
>> のように変化し、とりあえずMySQLのチェックは、
>>
>> Stored Id Store: Duplicate insert failed as required with SQL State '23000', ensure this value is configured as a retryable error
>> Stored Id Store: Data source successfully verified
>>
>> のように成功していますが、それでも結局attribute-resolver.xmlの読み込みは失敗してしまっているようです。
>>
>> やはり、storedIDの記述自体を色々書き換える必要があるのでしょうか。
>> ご存知の方がいらっしゃいましたら、ご教授いただけますでしょうか。
>>
>> よろしくお願いいたします。
>>
> 
> 


-- 
慶應義塾ITC本部  細川達己  xxxxxxxx@xxxxxxxxxxxxxx
Tel. 03-5427-1685  Fax. 03-5427-1722