第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
ファイル内のリダクションのデフォルト設定の例を示しています。
Location of the redaction file for commands, files, and components Location of the redaction file for patterns and keywords
# 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 を参照してください。
- システムへのルートレベルのアクセスがある。
手順
-
エディターを使用して
/etc/insights-client/file-redaction.yaml
ファイルを作成します。 YAML ファイル内の別々の行に、文字列
files:
とcommands:
を入力します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow files: commands:
files: commands:
リダクションを適用するファイルおよびコマンドを指定します。
files:
の次の行に、リダクションするファイルを入力します。Datasources catalog の情報を使用して、指定するファイルとコマンドを識別します。たとえば、auditd.conf
ファイルをリダクションする場合は、次のようになります。Copy to Clipboard Copied! Toggle word wrap Toggle overflow files: - /etc/audit/auditd.conf
files: - /etc/audit/auditd.conf
commands:
の後の行に、リダクションするコマンドを入力します。Datasources catalog の情報を使用して、指定するコマンドを識別します。たとえば、ethtool -i
コマンドをリダクションする場合は、次のようになります。Copy to Clipboard Copied! Toggle word wrap Toggle overflow commands: - ethtool_i
commands: - ethtool_i
-
YAML ファイルを
/etc/insights-client/
に保存します。 コマンドラインで
ll file-redaction.yaml
を root として実行して、file-redaction.yaml
ファイルの権限がroot
所有者のみであることを確認します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow ll file-redaction.yaml
[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 ファイルの設定で便利なガイドとなります。
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. Redact the entire output of files Specify files either by full filename or 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.
# 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
コマンドを実行し、コンソールまたはターミナルで出力メッセージを確認します。
コマンドラインで、
--no-upload
オプションを指定してinsights-client
コマンドを入力し、Return を押します。Copy to Clipboard Copied! Toggle word wrap Toggle overflow insights-client --no-upload
[root@insights]# insights-client --no-upload
コマンドが実行され、情報メッセージが表示されます。次の例は、
dmesg
コマンドとcluster.conf
ファイルのリダクションを示しています。Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
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 の説明は、この手順の範囲外です。
- システムへのルートレベルのアクセスがある。
手順
エディターを使用して
/etc/insights-client/file-content-redaction.yaml
ファイルを作成します。例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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 Regular expression pattern redaction per line Use "regex:" to wrap patterns with regular expressions" Example Keyword replacement redaction Replace keywords in files and command output with generic identifiers Keyword does not support regex Example
# 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"
file-content-redaction.yaml
ファイルのパーミッションがroot
所有者にのみ設定されていることを確認してください。Copy to Clipboard Copied! Toggle word wrap Toggle overflow ll file-content-redaction.yaml
[root@insights]# ll file-content-redaction.yaml -rw-------. 1 root root 145 Sep 25 17:39 file-content-redaction.yaml