Create: 2014/10/12
LastUpdate: 2014/10/13
≪ メニューに戻るLastUpdate: 2014/10/13
ロードバランサ+OpenAM環境で PolicyAgent を使用したSSOを試してみます。
検証環境(XenServer6.2+CentOS6.5)で使用するドメインは、"blue21.local" とします。
1.シナリオ
ここでは、「 [CentOS6][OpenAM10] ロードバランサのLVS(NAT)でOpenAMを負荷分散する」で構築した下図の環境を使用します。
この環境の 192.168.1.0/24系のサブネットにWEBサーバを1台追加し、Apache+PolicyAgent を入れて、テスト用のWEBサイトを作ることにします。
テスト用WEBサイトのURLは以下とし、このURLにアクセスしたら OpenAM で SSO するようにします。
- http://agent01.blue21.local/
2.Windows の hosts設定
OpenAMの設定や、テスト用WEBサイトへのアクセスには 192.168.1.0/24 系のサブネットにある Windows8 を使用します。
今回は、DNSサーバを用意しないので、テスト用のWEBサイトを Windows8 の hosts に登録します。
192.168.1.82 agent01.blue21.local
3.OpenAM の設定
OpenAMにテスト用WEBサイトに導入するPolicyAgentの情報を登録します。
ブラウザで、以下のURLにアクセスして、exam01 のOpenAM管理画面を開きます。
- http://exam01.blue21.local:8080/openam
[名前]、[パスワード]に任意の値を入力します。
[設定] は、デフォルト値の "集中" を選択します。
[サーバーURL]は、ロードバランサ+OpenAMのURL(http://lvs.blue21.local:8080/openam)を入力します。
[エージェントURL]は、テスト用WEBサイトのURL(http://agent01.blue21.local:80)を入力します。
入力が完了したら、[作成]ボタンをクリックします。
なお、ここで入力した値は、後述のPolicyAgentの設定時に使用します。
下図の画面が表示され、[エージェント]の一覧に新規作成した "apache22-agent01" が表示されます。
"apache22-agent01" をクリックします。
画面を下にスクロールして、[一般] > [SSOのみモード] をチェックします。
今回は、SSO(認証)だけにして、認可はおこなません。
画面を上にスクロールして、[保存]ボタンをクリックします。
4.テスト用WEBサイトの構築
Apacheをインストールしてテスト用のページを作成し、OpenAMのPolicyAgentを導入します。
まず、Apache のパッケージをインストールします。
# yum install httpdApache を起動して、自動起動を ON にします。
# service httpd start # chkconfig httpd onテストページを作成します。
# cat /var/www/html/index.html <html> <head> <title>TEST PAGE</title> </head> <body> <h1>TEST PAGE</h1> <p>This is Test Page !!</p> </body> </html>ブラウザで表示を確認します。
OpenAMのPolicyAgentを導入します。手順は、「 [CentOS6][OpenAM10] OpenAMを試す - OpenAMのシングルサインオン(SSO)を試す(3/4)」と同じです。
Apche を停止します。
# service httpd stop今回は、DNSサーバを用意していないので /etc/hosts にOpenAMとテスト用WEBサイトのFQDNを追加します。
# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.90 lvs.blue21.local # OpenAM 127.0.0.1 agent01.blue21.local # テスト用WEBサイトORACLEのダウンロードサイトからダウンロードした、JDK1.6 をインストールします。
# sh ./jdk-6u45-linux-i586-rpm.binroot ユーザがデフォルトで JDK1.6 を使用するようになっていなければ、 ~/.bashrc にJAVA用の環境変数を設定して JDK1.6 を使用するようにします。
JAVA_HOME=/usr/java/default PATH=${JAVA_HOME}/bin:${PATH}java のバージョンを確認します。
# . ~/.bashrc # java -version java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)forgerock のダウンロードサイトから Apache2.2 用の PolicyAgent をダウンロードし、/opt に解凍します。
# cd /opt # unzip apache_v22_Linux_agent_304.zipパスワードファイルを作成します。ここで使用するパスワードは、上記3で設定した値です。
# cd /opt/web_agents/apache22_agent # echo -n "password" > pass.txtPolicyAgent の インストーラを実行します。
# cd /opt/web_agents/apache22_agent # ./bin/agentadmin --install Please read the following License Agreement carefully: [Press <Enter> to continue...] or [Enter n To Finish] n Do you completely agree with all the terms and conditions of this License Agreement (yes/no): [no]: yes ************************************************************************ Welcome to the OpenSSO Policy Agent for Apache Server. ************************************************************************ Enter the complete path to the directory which is used by Apache Server to store its configuration Files. This directory uniquely identifies the Apache Server instance that is secured by this Agent. [ ? : Help, ! : Exit ] Enter the Apache Server Config Directory Path [/opt/apache22/conf]: /etc/httpd/conf Enter the URL where the OpenSSO server is running. Please include the deployment URI also as shown below: (http://opensso.sample.com:58080/opensso) [ ? : Help, < : Back, ! : Exit ] OpenSSO server URL: http://lvs.blue21.local:8080/openam Enter the Agent URL as shown below: (http://agent1.sample.com:1234) [ ? : Help, < : Back, ! : Exit ] Agent URL: http://agent01.blue21.local:80 Enter the Agent profile name [ ? : Help, < : Back, ! : Exit ] Enter the Agent Profile name: apache22-agent01 Enter the path to a file that contains the password to be used for identifying the Agent. [ ? : Help, < : Back, ! : Exit ] Enter the path to the password file: /opt/web_agents/apache22_agent/pass.txt ----------------------------------------------- SUMMARY OF YOUR RESPONSES ----------------------------------------------- Apache Server Config Directory : /etc/httpd/conf OpenSSO server URL : http://lvs.blue21.local:8080/openam Agent URL : http://agent01.blue21.local:80 Agent Profile name : apache22-agent01 Agent Profile Password file name : /opt/web_agents/apache22_agent/pass.txt Verify your settings above and decide from the choices below. 1. Continue with Installation 2. Back to the last interaction 3. Start Over 4. Exit Please make your selection [1]: <ENTER> Creating directory layout and configuring Agent file for Agent_001 instance ...DONE. Reading data from file /opt/web_agents/apache22_agent/pass.txt and encrypting it ...DONE. Generating audit log file name ...DONE. Creating tag swapped OpenSSOAgentBootstrap.properties file for instance Agent_001 ...DONE. Creating a backup for file /etc/httpd/conf/httpd.conf ...DONE. Adding Agent parameters to /opt/web_agents/apache22_agent/Agent_001/config/dsame.conf file ...DONE. Adding Agent parameters to /etc/httpd/conf/httpd.conf file ...DONE. SUMMARY OF AGENT INSTALLATION ----------------------------- Agent instance name: Agent_001 Agent Bootstrap file location: /opt/web_agents/apache22_agent/Agent_001/config/OpenSSOAgentBootstrap.properties Agent Configuration Tag file location /opt/web_agents/apache22_agent/Agent_001/config/OpenSSOAgentConfiguration.properties Agent Audit directory location: /opt/web_agents/apache22_agent/Agent_001/logs/audit Agent Debug directory location: /opt/web_agents/apache22_agent/Agent_001/logs/debug Install log file location: /opt/web_agents/apache22_agent/installer-logs/audit/install.log Thank you for using OpenSSO Policy AgentApache を起動します。
# service httpd start
5.動作確認
テスト用WEBサイトにアクセスしてSSOできるか確認します。
ブラウザで以下のURLにアクセスします。
- http://agent01.blue21.local/index.html
demo ユーザでログインします。
下図のようにテスト用WEBサイトが表示されたらSSO成功です。
ロードバランサの状態を見ると以下のとおり。exam01 と exam02 の両方で負荷分散しています。
# ipvsadm -ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.1.90:8080 rr -> 10.0.0.93:8080 Masq 10 2 30 -> 10.0.0.94:8080 Masq 10 1 31