SSL を利用して JIRA と Apache を統合する方法
アトラシアン アプリケーションの製品内でリバース プロキシを使用できますが、アトラシアン サポートはその設定についての支援は行いません。つまり、アトラシアンではリバース プロキシに関するあらゆるサポートの提供が保証されません。
設定に関してサポートが必要であれば、Atlassian Answers に質問をあげてください。
This page describes how to integrate Apache HTTP Server (also referred to as httpd) with JIRA, utilising mod_proxy & mod_ssl so that Apache operates as a reverse-proxy over HTTPS. If a HTTP configuration is required, please see our Integrating JIRA with Apache documentation. Configuring Apache allows for running JIRA on non-standard HTTP port (such as 8080) and users will be able to access JIRA over standard HTTPS as their traffic will be routed through the proxy and encrypted outside of the network.
- Directly on its own domain: https://atlassian.com/
- As a subdomain of another domain: https://jira.atlassian.com
- It can also be accessed on a context path on either a domain or subdomain: https://atlassian.com/jira
これは、SSL 証明書が Tomcat ではなく Apache 内で管理され、更には Apache と Tomcat 間の接続は暗号化されない事を意味します。ただし、ブラウザーと外部ネットワーク間の接続は暗号化されます。これは、以下に示している通り、JIRA サーバが Apache サーバと同じネットワーク内にある構成に適しています:
Client Browser -> HTTPS -> Apache Proxy -> HTTP -> Tomcat (JIRA)
これは、複数の SSL 証明書および/あるいは Webアプリケーションを抱えたネットワーク等、全て一つのロケーション(Apache) 内で管理する場合の一般的な設定です。
If a more complicated solution is required, refer to the Apache HTTP Server Version Documentation, consult with the Apache SME within your organisation and if need be raise a question on Atlassian Answers or look at getting in touch with one of our Atlassian Experts.
On this page:
はじめる前に
SSL 証明書は CA によって署名され、Apache を設定する前に PEM フォーマットになっている事が想定されます。SSL 証明書の準備および生成のサポートに関しては、SSL ベンダー (GoDaddy、Verisign、RapidSSL 等) まで問い合わせてください。
ドメイン、サブドメインあるいはコンテキストパスを利用するかの決定は、主として提供される SSL 証明書の種類、およびウェブサイト設定にまつわるあらゆる業務規定によって左右されます。SSL がエラー無く機能するには、ドメインが証明書の Common Name (CN) と一致しなくてはいけません。
アスタリスク(*) を有する CN を持つ証明書は ワイルドカード証明書 であり、そのドメインのあらゆるサブドメインをサポートできます。どの URL を使用するべきか分からない場合は、その証明書を提供した担当のシステムアドミニストレーターと SSL ベンダーに問い合わせて下さい。
ステップ 1: Tomcat を設定する
- Jira を停止します。
(オプション: JIRA にコンテキストパスが不要な場合は、このステップを飛ばします)
Edit Tomcat's
server.xmlto include the required JIRA context path. The below example usespath="jira"- this means JIRA is accessible onhttp://jiraserver:8080/jiragiven the default JIRA port is used.<Engine defaultHost="localhost" name="Catalina"> <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"> <Context docBase="${catalina.home}/atlassian-jira" path="/jira" reloadable="false" useHttpOnly="true"> <!-- ==================================================================================== Note, you no longer configure your database driver or connection parameters here. These are configured through the UI during application setup. ==================================================================================== --> <Resource auth="Container" factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60" name="UserTransaction" type="javax.transaction.UserTransaction"/> <Manager pathname=""/> </Context> </Host>pathの値がスラッシュ (/) を使用して設定されていることを確認します。たとえば、path="jira"ではなくpath="/jira"と指定します。Tomcat の
server.xmlファイルを編集して、リクエストをプロキシするための別のコネクタを含めます。これにはscheme属性、proxyName属性、およびproxyPort属性が必要です。以下の例のように、これらをプロキシの適切なドメインおよびポートで置き替えます。<Service name="Catalina"> <!-- Apache Proxy Connector with values for scheme, proxyName and proxyPort --> <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" port="8080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true" scheme="https" proxyName="jira.atlassian.com" proxyPort="443"/> <!-- Standard HTTP Connector --> <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" port="8081" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"/>- Disable any redirections within Tomcat to HTTPS if they have been enabled - for example the changes to
WEB-INF/web.xmlin Running JIRA over SSL or HTTPS will cause errors when using Apache. - Jira を起動します。
- Test that JIRA is accessible on the normal connector, using a context path if applicable - for example
http://jiraserver:8081/jira. - Test that the new connector is working by accessing JIRA on the appropriate proxy connector, for example
http://jiraserver:8080/. This should redirect to the proxy FQDN (in this example, https://jira.atlassian.com), which will fail as the proxy is not yet configured. The test is to ensure Tomcat is set up to correctly redirect to the proxy.
上記のように必要に応じてプロキシをバイパスできるようにして、二つの異なる Tomcat コネクターを利用して、JIRA 上でのテストを可能にしました。これはトラブルシューティングの際は便利なステップです。標準コネクターは、ネットワーク外からの外部アクセスが認められ ない (ファイアウォールが、ポートを転送しない) 事を想定しています。
ステップ 2: Apache HTTP サーバを設定する
Apache のインストールおよび DNS の構成に関しては、本ドキュメントでは扱っていません。また、Apache 2.2 がインストール済みであり、DNS エントリーが JIRA ドメイン向けに設定されているものと想定しています。Apache の設定は利用する OS によって異なるため、現在のドキュメントは一部のディストリビューションの設定のみとなっています。
2.1 プロキシモジュールを有効化する
Debian/Ubuntu
Windows/その他の OS
2.2 これらのモジュールを使用するように、Apacheを設定します
Debian/Ubuntu
Windows/その他の OS
2.3 HTTP を HTTPS にリダイレクトします
これは、以下のいずれかの方法で行えます:
- Set up the HTTP
VirtualHostto forward to the same Tomcat Connector. Tomcat will redirect to HTTPS using thescheme,proxyName&proxyPortparameters. This can be done as in our Integrating JIRA with Apache documentation. mod_rewrite (このモジュールを有効にする必要がある場合があります) を利用して、以下を HTTP
VirtualHostに追加します。RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ステップ 3: JIRA を設定する
- Set Use gzip compression to OFF as in Configuring JIRA Options. GZIP compression is known to cause performance issues using a reverse-proxy, especially if the proxy is also compressing the traffic.
- Set the Base URL to be the FQDN that JIRA will be accessed on, for example https://jira.atlassian.com. This is also located in Configuring JIRA Options.
JIRA can only be configured to respond to a single URL and the Base URL (as in Configuring JIRA Options) must match the URL end-users are accessing. Misconfiguration of this may cause significant problems within JIRA such as the Activity Stream and Dashboard Gadgets failing to function correctly.
- Test by accessing JIRA on the FQDN (e.g.: https://jira.atlassian.com), ensuring that JIRA is accessible and all dashboard gadgets correctly display.
トラブルシューティング
- セッションのハイジャック: mod_cache モジュールが有効になっているときにユーザー セッションがハイジャックされることがある問題が報告されています。この問題が発生した場合、
mod_cacheモジュールを無効にしてみてください。一部の Apache HTTP Server バージョン 2 ディストリビューションではこのモジュールが既定で有効になっています。
- SELinux を使用する Linux ディストリビューションで
mod_proxy(およびmod_jk) を有効化した際の Permission Denied エラー :mod_proxy(およびmod_jk) を動作させようとすると "permission denied" エラーが発生することが多くのユーザーから報告されています。これは SELinux (/etc/selinux/config) を無効化することで解決できます。 Running Mac OS X: Disable webperfcache, which proxies port 80 by default. A user reported this as the likely cause of JIRA session problems, in the form of users' identities becoming mixed up, as below.
Additionally we do not recommend using Max OS X as it is not supported, as in our Supported Platforms.
The OSX Servers enable webperfcache by default for Virtual Hosts, which for static content would be great, but for dynamic sites (which ALL of ours are) it is Evil and causes many issues.
Of note recently was the jira session issue. Also see :-
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/webperfcache.8.html
Unfortunately even if you disable webperfcache for a site, if there is a single site enabled then all sites will still proxy through webperfcache with resulting session problems.
- Too many redirects: Both Tomcat & Apache are redirecting, when only one should be. Disable redirection in Tomcat (revert any changes as in Running JIRA over SSL or HTTPS) and check that there is only one redirection in Apache.
- その他の一般的なトラブル :
- ブラウザーのキャッシュを削除してからもう一度試みます。
- Ensure that JIRA works as expected when running directly from Tomcat and bypassing Apache. For example, accessing
http://jiraserver:8080instead of http://jira.atlassian.com. - より多くの Apache デバッグ情報を得られるようにログレベルを変更して再起動します。
- JIRA にアクセスし、エラーに対応する Apache ログファイル情報を確認します。
- アトラシアン Answers に質問を出して助言を求めます。
- 403 Forbidden エラー :
Apache 設定ページに
RequestHeader unset Authorization行を追加して、認証ヘッダーを無効化します。<Location /jira> RequestHeader unset Authorization ProxyPreserveHost On ProxyPass http://jiraserver/jira ProxyPassReverse http://jiraserver/jira </Location>
参考情報
- JIRA と Apache の統合
- AJP プロトコルを利用して Apache リバースプロキシを構成する
- より高度な
mod_webapp設定 (例: SSL) については、この mod_proxy ガイドを参照してください。 - Apache 仮想ホストドキュメント