IdPv4のインストール
実習セミナー内に準備されたLinuxサーバにJDK、Tomcat、Shibboleth 実習セミナー内に準備されたLinuxサーバにJDK、Jetty、Shibboleth IdPをインストールする手順となっています。
目次 |
---|
maxLevel | 2 |
---|
minLevel | 2 |
---|
style | none |
---|
|
...
2. Java 11(OpenJDK)をインストールする
1. インストール
CentOS 7にはOpenJDKのパッケージが用意されていますので、これをyumにてインストールします。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# yum install java-11-openjdk-headless |
...
"root"ユーザではなく、Jetty起動用のユーザを使用することを推奨します。
ここでは、一般的な "jetty" ユーザを作成します。(以降、"jetty"ユーザを使用する事が前提で説明します。)ユーザを使用する事を前提として説明します。)
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# groupadd -g 110 jetty # useradd -u 110 -r g jetty -d /opt/jetty-base -s /sbin/nologin -c "Jetty daemon" jetty useradd: 警告: ホームディレクトリが既に存在します。 skel ディレクトリからのコピーは行いません。
もしくは、 useradd: warning: the home directory already exists. Not copying any file from skel directory into it.
|
(上の手順でディレクトリ作成済みのため警告が出ますが問題ありません)
以下のコマンドでその他 Jetty 関連の設定ファイルやディレクトリの所有者、パーミッションを設定します。
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# cp -ip /opt/jetty/bin/jetty.sh /etc/init.d/jetty
# cp -ip /opt/jetty/bin/jetty.service /etc/systemd/system/
|
jetty.serviceについては、コピー後に以下のように修正します。
serviceについては、コピー後に以下のように[Service]部分を修正します。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/jetty
PIDFile=/opt/jetty-base/tmp/jetty.pid
ExecStart=/etc/init.d/jetty start
ExecStop=/etc/init.d/jetty stop
ExecReload=/etc/init.d/jetty restart
SuccessExitStatus=143
User=jetty
Group=jetty TimeoutStartSec=150
|
以下を実行して、修正した内容を反映させます。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# systemctl daemon-reload
|
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
JAVA= /usr/lib/jvm/jre/bin/java
JETTY_HOME= /opt/jetty
JETTY_BASE= /opt/jetty-base
JETTY_RUN= /opt/jetty-base/tmp
JETTY_STATE= /opt/jetty-base/tmp/jetty .state JETTY_START_TIMEOUT=120
|
2. 自動起動の設定
以下のコマンドで自動起動設定を有効にします。
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# Any other required Jetty modules...
# Allows setting Java system properties (-Dname=value) # and JVM flags (-X, -XX) in this file # NOTE: spawns child Java process --exec
# Uncomment if IdP is installed somewhere other than /opt/shibboleth-idp #-Didp.home=/path/to/shibboleth-idp
# Newer garbage collector that reduces memory needed for larger metadata files -XX:+UseG1GC
# Maximum amount of memory that Jetty may use, at least 1.5G is recommended # for handling larger (> 25M) metadata files but you will need to test on # your particular metadata configuration -Xmx1500m
# Prevent blocking for entropy. -Djava.security.egd=file:/dev/./urandom
# Set Java tmp location -Djava.io.tmpdir=tmp # Strip IPv6 brackets #-Dorg.eclipse.jetty.util.HostPort.STRIP_IPV6=true
|
/opt/jetty-base/start.d/idp.ini の修正
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_4.dtd">
<Configure id="sslContextFactoryshibContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="IncludeProtocols">
<Array type="String">
<Item>TLSv1.3</Item>
<Item>TLSv1.2</Item>
</Array>
</Set>
<Set name="ExcludeProtocols">
<Array type="String">
<Item>TLSv1.1</Item>
<Item>TLSv1</Item>
<Item>SSL</Item>
<Item>SSLv2</Item>
<Item>SSLv3</Item>
</Array>
</Set>
<Set name="IncludeCipherSuites">
<Array type="String">
<Item>TLS_ECDHE.*</Item>
<Item>TLS_AES.*</Item>
<Item>TLS_RSA.*</Item>
</Array>
</Set>
<Set name="ExcludeCipherSuites">
<Array type="String">
<Item>.*NULL.*</Item>
<Item>.*RC4.*</Item>
<Item>.*MD5.*</Item>
<Item>.*DES.*</Item>
<Item>.*DSS.*</Item>
<Item>TLS_DHE.*</Item>
</Array>
</Set>
</Configure>
|
上記ファイルを参照するように /opt/jetty-base/modules/idp-backchannel.mod に追記します。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
(省略)
[xml]
etc/idp-backchannel.xml
etc/tweak-ssl.xml |
4. httpd の設定
以下のように設定ファイルの修正を行います。
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
(省略) <VirtualHost _default_:443>
(省略)
# ServerName ex-idp-test??.gakunin.nii.ac.jp:443 ← ??は各自割り振られた番号(0番なら「00」)
↑コメントアウト(#)を削除 ↓以下を追加
RequestHeader set X-Forwarded-Port 443
RequestHeader set X-Forwarded-Proto https ProxyPass /RequestHeader unset Forwarded
RequestHeader unset X-Forwarded-For ProxyPass /idp/ http://localhost:8080/idp/ connectiontimeout=5 timeout=15 RequestHeader set REMOTE-USER %{REMOTE_USER}s
(省略)
|
/etc/httpd/conf.d/virtualhost-localhost80.conf の作成
...
4. Shibbolethのインストール
各ファイル名等の指定は,Version 4.02.1に準拠しています。
1. インストール
Shibboleth IdPのパッケージは、「/root/PKG」配下にあります。
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# tar xzvf shibboleth-identity-provider-4.?.?.tar.gz
# cd shibboleth-identity-provider-4.?.?
# ./bin/install.sh -Didp.conf.credentials.filemodefilemode=640 -Didp.conf.credentials.group=jetty
|
install.shシェルスクリプトを実行すると、以下のような問い合わせがあります。
手順に従って、進めてください。
注意 |
---|
インストール時に入力するパスワードを本運用で使う場合は、推測されにくいものを使用してください。 ※ここで入力したパスワードは、/opt/shibboleth-idp/confcredentials/idpsecrets.propertiesに記載されます。(平文)propertiesに記載されます。(平文)(cookiepassのほう) ※backpassのほうは記載されません。/opt/shibboleth-idp/credentials/idp-backchannel.p12の暗号化のために使用されます。(本技術ガイドではidp-backchannel.p12を使用しません) |
パネル |
---|
|
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
Buildfile: /root/PKG/shibboleth-identity-provider-4.02.1/bin/build.xml
install: Source (Distribution) Directory (press <enter> to accept default): [/root/PKG/shibboleth-identity-provider-4.03.1] ?
[Enter] ←入力なし
Installation Directory: [/opt/shibboleth-idp] ?
[Enter] ←入力なし INFO [net.shibboleth.idp.installer.V4Install:151] - New Install. Version: 4.03.1 Hostname: [ex-idp-test??.gakunin.ip-??-?-?-???.ap-northeast-1.compute.internal]
ex-idp-test??.gakunin.nii.ac.jp ]
[Enter] ←入力なし ※表示されたホスト名が違う場合、設定してください。??は各自割り振られた番号(0番なら「00」)
(省略)
Backchannel PKCS12 Password: backpass[Enter] ←任意のパスワード←任意のパスワード(不使用)
Re-enter password: backpass[Enter]
(省略) Cookie Encryption Key Password: cookiepass[Enter] ←任意のパスワード←任意のパスワード(内部で使用) Re-enter password: cookiepass[Enter] (省略) SAML EntityID: [https://ex-idp-test??.gakunin.nii.ac.jp /idp/shibboleth] ? [Enter] ←入力なし Attribute Scope: [gakunin.nii.ac.jp] nii.ac.jp [Enter] ←nii.ac.jpを設定してください。
(省略)
BUILD SUCCESSFUL Total time: 2 minutes 9 seconds
(省略)
|
上記のような質問に答えながら、インストールを行います。
...
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# chown -R jetty:jetty /opt/shibboleth-idp/logs
# chgrp jetty /opt/shibboleth-idp/metadata
# chmod g+w /opt/shibboleth-idp/metadata
# chmod +t /opt/shibboleth-idp/metadata
|
ヒント |
---|
IdPが実際に使用する証明書の秘密鍵はまだ配置されておりませんので、所有者・パーミッションは後の手順で設定します。 |
...
作成したweb.xml を以下の内容で修正します。
※既存の<servlet>の前に設定を追加します。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
<filter-mapping>
<filter-name>SLF4JMDCServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Servlets and servlet mappings -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet>
<servlet-name>idp</servlet-name>
|
以下を実行して反映させます。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# cp -ip /opt/shibboleth-idp/dist/webapp/WEB-INF/web.xml bin/build.sh
|
build.shシェルスクリプトを実行すると、以下のような問い合わせがあります。
手順に従って、進めてください。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
Buildfile: /opt/shibboleth-idp/bin/build.xml
build-war:
Installation Directory: [/opt/shibboleth-idp] ?
[Enter] ←入力なし
Rebuilding /opt/shibboleth-idp/war/idp.war, Version 4.3.1 Initial populate from /opt/shibboleth-idp/dist/webapp to /opt/shibboleth-idp/webpapp.tmp Overlay from /opt/shibboleth-idp/edit-webapp to /opt/WEBshibboleth-INFidp/webwebpapp.xml
# chmod u+w tmp Creating war file /opt/shibboleth-idp/edit-webapp/WEB-INF/web.xmlwar/idp.war
BUILD SUCCESSFUL
(省略) |
httpdの再起動とJettyの起動を行います。(すでにJettyが起動している場合はstopしてから行ってください)
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# systemctl restart httpd
# systemctl start jetty |
注意 |
---|
Jettyに関する注意事項※jetty起動に失敗したら設定修正後、 - jetty起動に失敗したら設定修正後、/opt/jetty-base/tmp/下にファイルが残っていたら削除してから再度起動してください。
※build- build.shしたら sudo systemctl restart jetty しないと反映されません。
|
...
5. サービスの起動・停止方法
...
インストールが完了したら,サイト情報等の設定を行って下さい.
...
...