しょんぼり技術メモ

まいにちがしょんぼり

DSとしてShule-aroonを使う

@repeatedly謹製のDS(Discovery Service)である、Shule-aroonを使ってみたメモ。

インストール

環境はCentOS5.4。SPとして動作させているサーバ上にDSを構築。

  • gitをインストーる。

http://brass.to/blog/yum_dag.htmlを参考にしてdagレポジトリを登録しておいて、yumで入れる。

# yum install git
  • ruby, gemをインストーる。
  • Ramaze, localeをインストーる。
# gem install ramaze
============================================================

Thank you for installing Ramaze!
You can now do create a new project:
# ramaze create yourproject

============================================================
Successfully installed rack-1.1.0
Successfully installed innate-2010.01
Successfully installed ramaze-2010.01
3 gems installed
Installing ri documentation for rack-1.1.0...
Installing ri documentation for innate-2010.01...
Installing ri documentation for ramaze-2010.01...
Installing RDoc documentation for rack-1.1.0...
Installing RDoc documentation for innate-2010.01...
Installing RDoc documentation for ramaze-2010.01...

# gem install locale
Successfully installed locale-2.0.5
1 gem installed
Installing ri documentation for locale-2.0.5...
Installing RDoc documentation for locale-2.0.5...
  • ramaze用のディレクトリを作って移動。今回は /var/ramaze にする
# cd /var
# mkdir ramaze
# cd ramaze/
  • Shule-aroonのファイル群を持ってくる
# git clone git://github.com/repeatedly/shule-aroon.git
Initialized empty Git repository in /var/ramaze/shule-aroon/.git/
remote: Counting objects: 321, done.
CompressingIndexing 321 objects...)   /282)
Compressing objects: 100% (282/282), done.remote: ne
remote: Total 321 (delta 154), reused 0 (delta 0)
 100% (321/321) done
Resolving 154 deltas...
 100% (154/154) done

# ll
total 16
drwxr-xr-x  3 root root 4096 Feb 10 17:29 ./
drwxr-xr-x 25 root root 4096 Feb 10 17:28 ../
drwxr-xr-x 11 root root 4096 Feb 10 17:29 shule-aroon/
  • Shule-aroonを起動
# cd shule-aroon
# ruby ./start.rb
D [2010-02-10 17:47:38 $3064] DEBUG | : Using webrick
I [2010-02-10 17:47:38 $3064]  INFO | : WEBrick 1.3.1
I [2010-02-10 17:47:38 $3064]  INFO | : ruby 1.8.5 (2006-08-25) [i386-linux]
D [2010-02-10 17:47:38 $3064] DEBUG | : TCPServer.new(0.0.0.0, 7000)
D [2010-02-10 17:47:38 $3064] DEBUG | : Rack::Handler::WEBrick is mounted on /.
I [2010-02-10 17:47:38 $3064]  INFO | : WEBrick::HTTPServer#start: pid=3064 port=7000
  • つないでみる
# w3m http://127.0.0.1:7000/

Logo

Bad request!

Request parameters are different from SAML.

Require parameters are following.

  • MUST
       □ entityID
  • MAY
       □ return
        □ policy
         □ returnIDParam
          □ isPassive

Please contact administrator if display this page in an orderly manner.

Contact Information

Admin admin
Mail  root@localhost

Test Federation org
  • 動作確認おk。start.rbを殺して設定を行う。

設定

設定は conf/*.yaml で。

まずはds.yaml。DS自身の情報とか設定とか。

# Refer to conf/README.markdown

:handler: :webrick ←どのWebサーバを使うかの設定。rack。
:port:    7000 ←listenするポート番号

:common_domain: null ←特定の共通ドメインを持つような場合に設定するらしい。nullでOK
:expires:       31536000 ←Cookieの有効期間

:admin: 'admin' ←管理者名
:mail:  'root@localhost' ←管理者の連絡先

:fed_name: 'Test Federation org' ←フェデレーション名
:fed_link: 'http://www.example.com/' ←フェデレーションのURL

IdP/SPはidp.yaml/sp.yamlで設定するが、metadataからyamlを生成するツールが用意されているのでありがたく使わせてもらう。

# cd metadata
# rm Example_Federation.xml
# cp path/to/metadata.xml .
# cd ../tools/
# ruby ./m2p.rb

※これで ../conf/(idp|sp).xml に反映される

SPの設定

shibboleth2.xmlのSessionInitiatorで設定。

<SessionInitiator type="Chaining" Location="/DS" id="DS" relayState="cookie">
    <SessionInitiator type="SAML2" defaultACSIndex="1" template="bindingTemplate.html"/>
    <SessionInitiator type="Shib1" defaultACSIndex="5"/>
    <SessionInitiator type="SAMLDS" URL="http://example.com:7000/"/>
</SessionInitiator>

これでOK。

DS設定したSPにアクセスすると、こんな画面になる。ドロップダウンから選択して「送信」すると、選択されたIdPに飛ぶ。

ね、簡単でしょ?