C-limber's highへようこそ。
C-limber's highは山登りのサイトではなく、福岡システム開発WEB制作会社 C-limber(クライマー)株式会社の技術メモブログです。
福岡システム開発ホームページ制作をお探しの方はお気軽にご相談下さい。

2016年4月15日金曜日

[shibboleth]シボレスのSPを設定する

15:04 Posted by Unknown , No comments
こんにちは!

エンジニアの井口です。

学校でwebシステムを作る時など、
既存のID,パスワードでログインできないか??

そのようなご要望を多く頂きます。
その時よく聞くソフトウェアの名前はshibboleth(シボレス)。
一つのアカウントで複数のサービスへのログインを可能にする、
SSO(シングルサインオン)を実現するオープンソースのソフトウェアです。
Shibboleth


シボレスにはIdPとSPの認証する側、される側とあるのですが、
大体、shibbolethを導入しようとする大きな組織はIdPを自身で持っているか、
大きなIdPサービスに登録して利用しています。

ですので、案件で求められるのは、SPの設定というふうになります。


SPの設定方法

英語だけど公式サイトを見る

日本語のサイトもありますが、情報が古かったり、特殊な例だったりしますので・・・
NativeSPLinuxInstall - Shibboleth 2 - Confluence

SELinuxがOnだとインストールに失敗します。(インストール時のみ)
$ getenforce
Enforcing
$ sudo setenforce 0
$ getenforce
Permissive
PermissiveになっていればOK


インストール前の設定

NTPをインストール(インストールされていればOK)


CentOSが32bitか64bitか調べる。

$ uname -a
Linux hogehoge_host ____________.x86_64 #1 ____________ x86_64 x86_64 x86_64 GNU/Linux
今回は64bitです。
(yumでインストールする場合、分岐するので必ず調べる)


yumする前にリポジトリ追加

http://download.opensuse.org/repositories/security://shibboleth/
↑上記サイトで、該当OSを選択し、security:shibboleth.repoをwgetする
$ wget http://download.opensuse.org/repositories/security://shibboleth/CentOS_7/security:shibboleth.repo
$ ls
security:shibboleth.repo
$ sudo cp security\:shibboleth.repo /etc/yum.repos.d/shibboleth.repo

mod_sslをインストール

$ sudo yum install mod_ssl

Install via RPM(yum)

注意点

32bitか64bitか調べた上でyumすること
これについては日本語サイトには書いていない
$ sudo yum install shibboleth.x86_64
いろいろインストール・設定してくれている(以下本家サイトから抜粋)
- Shibboleth configuration files will be placed at /etc/shibboleth/ and the necessary Apache configuration in /etc/httpd/conf.d/shib.conf
- shibd will be installed to /usr/sbin and may be managed using /sbin/service and /sbin/chkconfig
- An appropriate version of mod_shib and other pluggable modules will be installed to /usr/lib/shibboleth/
- Logs will be located in /var/log/httpd/native.log and /var/log/shibboleth


公式サイトに沿って設定

◯In httpd.conf:
UseCanonicalName On
Ensure that the ServerName directive is properly set, and that Apache is being started with SSL enabled.
◯Restart Apache.
◯/usr/sbin/shibd must be independently started and run in order to handle requests. The daemon should be loaded and monitored along with all other major services.
◯Restart shibboleth
/sbin/service shibd start
◯By default, the Shibboleth module is configured to log information on behalf of Apache to /var/log/httpd/native.log
◯shibd creates its own separate logs at /var/log/shibboleth
$ cd /etc/httpd/conf
$ sudo vi httpd.conf
+# 追記
+UseCanonicalName On

$ cd /etc/httpd/conf.d
$ sudo vi ssl.conf
-ServerName www.example.com:443
+ServerName ____your.domain____:443

$ sudo service httpd restart
Redirecting to /bin/systemctl restart  httpd.service

$ sudo /sbin/service shibd start
Redirecting to /bin/systemctl start  shibd.service


shibbolethのログを確認するには

ここが詳しいです。
SPセッティング - GakuNinShibInstall - meatwiki
/var/log/shibboleth/{shibd.log, shibd_warn.log}
  SPに関する、SAML関連、Metadata関連、セキュリティ関連のログです。通常は、こちらのログを参照ください。

/var/log/shibboleth-www/{native.log, native_warn.log}
  Apacheモジュールmod_shibのログです。shidb.logでは情報が足りない場合は、こちらのログを参照ください。
  (SP 2.5.3およびそれ以前からアップデートして使っている場合は/var/log/httpd/以下に出力されている場合、もしくは出力に失敗している場合があります。最新版にアップデート後 /etc/shibboleth/native.logger.dist を参考にして出力先を上記に変更してください。)

/var/log/shibboleth/transaction.log
  SPのトランザクションに関するログです。セッションの開始や終了、属性等が含まれます。
なお、これらログファイルに関する設定は、/etc/shibboleth/{shibd.logger , native.logger} にあります。



Shibboleth SPの設定(xmlの設定)

xmlの設定については接続するIdPにより癖が随分違う(と思う)

ポイントと思うのは

---------------
☆example-shibboleth2.xmlというファイルがイントール後に/etc/shibbolethの中にある。
これをコピーして作成すること。
そうしないと、
「SAML 2.0 ACS endpointのエラーどーちゃらこーちゃら」がでて全く進めなくなる。
上記エラーは、
系の設定の記述が無いということらしいので、
example-shibboleth2.xmlから作成という流れ
---------------
shibboleth2.xmlを変更したら、shibdとapacheの両方をリスタート!
---------------



ログイン後にエラーがでたら・・・

2016-03-30 15:05:23 WARN Shibboleth.SSO.SAML2 [25]: found encrypted assertions, but no CredentialResolver was available
2016-03-30 15:05:23 ERROR Shibboleth.SSO.SAML2 [25]: failed to decrypt assertion: No CredentialResolver supplied to provide decryption keys.
SSLのキーは暗号化してあると読み込めない!
形式を変更すればOK。
$ sudo openssl rsa -text -in キーファイル名
これをshibboleth2.xmlに記載してapache, shibboleth再起動




↓↓引き続き募集中です(^^)

弊社ではシステム開発、Web制作, Iot案件など幅広く対応しております。
ビジネスプランをお持ちの方、WEBアプリを使って何か新しいビジネスを始めたい方、
僕達が力になれるかもしれません
是非お問い合わせ下さい
-----------------------------------------------
同時に、デザイナ、エンジニア、コーダの方募集中です。
サーバ周りからデザイン、システムまでワンストップでの開発を経験できますので、
WEB開発の事を学びたい方にぴったりな職場だと思っております。
またそういった向上心あふれる方と一緒に成長してきたいと思っておりますので、
興味を持たれた方はとりあえずご連絡下さい(^^)
-----------------------------------------------
福岡のシステム開発・Web制作 C-limber(クライマー)株式会社


0 コメント:

コメントを投稿