慶應義塾ITC本部の細川です。
昨日、オープンソース・ソリューション・テクノロジの相本様とやりとりさせていただいた件の続きです。
Filter Per SP (FPSP)
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=12158554
では、IdP側で属性条件に従い、SPへの情報送信を禁止できましたが、この属性条件に利用できるのは、
SPに送信される属性情報だけでした。
ところが、当方の要件としては、
「教職員が学生向けDreamSparkを利用しようと思えばできてしまうのを、禁止してほしい」
というものがあったのですが、DreeamSparkはePTIDのみの送信のため、
現在あるFPSPでは教職員の利用を制限できません。
ということで、簡単な改造で、SPに送信しない属性を条件にFPSPを利用できないかと思って調べてみたのですが、
(見た感じひどい方法ですが)あっさりできたのでパッチを添付します。
このやり方で問題はないか、あるいはより良い方法はあるかなど、ご意見をいただけると幸いです。
ちなみにパッチは昨日の相本様によるFPSPのバグ修正のパッチと、エラーメッセージ表示に関する私のパッチを含んでいます。
利用には、attribute-filter.xmlにダミーのエントリーを置きます。
<!-- Dummy Policy -->
<afp:AttributeFilterPolicy id="PolicyforDummySP" xmlns:afp="urn:mace:shibboleth:2.0:afp">
<afp:PolicyRequirementRule xsi:type="basic:AttributeRequesterString" value="https://dummy.itc.keio.ac.jp/shibboleth-sp" />
<afp:AttributeRule attributeID="eduPersonPrincipalName">
<afp:PermitValueRule xsi:type="basic:ANY" />
</afp:AttributeRule>
<afp:AttributeRule attributeID="eduPersonAffiliation">
<afp:PermitValueRule xsi:type="basic:ANY" />
</afp:AttributeRule>
<afp:AttributeRule attributeID="gakuninScopedPersonalUniqueCode">
<afp:PermitValueRule xsi:type="basic:ANY" />
</afp:AttributeRule>
</afp:AttributeFilterPolicy>
この例では、ePPN、Affiliation、gakuninScopedPersonalUniqueCodeを送信するように指定していますが、
実際にはこのSP https://dummy.itc.keio.ac.jp/shibboleth-sp は存在しません。メタデータも不要です。
ここで指定した属性を、他のSPへのフィルタに利用可能です。
そこで、SampleFilterPerSP_allow.xmlに次のように設定します(DTDも変更しています)。
せっかくなので、無用に外部に送りたくないことナンバーワンの危険そうな属性として、
gakuninScopedPersonalUniqueCodeを条件に利用してみます。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE EntitiesDescriptor [
<!ELEMENT EntitiesDescriptor (DummySP?, EntityDescriptor+)>
<!ELEMENT DummySP (#PCDATA)>
<!ELEMENT EntityDescriptor (Attribute+)>
<!ELEMENT Attribute (#PCDATA)>
<!ATTLIST EntityDescriptor entityID CDATA #REQUIRED>
<!ATTLIST Attribute attributeID CDATA #REQUIRED>
]>
<EntitiesDescriptor>
<DummySP>
https://dummy.itc.keio.ac.jp/shibboleth-sp
</DummySP>
<EntityDescriptor entityID="https://testsp1.itc.keio.ac.jp/shibboleth-sp">
<Attribute attributeID="gakuninScopedPersonalUniqueCode">
<!-- XXXXXXは私の個人番号 -->
staff:xxxxxx@xxxxxxxxxx
</Attribute>
</EntityDescriptor>
</EntitiesDescriptor>
この<DummySP/>の部分に、先ほどのダミーSPのentityIDを設定します。
FPSPプラグインは属性を調べに行く時にのみ、このダミーSPにアクセスすることを仮定して、
属性を取得します。
フィルタの設定は、entityIDが https://testsp1.itc.keio.ac.jp/shibboleth-sp のSPに対して、
gakuninScopedPersonalUniqueCode が staff:xxxxxx@xxxxxxxxxx の時にのみアクセスさせることを設定しています。
ちなみに、attribute-filter.xmlでは、この https://testsp1.itc.keio.ac.jp/shibboleth-sp に対して、
<!-- Policy for testsp1 -->
<afp:AttributeFilterPolicy id="PolicyforTestsp1" xmlns:afp="urn:mace:shibboleth:2.0:afp">
<afp:PolicyRequirementRule xsi:type="basic:AttributeRequesterString" value="https://testsp1.itc.keio.ac.jp/shibboleth-sp" />
<afp:AttributeRule attributeID="eduPersonPrincipalName">
<afp:PermitValueRule xsi:type="basic:ANY" />
</afp:AttributeRule>
<afp:AttributeRule attributeID="eduPersonAffiliation">
<afp:PermitValueRule xsi:type="basic:ANY" />
</afp:AttributeRule>
</afp:AttributeFilterPolicy>
と設定されており、eppnとunscoped-affiliationのみを送ることとなっており、
gakuninScopedPersonalUniqueCodeを送る設定はありません。
この状態で、IdPを起動すると、catalina.outには、
SampleFilterPerSP DummySP:https://dummy.itc.keio.ac.jp/shibboleth-sp
SampleFilterPerSP config-key-value:
SampleFilterPerSP https://testsp1.itc.keio.ac.jp/shibboleth-sp : {gakuninScopedPersonalUniqueCode=[staff:xxxxxx@xxxxxxxxxx]}
と初期化されます。このSPに私がアクセスすると、
SampleFilterPerSP spEntityId = https://testsp1.itc.keio.ac.jp/shibboleth-sp
SampleFilterPerSP checked gakuninScopedPersonalUniqueCode=staff:xxxxxx@xxxxxxxxxx
ということで、アクセスが許可されます。
なお、一応IdPとSP双方でgakuninScopedPersonalUniqueCodeの送受信を許可するように設定し、
SP側に伝わることを確認した上で、再度IdP側のattribute-filter.xmlでのみ、
gakuninScopedPersonalUniqueCodeの送信を禁止することで、
FPSPの判断にのみgakuninScopedPersonalUniqueCodeが利用されているが、
SPにはgakuninScopedPersonalUniqueCodeの情報が伝わっていないことはテスト済みです。
これで、元のDreamSparkを教職員に使わせないという要件は、無事に解決できそうです。
判断ルーチンをちょっと改造するだけで正規表現とかもいけそうですが、
とりあえずこの方法で問題がないかなどを検討してからにしたいと思います。
よろしくお願いします。
--
慶應義塾ITC本部 細川達己 xxxxxxxx@xxxxxxxxxxxxxx
Tel. 03-5427-1685 Fax. 03-5427-1722Attachment:
SampleFilterPerSP-3.zip
Description: Zip archive