Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

第30章 seccomp を使用したアプリケーション機能の制限

30.1. 概要

seccomp (セキュアコンピューティングモード) は、アプリケーションが行うシステム呼び出しのセットを制限し、クラスター管理者が OpenShift Container Platform で実行されるワークロードのセキュリティーを強化するために使用されます。

seccomp サポートは Pod 設定の 2 つのアノテーションを使用して有効になります。

  • seccomp.security.alpha.kubernetes.io/pod: Pod のすべてのコンテナーに適用されるプロファイルです (上書きなし)。
  • container.seccomp.security.alpha.kubernetes.io/<container_name>: コンテナー固有のプロファイルです (上書きあり)。
重要

デフォルトで、コンテナーは unconfined seccomp 設定で実行されます。

詳細な設計情報については、seccomp 設計についてのドキュメントを参照してください。

30.2. seccomp の有効化

seccomp は Linux カーネルの 1 つの機能です。seccomp がシステムで有効にされていることを確認するには、以下を実行します。

$ cat /boot/config-`uname -r` | grep CONFIG_SECCOMP=
CONFIG_SECCOMP=y

30.3. OpenShift Container Platform での seccomp の設定

seccomp プロファイルは json ファイルであり、システムコールを提供し、システムコールの呼び出し時に取るべき適切なアクションを実行します。

  1. seccomp プロファイルを作成します。

    多くの場合はデフォルトのプロファイルだけで十分ですが、クラスター管理者は個別システムのセキュリティー制約を定義する必要があります。

    独自のカスタムプロファイルを作成するには、seccomp-profile-root ディレクトリーですべてのノードのファイルを作成します。

    デフォルトの docker/default プロファイルを使用している場合は、これを作成する必要はありません。

  2. Configure your nodes to use the seccomp-profile-root where your profiles will be stored. In the node-config.yaml via the kubeletArguments:

    kubeletArguments:
      seccomp-profile-root:
        - "/your/path"
  3. 変更を適用するためにノードサービスを再起動します。

    # systemctl restart atomic-openshift-node
  4. In order to control which profiles may be used, and to set the default profile, configure your SCC via the seccompProfiles field. The first profile will be used as a default.

    seccompProfiles フィールドで使用できる形式には以下が含まれます。

    • docker/default: コンテナーランタイムのデフォルトプロファイルです (いずれのプロファイルも不要です)。
    • unconfined: 拘束のないプロファイルで、seccomp を無効にします。
    • localhost/<profile-name>: ノードのローカル seccomp プロファイルの root にインストールされるプロファイルです。

      For example, if you are using the default docker/default profile, configure the restricted SCC with:

      seccompProfiles:
      - docker/default

30.4. OpenShift Container Platform でのカスタム seccomp プロファイルの設定

To ensure pods in your cluster run with a custom profile in the restricted SCC:

  1. seccomp-profile-root に seccomp プロファイルを作成します。
  2. seccomp-profile-root を設定します。

    kubeletArguments:
      seccomp-profile-root:
        - "/your/path"
  3. 変更を適用するためにノードサービスを再起動します。

    # systemctl restart atomic-openshift-node
  4. Configure the restricted SCC:

    seccompProfiles:
    - localhost/<profile-name>