Tomcat における、セキュリティ上のベストプラクティス

The following outlines some basic techniques to secure an Apache Tomcat instance. This is a basic must-do list and should not be considered comprehensive. For more advanced security topics see the "Further Information" section below.

ユーザーアクセス権

Tomcat は、絶対に特権ユーザー (UNIX における root、あるいは Windows における Admistrator または Local System) として実行してはいけません。

Tomcat は、低権限のユーザーとして実行します。理想的には、単一のアプリケーションを実行する目的のためのみに作成されたユーザーとして実行されるべきです。

In practice this means you can't run it on port 80. If you need to run Tomcat on port 80, you should put it behind a webserver such as Apache; see Integrating JIRA with Apache for an example configuration.

Unix/Linux のチートシート

  • Create a JIRA user:
    sudo adduser jira-tomcat
  • Run Tomcat as a specific user:
    sudo -u jira-tomcat ${CATALINA_HOME}/bin/catalina.sh run

Windows チートシート

  • 非特権アカウントを作成します (お使いのホストがアクティブディレクトリの一部であれば、既にサービス利用者向けテンプレートが存在する場合があります)。ユーザーは、それに「サービスとしてログオン」する権限が与えられているはずです。
  • Make sure the Apache Tomcat service is set to run as that user. If Tomcat was installed using the JIRA Windows Installer, the system tray utility lets you set this via Configuration -> Log On:

Tomcat のインストールのパーミッション

Tomcat のインストレーションディレクトリ (CATALINA_HOME と呼ばれる場合もあります) は、Tomcat を実行するユーザーとは異なるユーザーとしてインストールする必要があります。Linux においては、Tomcat のディストリビューションを root としてアンパックするのが、これを行う最もシンプルな方法です。

残念ながら、Tomcat はディストリビューションディレクトリの一部のディレクトリに書込みアクセス権限を必要としますが、それは必要に応じてのみ有効化します。

Tomcat は、そのディレクトリ内の Admin アプリケーションがデフォルト設定された状態で出荷されます。必要でなければ、これらを無効化します。

Unix/Linux のチートシート

  • Unpack Tomcat as root:
    sudo tar xzvf apache-tomcat-6.0.20.tar.gz
  • Remove the default webapps:
    sudo rm -rf apache-tomcat-6.0.20/webapps/*
  • Remove write permissions:
    sudo chmod -R go-w apache-tomcat-6.0.20
  • Allow write on needed directories only:
    cd apache-tomcat-6.0.20/; sudo chown -R jira-tomcat work/ temp/ logs/

Windows チートシート

注意: お使いのホストがドメイン/アクティブディレクトリの一部である場合は、Windows システムアドミニストレーター sysadmins に問い合わせて、適切な許可を取得します。

  • Tomcat をアンパック・インストールし、CATALINA_HOME のパーミッションをアップデートして、アドミニストレーターとシステムのみが書込み可能とします。Tomcat のサービス利用者は、読込み、実行およびフォルダーをスキャン権限を持つ事とします。


  • Under CATALINA_HOME, the work, temp and logs directories need write and delete access for the Tomcat user. Make sure it does not have permissions to change permission or take ownership.

Web-アプリケーションのインストール権限

The directory you unpack the application WAR into should not be writable by the Tomcat user (i.e. jira-tomcat in the examples above). Again, the simplest method to do this is to unpack the WAR as root.

Unix/Linux のチートシート

  • Unpack the war as root:
    sudo unzip confluence-webapp-3.2.war

Windows チートシート

  • 自身のユーザーとして WAR をアンパックし、Tomcat ユーザーが webapp への書込みアクセスを所持していない事を確認します。

詳細情報

最終更新日 2011 年 11 月 1 日

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

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