第6章 Insights クライアントデータリダクション


Red Hat Insights は、Insights コアコレクションを使用してデータ収集を処理します。.cache.json、.uploader.json などの限定的な JSON ファイルやシェルスクリプトに代わって、リダクションを目的としてコアコレクションが使用されます。さらに、コアコレクションは以下の特徴があります。

  • Insights クライアント 3.0 以降と互換性があります。
  • YAML ファイルを使用して、編集するコマンドとファイルを決定します。
  • 堅牢な Python データクリーニングプロセスを使用します。
  • データソース を使用した複雑なデータ収集をサポートし、uploader.json やシェルスクリプトなどの JSON ファイルの使用に伴う制限を回避します。
  • より簡単に管理できるデータソースを使用して、どのデータソースが insights-core の一部であるかを知ることができます。

Red Hat Insights クライアントのコアコレクション、データソース、およびコレクションルールの詳細は、次のリソースを参照してください。

重要

Red Hat では .cache.json および uploader.json ファイルを使用したデータの編集をサポートしません。代わりに データソース を使用してください。

個人を特定できる情報 (PII) の収集を防止する

Red Hat Insights for Red Hat Enterprise Linux は、個人を特定できる情報 (PII) を含む可能性のあるデータを含め、最小限のデータを収集します。PII (またはその他の設定データ) が収集されないようにするには、データリダクションを適用します。

Red Hat Insights for Red Hat Enterprise Linux がデータ収集を処理する方法は、Red Hat Insights データおよびアプリケーションセキュリティー を参照してください。

6.1. 必要なリダクション YAML ファイルの作成と設定

Red Hat Insights でデータを編集するには、Insights クライアント 3.0 と、リダクションアクションを制御するための次の YAML 設定ファイルが必要です。

  • file-redaction.yaml
  • file-content-redaction.yaml

リダクションするコンテンツに合わせて、1 つまたは両方のファイルを使用できます。

編集する項目を見つけるために、Insights クライアントは、insights-client.conf 設定ファイルのデフォルト設定を使用して、file-redaction.yaml および file-content-redaction.yaml ファイルを呼び出します。次の例は insights-client.conf ファイル内のリダクションのデフォルト設定の例を示しています。

Copy to Clipboard Toggle word wrap
# Location of the redaction file for commands, files, and components
#redaction_file=/etc/insights-client/file-redaction.yaml

# Location of the redaction file for patterns and keywords
#content_redaction_file=/etc/insights-client/file-content-redaction.yaml

insights-client.conf ファイルの設定を変更する必要はありませんが、YAML ファイルを作成する必要があります。

重要

Red Hat は、データをリダクションする remove.conf 設定ファイルの使用をサポートしなくなりました。

YAML ファイルの仕組み

Insights クライアントの /etc/insights-client/file-redaction.yaml ファイルには、リダクションを適用するコマンドとファイルがリストされます。Python データクリーニングプロセスは file-redaction.yaml ファイルで実行され、リストされているコマンドとファイルにリダクションを適用します。

注記

Python データクリーニングプロセスが実行されると、指定されたコンテンツがアーカイブファイルに追加される前に、リダクションが適用されます。

/etc/insights-client/file-content-redaction.yaml は、パターンのリダクションとキーワードの置換を定義します。パターンリダクションの場合、プロセスは、YAML ファイルで指定されたものと一致するパターンまたは正規表現をリダクションします。キーワード置換の場合、プロセスは指定されたキーワードを汎用識別子に置き換えます。

6.1.1. コマンドとシステムファイルをリダクションするための file-redaction.yaml の設定

/etc/insights-client/file-redaction.yaml ファイルを作成し、リダクションを適用するコマンドとシステムファイルのリストを含めることができます。データのリダクションが行われると、Python データクリーニングプロセスが実行され、YAML ファイルの内容が分析されます。

注記

リストされたコマンドまたはファイルの出力は、アップロードされたアーカイブファイルに含まれません。

前提条件

  • YAML 構文の基本を理解している。YAML の詳細は、yaml.org を参照してください。
  • システムへのルートレベルのアクセスがある。

手順

  1. エディターを使用して /etc/insights-client/file-redaction.yaml ファイルを作成します。
  2. YAML ファイル内の別々の行に、文字列 files:commands: を入力します。

    Copy to Clipboard Toggle word wrap
    files:
    
    
    commands:
  3. リダクションを適用するファイルおよびコマンドを指定します。

    1. files: の次の行に、リダクションするファイルを入力します。Datasources catalog の情報を使用して、指定するファイルとコマンドを識別します。たとえば、auditd.conf ファイルをリダクションする場合は、次のようになります。

      Copy to Clipboard Toggle word wrap
      files:
        - /etc/audit/auditd.conf
    2. commands: の後の行に、リダクションするコマンドを入力します。Datasources catalog の情報を使用して、指定するコマンドを識別します。たとえば、ethtool -i コマンドをリダクションする場合は、次のようになります。

      Copy to Clipboard Toggle word wrap
      commands:
        - ethtool_i
  4. YAML ファイルを /etc/insights-client/ に保存します。
  5. コマンドラインで ll file-redaction.yaml を root として実行して、file-redaction.yaml ファイルの権限が root 所有者のみであることを確認します。

    Copy to Clipboard Toggle word wrap
    [root@insights]# ll file-redaction.yaml
    -rw-------. 1 root root 145 Sep 25 17:39 file-redaction.yaml

コメント付きの file-redaction.yaml ファイルの例

次の例は、リダクションを適用するコマンドとファイルを含むサンプルの file-redaction.yaml ファイルを示しています。コメント (行頭にハッシュ記号 (#) がある) も YAML ファイルの設定で便利なガイドとなります。

Copy to Clipboard Toggle word wrap
# file-redaction.yaml
---
# Redact the entire output of commands
# Specify commands by either full command or by the "symbolic_name" like “ethtool_i.”
# Refer to the “Datasource Catalog” and “General Datasources” at https://insights-core.readthedocs.io/en/latest/specs_catalog.html#general-datasource for a full list of available symbolic_names, and the commands and files they correspond to.

 commands:
- /bin/rpm -qa
- /bin/ls
- ethtool_i

# Redact the entire output of files
# Specify files either by full filename or
by the "symbolic_name" for example, “cluster_conf.”
# Refer to the “Datasource Catalog” and “General Datasources” at https://insights-core.readthedocs.io/en/latest/specs_catalog.html#general-datasource for a full list of available symbolic_names, and the commands and files they correspond to.

files:
- /etc/audit/auditd.conf
- cluster_conf

検証手順

リダクションファイルが機能していることを確認するには、--no-upload オプションを指定して insights-client コマンドを実行し、コンソールまたはターミナルで出力メッセージを確認します。

  1. コマンドラインで、--no-upload オプションを指定して insights-client コマンドを入力し、Return を押します。

    Copy to Clipboard Toggle word wrap
    [root@insights]# insights-client --no-upload
  2. コマンドが実行され、情報メッセージが表示されます。次の例は、dmesg コマンドと cluster.conf ファイルのリダクションを示しています。

    Copy to Clipboard Toggle word wrap
    WARNING: Excluding data from files
    Starting to collect Insights data for I-HOST
    WARNING: Skipping command /bin/dmesg
    WARNING: Skipping file /etc/cluster/cluster.conf
    Archive saved at /var/tmp/qsINM9/insights-ITC-4-20190925180232.tar.gz

生成されたアーカイブファイルは /var/tmp に保存されますが、Red Hat にアップロードされません。

6.1.2. YAML パターンおよびキーワードリダクションの設定

/etc/insights-client/file-content-redaction.yaml ファイルは、パターンリダクションとキーワード置換の 2 つの方法を使用してファイルをリダクションします。パターンリダクションは、パターンマッチまたは正規表現マッチのいずれかを使用します。キーワード置換では、Python データクリーニングプロセスによってキーワードが汎用識別子に置き換えられます。

前提条件

  • YAML 構文の基本を理解している。YAML の説明は、この手順の範囲外です。
  • システムへのルートレベルのアクセスがある。

手順

  1. エディターを使用して /etc/insights-client/file-content-redaction.yaml ファイルを作成します。

    Copy to Clipboard Toggle word wrap
    # file-content-redaction.yaml
    ---
    # Pattern redaction per matching line
    #  Lines that match a pattern are excluded from files and command output.
    #  Patterns are processed in the order that they are listed.
    # Example
    
    patterns:
     - "a_string_1"
     - "a_string_2"
    
    # Regular expression pattern redaction per line
    #  Use "regex:" to wrap patterns with regular expressions"
    # Example
    
    patterns:
     regex:
     - "abc.*def"
     - "localhost[[:digit:]]"
    
    
    # Keyword replacement redaction
    #  Replace keywords in files and command output with generic identifiers
    #  Keyword does not support regex
    # Example
    
    keywords:
    - "1.1.1.1"
    - "My Name"
    - "a_name"

  2. file-content-redaction.yaml ファイルのパーミッションが root 所有者にのみ設定されていることを確認してください。

    Copy to Clipboard Toggle word wrap
    [root@insights]# ll file-content-redaction.yaml
    -rw-------. 1 root root 145 Sep 25 17:39 file-content-redaction.yaml
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat, Inc.