...
として設定を行い、クライアント証明書が有効な証明書であり、かつ、上記の条件を満たす場合に認証を行う設定としています。
こちらの手順は、RemoteUserを使いクライアント証明書での認証を行えるような設定となります。
・RemoteUserを有効にする
4.1.0以降では同意機能はモジュール化されており、利用するには有効化操作が必要です。以下のコマンドを実行してください。(当該モジュールがすでに有効化されているかを確認し、有効化されていない場合に有効化するものです)
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# /opt/shibboleth-idp/bin/module.sh -t idp.authn.RemoteUser || /opt/shibboleth-idp/bin/module.sh -e idp.authn.RemoteUser
|
・/opt/shibboleth-idp/conf/authn/
...
authn.properties の変更
クライアント証明書を用いた認証のために idpauthn.properties ファイルを変更します。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
(省略) # Regular expression matching login flows to enable, e.g. IPAddress| Password Password
#idp.authn.flows = Password
idp.authn.flows = X509RemoteUser
|
このままだとRemoteUserが証明書認証とみなされないので、以下の設定も加える。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
#### RemoteUser #### (省略) # Most other settings need to be supplied via web.xml to the servlet idp.authn.RemoteUser.supportedPrincipals = \
saml2/urn:oasis:names:tc:SAML:2.0:ac:classes:X509, \
saml2/urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient, \
saml1/urn:ietf:rfc:2246
|
・/etc/httpd/conf.d/ssl.confへの追加(赤文字の個所を追加)
※SSLVerifyClientがrequireのため問題ないはずだが、万が一証明書認証に失敗してもIdPに到達した場合REMOTE_USERヘッダに"(null)"が入ってくるため、フェイルセーフとしてrewriteの条件を入れている。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
(省略)
<VirtualHost _default_:443>
(省略)
ProxyPass /idp ajp/ http://localhost: 80098080/idp/ connectiontimeout=5 timeout=15
<Location /idp/Authn/ X509> SSLCACertificateFile /opt/shibboleth-idp/credentials/Camp-CA.crt SSLVerifyClient require SSLVerifyDepth 3 SSLRequireSSL SSLOptions +ExportCertData +StdEnvVars SSLUserName RemoteUser> SSLVerifyClient require SSLVerifyDepth 3 SSLRequireSSL # SSLOptions +ExportCertData +StdEnvVars SSLUserName SSL_CLIENT_S_DN_CN
SSLRequire SSLRequire %{SSL_CLIENT_S_DN_O} eq "Test_University_A" RequestHeader set REMOTE_USER %{REMOTE_USER}s RewriteEngine On RewriteCond %{SSL:REMOTE_USER} ="" RewriteRule .* - [E=REMOTEUSERNULL] RequestHeader unset REMOTE_USER env=REMOTEUSERNULL </Location> SSLCACertificateFile /opt/shibboleth-idp/credentials/cacert.pem
(省略)
</VirtualHost>
|
・/opt/shibboleth-idp
...
/edit-webapp/WEB-INF/web.xmlに対象ヘッダREMOTE_USERを追加
LDAP から属性を取得する際のキーとなる属性はデフォルトでは uid ですが変更したい場合は下記の場所を変更します。web.xmlに以下の内容を追加します。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
(省略)
idp.attribute.resolver.LDAP.trustCertificates = %{<!-- Servlet protected by container used for RemoteUser authentication -->
<servlet>
<servlet-name>RemoteUserAuthHandler</servlet-name>
<servlet-class>net.shibboleth.idp.authn. LDAP.trustCertificates:undefined} idp.attribute.resolver.LDAP.searchFilter = (uid=$resolutionContext.principal) ←必要に応じて変更 idp.attribute.resolver.LDAP.returnAttributes = cn,homephone,mail
(省略)impl.RemoteUserAuthServlet</servlet-class>
<init-param>
<param-name>checkHeaders</param-name>
<param-value>REMOTE_USER</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>RemoteUserAuthHandler</servlet-name>
<url-pattern>/Authn/RemoteUser</url-pattern>
</servlet-mapping>
(省略)
|
以下を実行して、反映させます。
パネル |
---|
borderColor | #cccccc |
---|
bgColor | #eeeeee |
---|
borderStyle | solid |
---|
|
# /opt/shibboleth-idp/bin/build.sh
|
複数の認証手段を使う場合
複数の認証手段を使うのでなければ以上で完了です。
...