SSL を利用して JIRA と Apache を統合する方法

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

アトラシアン アプリケーションの製品内でリバース プロキシを使用できますが、アトラシアン サポートはその設定についての支援は行いません。つまり、アトラシアンではリバース プロキシに関するあらゆるサポートの提供が保証されません

設定に関してサポートが必要であれば、Atlassian Answers に質問をあげてください。

This page describes how to integrate Apache HTTP Server (also referred to as httpd) with JIRA, utilizing 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.

JIRA への以下のどのアクセス方式も、Apache の設定により可能です:

これは、SSL 証明書が Tomcat ではなく Apache 内で管理され、更には Apache と Tomcat 間の接続は暗号化されない事を意味します。ただし、ブラウザーと外部ネットワーク間の接続は暗号化されます。これは、以下に示している通り、JIRA サーバが Apache サーバと同じネットワーク内にある構成に適しています:

Client Browser -> HTTPS -> Apache Proxy -> HTTP -> Tomcat (JIRA)

On this page:

これは、複数の SSL 証明書および/あるいは Webアプリケーションを抱えたネットワーク等、全て一つのロケーション(Apache) 内で管理する場合の一般的な設定です。

さらに複雑なソリューションが要求された場合は、「Apache HTTP サーバーのバージョンドキュメント」をご参照または、勤務先のApache SME にご相談下さい。必要な場合は、「アトラシアン回答コーナー」へご質問、または「アトラシアンエキスパート」にご相談下さい。

一般的な Apache 設定例を展開する
  1. JIRA を、外部からアクセスできない (ルーター/ファイアウォールがアクセスをポート 8080 に転送しない) LAN 内のサーバのポート 8080 で実行します。
  2. Apache を、HTTPS (443) で外部からアクセス可能な別のサーバ (あるいは JIRA と同一のサーバ) 上でセットアップします。
  3. Apache is then accessed over HTTPS on the appropriate URL (VirtualHost), routing the traffic to and from the JIRA server.

はじめる前に

(warning)SSL 証明書は CA によって署名され、Apache を設定する前に PEM フォーマットになっている事が想定されます。SSL 証明書の準備および生成のサポートに関しては、SSL ベンダー (GoDaddy、Verisign、RapidSSL 等) まで問い合わせて下さい。

ドメイン、サブドメインあるいはコンテキストパスを利用するかの決定は、主として提供される SSL 証明書の種類、およびウェブサイト設定にまつわるあらゆる業務規定によって左右されます。SSL がエラー無く機能するには、ドメインが証明書の Common Name (CN) と一致しなくてはいけません。

FQDN が証明書の CN と一致するよう構成する場合の展開

この表は、どの URL が証明書 CN と動作するかを示し、また使用するべき URL の推奨を行います。

アスタリスク(*) を有する CN を持つ証明書は ワイルドカード証明書 であり、そのドメインのあらゆるサブドメインをサポートできます。どの URL を使用するべきか分からない場合は、その証明書を提供した担当のシステムアドミニストレーターと SSL ベンダーに問い合わせて下さい。

ステップ 1: Tomcat を設定する

  1. Jira を停止します。
  2. (オプション: JIRA にコンテキストパスが不要な場合は、このステップを飛ばします)

    Edit Tomcat's server.xml to include the required JIRA context path. The below example uses path="jira" - this means JIRA is accessible on http://jiraserver:8080/jira given 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>

    (info) path の値がスラッシュ (/) がを使用して設定されていることを確認します。例えば、path="jira" ではなく path="/jira" と指定します。

  3. 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"/>
  4. Disable any redirections within Tomcat to HTTPS if they have been enabled - for example the changes to WEB-INF/web.xml in Running JIRA applications over SSL or HTTPS will cause errors when using Apache.
  5. Jira を起動します。
  6. Test that JIRA is accessible on the normal connector, using a context path if applicable - for example http://jiraserver:8081/jira.
  7. 適切なプロキシコネクタ上で、 JIRA にアクセスして新規のコネクタの有効性をテストします。コネクタの行動は、コンテキストパスによって異なります。
    1. If the context path is empty or root (/), visiting JIRA via the proxy connector (e.g. http://jiraserver:8080/) should take you to JIRA with a warning:
    2. If the context path is other than empty or root (/), e.g. /jira , visiting JIRA via the proxy connector (e.g. http://jiraserver:8080/jira) should redirect you to the configured proxy (e.g. https://jira.atlassian.com/jira). 

上記のように必要に応じてプロキシをバイパスできるようにして、二つの異なる Tomcat コネクターを利用して、JIRA 上でのテストを可能にしました。これはトラブルシューティングの際は便利なステップです。標準コネクターは、ネットワーク外からの外部アクセスが認められ ない (ファイアウォールが、ポートを転送しない) 事を想定しています。

ステップ 2: Apache HTTP サーバを設定する

Apache のインストールおよび DNS の構成に関しては、本ドキュメントでは扱っていません。また、Apache 2.2 がインストール済みであり、DNS エントリーが JIRA ドメイン向けに設定されているものと想定しています。Apache の設定は利用する OS によって異なるため、現在のドキュメントは一部のディストリビューションの設定のみとなっています。

2.1 プロキシモジュールを有効化する

Debian/Ubuntu
Debian / Ubuntu での手順を展開して確認
  1. 以下の方法で、モジュールを有効化します:

    $ sudo a2enmod proxy_http ssl
    Considering dependency proxy for proxy_http:
    Enabling module proxy.
    Enabling module proxy_http.
    Enabling module ssl.
    See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
    To activate the new configuration, you need to run:
      service apache2 restart
  2. Apache を再起動します。
Windows/その他の OS
Windows/その他の OS 向け解説を詳しく見る
  1. httpd.conf ファイルを見つけてを編集し、次の行が存在しない場合は追加します。

    LoadModule proxy_module modules/mod_proxy.so 
    LoadModule proxy_connect_module modules/mod_proxy_connect.so 
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule ssl_module modules/mod_ssl.so
  2. Apache を再起動します。

2.2 これらのモジュールを使用するように、Apacheを設定します

Debian/Ubuntu
Debian / Ubuntu での手順を展開して確認
  1. root ユーザーに切り替えます。
  2. 既存インスタンスをバックアップするか、新しく作成します。新しいインスタンスの作成に関しては、本ドキュメントでは扱っていません(デフォルトのコピーで十分なはずです)。
  3. $APACHE_INSTALL/sites-available 内の既存インスタンスを、default-ssl などに変更します。
  4. Add the following inside the VirtualHost, replacing jiraserver with the hostname of the JIRA server and also modifying the port if required.

    自らのドメインまたはサブドメインへアクセスする場合:
    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    SSLProxyEngine          On
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /       http://jiraserver:8080/
    ProxyPassReverse        /       http://jiraserver:8080/

    (info) URLの前の/(スラッシュ)を忘れると、プロキシーエラーが発生しますので必ず付け加えてください。

    コンテキストパスを利用する場合:
    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    SSLProxyEngine          On
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /jira       http://jiraserver:8080/jira
    ProxyPassReverse        /jira       http://jiraserver:8080/jira

    (info) 使用するパスは、Tomcat のコンテキスト パスと同一のものである必要があります。たとえば、/jira から /jira520 への転送には、多数のルールの書き換えが必要になり、このような書き換えのなかには信頼性が保証されないものがある場合もあります。

  5. 以下の方法で、インスタンスを有効化します:

    # a2ensite default-ssl
    Enabling site default-ssl.
    To activate the new configuration, you need to run:
      service apache2 reload
  6. 証明書と秘密鍵を適切なディレクトリにコピーします。
  7. 以下の設定を VirtualHost 内の Apache 設定に含めます。

    SSLCertificateFile    /etc/ssl/certs/jira.crt
    SSLCertificateKeyFile /etc/ssl/private/jira.key
  8. (オプション): SSLCertificateChainFile の設定には、それを署名した CA ベンダーが提供した中間証明書が含まれます。この必要性を検証するには、CA ベンダーに問い合わせてください。

    SSLCertificateChainFile /etc/ssl/certs/jiraintermediate.crt
  9. Apache の設定をリロードします。
  10. Test by accessing JIRA through Apache, for example http://jira.com or http://atlassian.com/jira.
Windows/その他の OS
Windows/その他の OS 向け解説を詳しく見る
  1. httpd.conf ファイルを見つけて編集します。
  2. Add the following inside the VirtualHost, replacing jiraserver with the hostname of the JIRA server and also modifying the port if required.

    自らのドメインまたはサブドメインへアクセスする場合:

    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    SSLProxyEngine          On
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /       http://jiraserver:8080/
    ProxyPassReverse        /       http://jiraserver:8080/

    (info) URLの前の/(スラッシュ)を忘れると、プロキシーエラーが発生しますので必ず付け加えてください。

    コンテキストパスを利用する場合:

    # JIRA Proxy Configuration:
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    
    SSLProxyEngine          On
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /jira       http://jiraserver:8080/jira
    ProxyPassReverse        /jira       http://jiraserver:8080/jira

    (info) 使用するパスは、Tomcat のコンテキスト パスと同一のものである必要があります。たとえば、/jira から /jira520 への転送には、多数のルールの書き換えが必要になり、このような書き換えのなかには信頼性が保証されないものがある場合もあります。

  3. 証明書と秘密鍵を適切なディレクトリにコピーします。
  4. 以下の設定を VirtualHost 内の Apache 設定に含めます。

    SSLCertificateFile      /etc/ssl/certs/jira.crt
    SSLCertificateKeyFile   /etc/ssl/private/jira.key
  5. (オプション): SSLCertificateChainFile の設定には、それを署名した CA ベンダーが提供した中間証明書が含まれます。この必要性を検証するには、CA ベンダーに問い合わせてください。

    SSLCertificateChainFile /etc/ssl/certs/jiraintermediate.crt
  6. Apache を再起動します。
  7. Test by accessing JIRA through Apache, for example http://jira.com or http://atlassian.com/jira.

2.3 HTTP を HTTPS にリダイレクトします

これは、以下のいずれかの方法で行えます:

  • Set up the HTTP VirtualHost to forward to the same Tomcat Connector. Tomcat will redirect to HTTPS using the schemeproxyName & proxyPort parameters. 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 を設定する

  1. JIRA オプション設定」の通りに、「gzip ファイル圧縮を利用する」設定をオフにします。 GZIP ファイル圧縮は、特にプロキシによるトラフィック圧縮を行う等のリバースプロキシを使った場合に、性能問題を起こすことで知られています。
  2. 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.
    (warning) 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.
  3. 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 モジュールを無効にしてみてください。
    (info) 一部の Apache HTTP Server バージョン 2 ディストリビューションではこのモジュールがデフォルトで有効になっています。
  • SELinux を使用する Linux ディストリビューションで mod_proxy (および mod_jk) を有効化した際の Permission Denied エラー : mod_proxy (および mod_jk) を動作させようとすると "permission denied" エラーが発生することが多くのユーザーから報告されています。これは SELinux (/etc/selinux/config) を無効化することで解決できます。
  • Mac OS X 使用時の問題 :  デフォルトでポート 80 を使用する webperfcache, を無効にする必要があります。あるユーザーから、これが以下にあるように JIRA セッションにおいてユーザーの識別情報が混乱するという問題が起こる有力な原因だとの指摘が出ています。
    (warning) なお、サポートするプラットフォームに示すように Max OS X は当社のサポート対象ではなく、当社としてはその使用は推奨いたしません。

OSX Server では、バーチャルホスト機能を提供するためにデフォルトで webperfcache を有効にしており、動的インスタンス (JIRA のインスタンスはすべて動的インスタンスです。) に対しては悪影響があり、多くの問題を引き起こします。
中でも最近指摘されている JIRA セッションへの悪影響の問題には注意する必要があります。なお、次の情報も参照してください : 
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/webperfcache.8.html
残念ながら、あるインスタンスで webperfcache を無効化しても、有効になっているインスタンスがひとつでもあると、すべてのインスタンスが引き続き webperfcache をプロキシとして使用するため、セッションに問題が発生します。

  • 過剰なリダイレクト : Tomcat と Apache のどちらかでリダイレクトが行われれば十分である場合において両方でリダイレクトが行われてしまう問題です。これに対しては、Tomcat でのリダイレクトを無効化し、(Running JIRA over SSL or HTTPS の説明に従って設定の変更を元に戻します。) その後リダイレクトが Apache のみで行われることを確認します。
  • その他の一般的なトラブル :
    1. ブラウザーのキャッシュを削除してからもう一度試みます。
    2. Ensure that JIRA works as expected when running directly from Tomcat and bypassing Apache. For example, accessing http://jiraserver:8080 instead of http://jira.atlassian.com.
    3. より多くの Apache デバッグ情報を得られるようにログレベルを変更して再起動します。
    4. JIRA にアクセスし、エラーに対応する Apache ログファイル情報を確認します。
    5. アトラシアン Answers に質問を出して助言を求めます。
  • 403 Forbidden エラー : 
    • Apache 設定ページに RequestHeader unset Authorization 行を追加して、認証ヘッダーを無効化します。

      <Location /jira>
        RequestHeader unset Authorization
        ProxyPreserveHost On
        ProxyPass http://jiraserver/jira
        ProxyPassReverse http://jiraserver/jira
      </Location>

参考情報

最終更新日: 2021 年 10 月 6 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.