Last-modified: 2017-06-05 (月) 17:46:49
SimpleSAMLphp/検証目的のSP構築

概要

検証目的のSPとして、SimpleSAMLphpを構築します。
仮想マシンよりも手軽なので今回はAzure App Serviceにデプロイします。
セキュリティに関わる事項は、この記事の範疇外です。
Azure App Serviceへの手軽なデプロイ方法として、ローカルgit, ftpsがありますが、gitの恩恵に預かりたいのでgitで進めます。
ただしSimpleSAMLphpのリポジトリからのインストールは、環境整備の手間がかかるので、パッケージされたデータをソースとして使います。

手順(Azure)

  1. 新規App Service作成(Freeプランで可能)
  2. [デプロイオプション]で[ローカルGitリポジトリ]を選択
  3. [デプロイ資格情報]設定(リソース間で共通なので、今まで設定したことがあれば不要)
  4. [アプリケーション設定]仮想アプリケーションとディレクトリ
    仮想ディレクトリ物理パスアプリケーション?
    /site\wwwroot\wwwアプリケーション
    /simplesamlsite\wwwroot\wwwアプリケーション
  5. [概要]で[Git クローン URL]を控える

手順(SimpleSAMLphp)

  1. ソース取得
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
    
     
     
     
     
    
    wget https://github.com/simplesamlphp/simplesamlphp/releases/download/v1.14.14/simplesamlphp-1.14.14.tar.gz
    tar zxf simplesamlphp-1.14.14.tar.gz
    mv simplesamlphp-1.14.14 sp1
    cd sp1
  2. gitリポジトリ作成
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
    
     
     
     
     
    
    git init
    git add .
    git commit -a -m "init"
    git remote add azure <上で控えた[Git クローン URL]>
  3. vi config/config.php
    Everything is expanded.Everything is shortened.
      1
      2
    
    -
    !
    
    # 変更
    'auth.adminpassword' => '<adminパスワード>',
  4. 署名,暗号化用自己証明書作成
    Everything is expanded.Everything is shortened.
      1
    
     
    
    openssl req -newkey rsa:2048 -new -x509 -days 3652 -nodes -subj "/C=JP/ST=Tokyo/CN=sp1" -out cert/sp1.crt -keyout cert/sp1.key
  5. vi config/authsources.php
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
    
     
     
    -
    !
     
    
        'default-sp' => array(
            'saml:SP',
            # 追加
            'privatekey' => 'sp1.key',
            'certificate' => 'sp1.crt',
  6. デプロイ
    Everything is expanded.Everything is shortened.
      1
      2
      3
    
     
     
     
    
    git add .
    git commit -a -m "Test SP setting"
    git push azure master

確認

  1. デプロイ左記のURIをブラウザで開く
  2. [Federation]ページから、SPのメタデータが見えることなどを確認する
    01.png

検証時の環境

参考