比較バージョン

キー

  • この行は追加されました。
  • この行は削除されました。
  • 書式設定が変更されました。
添付ファイル

...

CD内のtiqrshib20130329.tar.gzを利用したtiqrshibのインストールについて。

...

以下では、Shibboleth

...

IdP(ID、パスワード認証)が動作している環境へのインストール手順として記述しています。

...

  1. Shibboleth SPをインストール、設定
  2. TiqrShibを配置(CDのtar.gzの解凍)

...

  1. 関連ライブラリを配置
  2. ライブラリのバグ修正
  3. Apacheの設定
  4. ShibbolethへのTiqrShibハンドラー設定
  5. TiqrShibの初期値設定

...

1. Shibboleth SPをIdPサーバにインストール、設定

Tiqr登録時のID,パスワード認証用。IdPでは、フェデレーションとは別の、単独のメタデータとして設定。SPには、このIdPのメタデータのみを設定。

2. TiqrShibを配置

CDのtar.gzを解凍して、

解凍ディレクトリ内のtiqrzenddemoを/var/tiqrzenddemo  に配置。
解凍ディレクトリ内のvar/www/html/TiqrShibを/var/www/html/TiqrShibに配置(trans.phpの配置)。

...

3.

...

関連ライブラリを配置

...

下記をダウンロードして配置

アプリケーション

バージョン

ダウンロードサイト

Tiqr-library

1.0.0

...

...

Tiqr-zendframework

...

1.0.0

...

...

ZendFramework

1.12.2-minimal

...

 

phpqrcode

1.1.4

 

コード ブロック
 | |




{code}
mkdir /var/www/library
cp -rf tiqr-server-library-1.0.0/library/tiqr /var/www/library/libTiqr
cp -rf tiqr-server-zendframework-1.0.0/library/tiqr-zf /var/www/library/tiqr-zf
cp -rf phpqrcode /var/www/library/phpqrcode
ZendFramework-1.12.1-minimalを/usr/shareに展開して、
ln -s ZendFramework-1.12.1-minimal ZendFramework
{code}
【ライブラリ リンク作成】=>作業報告書P24
\

【ライブラリ リンク作成】=>作業報告書P24
(*)

...

上記はリンクでなく、直接でもよいです。

...


【library設定】=>作業報告書P21

4.

...

ライブラリのバグ修正

...

【ZendFramework修正】=>作業報告書P23

/usr/share/ZendFramework/library/Zend/View/Helper/Placeholder/Container/Abstract.php

...

に以下を追記

{
コード ブロック
}
/**
    * Sort the array by key
    *
    * @return array
    */
    public function ksort()
    {
        $items = $this->getArrayCopy();
        return ksort($items);
    }
{code}

h3. 

【Tiqr,Tiqr-zf修正】=>作業報告書P25-P30(P28はTiqrShibに反映済み)

...

/var/www/library/tiqr-zf/Tiqr/Resource/Tiqr.php

...

修正(25ページ)

コード ブロック



{code}
# require_once "Tiqr/Server.php";
require_once "Tiqr/Service.php";
{code}

/var/www/library/tiqr-zf/Tiqr/Controller/Login/Abstract.php

...

修正(26ページ)

{
コード ブロック
}
# case Tiqr_Server::AUTH_RESULT_AUTHENTICATED:
case Tiqr_Service::AUTH_RESULT_AUTHENTICATED:
# case Tiqr_Server::AUTH_RESULT_INVALID_CHALLENGE:
case Tiqr_Service::AUTH_RESULT_INVALID_CHALLENGE:
# case Tiqr_Server::AUTH_RESULT_INVALID_REQUEST:
case Tiqr_Service::AUTH_RESULT_INVALID_REQUEST:
# case Tiqr_Server::AUTH_RESULT_INVALID_RESPONSE:
case Tiqr_Service::AUTH_RESULT_INVALID_RESPONSE:
# case Tiqr_Server::AUTH_RESULT_INVALID_USERID:
case Tiqr_Service::AUTH_RESULT_INVALID_USERID:
{code}

/var/www/library/libTiqr/Tiqr/Random.php

...

追記(27ページ)

{
コード ブロック
}
(public static function randomBytes($length)以下に追記)
   $strong = false;
   $rnd = "";
{code}

/var/tiqrzenddemo/application/configs/application.ini

...

修正および追記(28ページ:提供コードで修正済)

     ・修正箇所

コード ブロック


     ・修正箇所

{code}
# resources.tiqr.identifier = "zeus.local"
resources.tiqr.identifier = "vm2.peofiamp.nii.ac.jp"
# resources.tiqr.name = "Zeus"
resources.tiqr.name = "vm2"
# resources.tiqr.auth.protocol = "surfauth"
resources.tiqr.auth.protocol = "tiqrauth"
# resources.tiqr.logoUrl  = "http://zeus.local/img/surfmedia-logo.png"
resources.tiqr.logoUrl  = "https://vm2.peofiamp.nii.ac.jp/icons/GakuNin_logo.png"
# resources.tiqr.session.secret = "enter something truly random here, preferably generated using openssl"
resources.tiqr.session.secret = "0124567abcdefgh"
{code}
 &

     ・追記箇所

コード ブロック

# nbsp;   ・追記箇所

{code}
# (resources.tiqr.userstorage.path = "/tmp" 以下に追記)
resources.tiqr.ocra.suite = "OCRA-1:HOTP-SHA1-6:QH10"
resources.log.stream.writerName = "Stream"
resources.log.stream.writerParams.stream = APPLICATION_PATH "/logs/application_" DATESTAMP ".log"
resources.log.stream.writerParams.mode = "a"
resources.log.stream.filterName = "Priority"
resources.log.stream.filterParams.priority = 7
{code}

/var/tiqrzenddemo/application/modules/v1/views/scripts/login/index.phtml

...

修正(29ページ)

{
コード ブロック
}
# $this->headScript()->prependFile($this->baseURL().'/scripts/jquery.js')
$this->headScript()->prependFile($this->baseUrl().'/scripts/jquery.js')
{code}

/var/tiqrzenddemo/library/tiqr-zf/Tiqr/Controller/Enroll/Abstract.php

...

修正(30ページ)

{
コード ブロック
}
# $this->view->enrollmentURL = $this->_getTiqr()->generateEnrollmentURL($metadataURL);
$this->view->enrollmentURL = $metadataURL;
{code}

h2. 

5.

...

Apacheの設定

...

<httpd.conf>
追記:

コード ブロック

追記:


{code}
Alias /tiqr/ "/var/tiqrzenddemo/public/"
{code}

<ssl.conf>

追記:

コード ブロック



追記:


{code}
<Location /tiqr>
       RewriteEngine On
       RewriteBase /tiqr
       RewriteCond %{REQUEST_FILENAME} -s [OR]
       RewriteCond %{REQUEST_FILENAME} -l [OR]
       RewriteCond %{REQUEST_FILENAME} -d
       RewriteRule ^.*$ - [NC,L]
       RewriteRule ^.*$ /tiqr/index.php [NC,L]
</Location>
{code}

【.htacsess設定】=>作業報告書P22

...

/var/tiqrzenddemo/public/.htaccessの以下を削除

{
コード ブロック
}
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
{code}

h2. 

6.

...

ShibbolethへのTiqrShibハンドラー設定

...

CDのtiqrshibAuthn.javaをコンパイルして、tiqrshibAuthn.classを作成。

...


  /usr/java/tomcat/webapps/idp/WEB-INF/classes/を作成して配置。

...


コンパイルは、こんな感じです;

{
コード ブロック
}
javac -classpath /usr/java/tomcat/lib/servlet-api.jar:/root/shibIdP230/shibboleth-identityprovider-2.3.0/lib/shibboleth-common-1.3.0.jar:/root/shibIdP230/shibboleth-identityprovider-2.3.0/lib/shibboleth-identityprovider-2.3.0.jar:/root/shibIdP230/shibboleth-identityprovider-2.3.0/lib/shibboleth-jce-1.1.0.jar:/root/shibIdP230/shibboleth-identityprovider-2.3.0/lib/slf4j-api-1.6.1.jar:/root/shibIdP230/shibboleth-identityprovider-2.3.0/lib/openws-1.4.2.jar:/root/shibIdP230/shibboleth-identityprovider-2.3.0/lib/xmltooling-1.3.2.jar tiqrshibAuthn.java
{code}

web.xmlとhandler.xmlの設定。=>作業報告書P38,P39

...


(*)

...

handler.xmlでの設定は、UserPasswordハンドラーを残したままで、(つまり、コメントアウトしないで、)追加して下さい。

...

/usr/java/tomcat/webapps/idp/WEB-INF/web.xmlを修正。

{
コード ブロック
}
<!-- Servlet protected by container used for TiqrShib authentication -->
    <servlet>
        <servlet-name>TiqrShibAuthHandler</servlet-name>
        <servlet-class>tiqrshibAuthn</servlet-class>
            <init-param>
                 <param-name>authnMethod</param-name>
                 <param-value>urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorContract</param-value>
            </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>TiqrShibAuthHandler</servlet-name>
        <url-pattern>/Authn/TiqrShib</url-pattern>
    </servlet-mapping>
{code}

idpのhandler.xmlに下記を設定。

{
コード ブロック
}
<ph:LoginHandler xsi:type="ph:ExternalAuthn"
                     externalAuthnPath="/Authn/TiqrShib" >
         
    <ph:AuthenticationMethod>urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorContract</ph:AuthenticationMethod>
</ph:LoginHandler>
{code}

h3. 【Shib設定】

h4. 

【Shib設定】

(1)

...

IdPの設定

...

・Username/PasswordHandlerをデフォルトにする設定。

...


/usr/java/tomcat/webapps/idp/WEB-INF/web.xmlに下記を追記。

コード ブロック



{code}
    <!-- Servlet for doing Username/Password authentication -->
    <servlet>
        <servlet-name>UsernamePasswordAuthHandler</servlet-name>
        <servlet-class>edu.internet2.middleware.shibboleth.idp.authn.provider.UsernamePasswordLoginServlet</servlet-class>
            <init-param>
                 <param-name>authnMethod</param-name>
                 <param-value>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</param-value>
            </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>
{code}

relying-party.xmlに下記を設定。

{
コード ブロック
}
<rp:DefaultRelyingParty provider="https://IdPサーバ/idp/shibboleth"
                         defaultSigningCredentialRef="IdPCredential"
                         defaultAuthenticationMethod="urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport">
{code}

h4. 

(2)

...

IdPサーバのSPの設定

...

shibboleth2.xmlへのSessionInitiator追加

コード ブロック



{code}
            <!-- Special SessionInitiator for Tiqr!!! -->
            <SessionInitiator type="SAML2" Location="/TiqrShib" id="siid1" entityID="https://simptest2.nec.test/idp/shibboleth" template="bindingTemplate.html" authnContextClassRef="urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport" />
{code}

/etc/httpd/conf.d/shibd.confへの追加

コード ブロック



{code}
<Location /TiqrShib>
  AuthType shibboleth
  ShibRequestSetting requireSessionWith siid1
  require valid-user
</Location>
{code}

h4. 

(3)

...

SPの設定(Tiqr認証を要求するIdPサーバとは別のSPの設定)

...

SessionInitiatorで、="urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorContract"を設定する。

コード ブロック



{code}
            <SessionInitiator type="Chaining" Location="/DS" isDefault="true" id="tiqrshiblogin" authnContextClassRef="urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorContract">
               <SessionInitiator type="SAML2" template="bindingTemplate.html"/>
               <SessionInitiator type="Shib1"/>
               <SessionInitiator type="SAMLDS" URL="https://DSサーバ/ds/WAYF"/>
            </SessionInitiator>
{code}


h2. 

7.

...

TiqrShibの初期値設定

...

application/Bootstrap.phpに初期値読み込みを設定。(=>作業報告書P34)

コード ブロック



{code}
<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    // retrieve tiqrshib constants
    protected function _initConstants()
    {
        $options = $this->getOption('constants');

        if (is_array($options)) {
            foreach($options as $key => $value) {
                if(!defined($key)) {
                    define($key, $value);
                }
            }
        }
    }


    protected function _initLogger() {

         $this->bootstrap("log");
         $logger = $this->getResource("log");
         Zend_Registry::set("logger", $logger);
     }

}
{code}
\

(*)

...

CDのtiqrshibコードには、ログ出力コードを入れているため、

...


上記のLogger設定も必要。

【Tiqr初期値設定】(作業報告書P33)

...

/var/tiqrzenddemo/application/config/application.iniの設定を修正。

コード ブロック



{code}
resources.tiqr.identifier = "vm2.peofiamp.nii.ac.jp"
↑サーバのFQDNを記入。
resources.tiqr.name = "vm2"
↑Tiqrサーバの名称(アプリ上に表示される)を記入。
resources.tiqr.logoUrl  = "https://vm2.peofiamp.nii.ac.jp.nec.test/icons/gakunin-logo.png"
↑アプリに表示するロゴを指定。5KBくらいのpngファイル。100KBくらいだとアプリへのロードに時間が掛る。
constants.TIQRSHIB_DOMAIN = "nec.test"
↑IdPが送るeppnのセキュリティドメイン

↓以下のLDAP設定には、attribute-resolver.xmlと同じものを設定。
constants.TIQRSHIB_LDAP_HOST = "localhost"
constants.TIQRSHIB_LDAP_PORT = "389"
constants.TIQRSHIB_LDAP_BASEDN = "o=test_o,dc=ac,c=JP"
constants.TIQRSHIB_LDAP_BINDREQUIRESDN = "true"
constants.TIQRSHIB_LDAP_USERNAME = "cn=Manager,o=test_o,dc=ac,c=JP"
constants.TIQRSHIB_LDAP_PASSWORD = "password"
{code}&nbsp;&nbsp;&nbsp; /*\*

&nbsp;&nbsp;&nbsp; * Sort the array by key

&nbsp;&nbsp;&nbsp; *

&nbsp;&nbsp;&nbsp; * @return array

&nbsp;&nbsp;&nbsp; \*/

&nbsp;&nbsp;&nbsp; public function ksort()

&nbsp;&nbsp;&nbsp; {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $items = $this->getArrayCopy();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ksort($items);

&nbsp;&nbsp;&nbsp; }<\!-\-  /\* Style Definitions \*/  table.MsoNormalTable{mso-style-name:標準の表; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-parent:""; 	mso-padding-alt:0mm 5.4pt 0mm 5.4pt; 	mso-para-margin:0mm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Century","serif";} \-->

&nbsp;&nbsp; 以下を削除

&nbsp;&nbsp; RewriteEngine On

&nbsp;&nbsp; RewriteCond %{REQUEST_FILENAME} \-s \[OR\]

&nbsp;&nbsp; RewriteCond %{REQUEST_FILENAME} \-l \[OR\]

&nbsp;&nbsp; RewriteCond %{REQUEST_FILENAME} \-d

&nbsp;&nbsp; RewriteRule \^.*$ - \[NC,L\]

&nbsp;&nbsp; RewriteRule \^.*$ index.php \[NC,L\]&nbsp;&nbsp; <\!-\-  /* Style Definitions \*/  table.MsoNormalTable{mso-style-name:標準の表; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-parent:""; 	mso-padding-alt:0mm 5.4pt 0mm 5.4pt; 	mso-para-margin:0mm; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Century","serif";} \-->