Hadoop のセキュリティを Kerberos で強化しようという動きがあるようだ。記事 参照。そんな記事を読んで、RubyCAS-Server を思い出した。以前に、MOONGIFT が 紹介 していた、http 上で動作する CAS プロトコル が特徴の、SSO システムだ。CAS は結構、大学では使われいるようだ。Ruby ベースだけでなく、色々あるようだが、私は Ruby が好きなので、RubyCAS-Server を試してみようと思う。
QuickStart を参照しながらインストールする。 ruby 1.8.4 以上というのが気にかかる。1.9.2 で動くか。DBMS は MySQL がお薦めのようだが、SQLite を使うことにする。Linux でしかテストしてないそうだが、MOONGIFT 氏が Mac OS X で動くことを確認済なので良しとしよう。で、gem でインストール。
$ sudo gem install rubycas-server
Password:
For more information on RubyCAS-Server, see http://code.google.com/p/rubycas-server
If you plan on using RubyCAS-Server with languages other than English, please cd into the
RubyCAS-Server installation directory (where the gem is installed) and type `rake mo` to
build the LOCALE_LC files.
Successfully installed locale-2.0.5
Successfully installed gettext-2.1.0
Successfully installed markaby-0.7.1
Successfully installed picnic-0.8.1.20100201
Successfully installed rubycas-server-0.7.999999.20100202
5 gems installed
$
取り敢えず問題なし。で次に /usr/bin/rubycas-server を実行しろと書いてあるが、私の開発環境では /usr/local/bin/ruby が使われるので、/usr/local/bin/rubycas-server になる。実行すると、エラーが出て動かない。やはり 1.9 系では動かないか。。
まず問題は activesupport と activerecord のバージョン。3.0.0 では動かないので、バージョンを指定する。rubycas-server はただの Ruby スクリプトなので下記のように修正。
# require 'rubygems'
gem "activesupport", "2.3.8"
gem "activerecord", "2.3.8"
でも今度は camping でエラーが出る。
$ rubycas-server
Loading picnic from rubygems...
DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead. (called from <top (required)> at /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/activesupport.rb:2)
<internal:lib/rubygems/custom_require>:29:in `require': /usr/local/lib/ruby/gems/1.9.1/gems/picnic-0.8.1.20100201/vendor/zuk-camping-2.0.20090429/lib/camping.rb:11: syntax error, unexpected tLABEL (SyntaxError)
p[0]==?/?@root+p:p end;def URL c='/',*a;c=R(c,...
^
何が悪いかわからないが、適当に修正してみる。
p[0]==?/?@root+p : p end;
今度は次のエラー。
/usr/local/lib/ruby/gems/1.9.1/gems/picnic-0.8.1.20100201/vendor/zuk-camping-2.0.20090429/lib/camping.rb:6:in `<class:H>': undefined method `id' for class `Camping::H' (NameError)
undef しようとしている id と type が無いそうなので、削ってみる。
undef id,type;end;
次は end が無いそうなので、end を追加してみる。※行数はオリジナルと違ってる
<internal:lib/rubygems/custom_require>:29:in `require': /usr/local/lib/ruby/gems/1.9.1/gems/picnic-0.8.1.20100201/vendor/zuk-camping-2.0.20090429/lib/camping.rb:60: syntax error, unexpected $end, expecting keyword_end (SyntaxError)
修正して実行してみる。
/usr/local/lib/ruby/gems/1.9.1/gems/picnic-0.8.1.20100201/vendor/zuk-camping-2.0.20090429/lib/camping/reloader.rb:41: warning: undefining `object_id' may cause serious problems
Loading "rubycas-server" code from "/usr/local/lib/ruby/gems/1.9.1/gems/rubycas-server-0.7.999999.20100202"...
Loading configuration for "rubycas-server" from "/etc/rubycas-server/config.yml"...
RUBYCAS-SERVER SERVER HAS NOT YET BEEN CONFIGURED!!!
Attempting to copy sample configuration from '/usr/local/lib/ruby/gems/1.9.1/gems/rubycas-server-0.7.999999.20100202/config.example.yml' to '/etc/rubycas-server/config.yml'...
A sample configuration has been created for you in '/etc/rubycas-server/config.yml'. Please edit this file to suit your needs and then run rubycas-server again.
$
ようやっと動いた。設定が無いそうだ。設定は、Ruby で CAS サーバを試す を参照する。
Loading configuration for "rubycas-server" from "/etc/rubycas-server/config.yml"...
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `rescue in load_missing_constant': uninitialized constant Camping::Models (NameError)
またエラー。上手く行きません。。何が悪いのかなぁ。。