1.7. sos レポートの生成と、キーペアをベースにした GPG 暗号化によるセキュリティー保護

この手順では、sos レポートを生成し、GPG キーリングからのキーペアをベースにした GPG2 暗号化を使用してセキュリティーを確保する方法を説明します。サーバーに保存されている sos レポートを保護する場合などに、この種類の暗号化を使用して sos レポートの内容を保護することが推奨されます。

注記

暗号化した sos レポートを作成する場合には、ディスク領域の倍の容量を一時的に使用するため、十分な領域を確保してください。

  1. sos ユーティリティーは、暗号化されていない sos レポートを作成します。
  2. このユーティリティーは、sos レポートを新しいファイルとして暗号化します。
  3. 次に、ユーティリティーは暗号化されていないアーカイブを削除します。

前提条件

  • sos パッケージをインストールしている。
  • root 権限がある。
  • GPG2 キーを作成している。

手順

  1. sos report コマンドを実行し、--encrypt-key オプションで GPG キーリングを所有するユーザー名を指定します。--upload オプションを追加すると、sos レポートの生成直後にレポートを Red Hat に転送できます。

    注記

    sos report コマンドを実行するユーザーは、sos レポートの暗号化および復号に使用する GPG キーリングの所有者と同じユーザーで なければなりません。ユーザーが sudo を使用して sos report コマンドを実行する場合は、sudo でキーリングを設定するか、ユーザーがそのアカウントに直接シェルアクセスできる必要があります。

    [user@server1 ~]$ sudo sos report --encrypt-key root
    [sudo] password for user:
    
    sosreport (version 4.2)
    
    This command will collect diagnostic and configuration information from
    this Red Hat Enterprise Linux system and installed applications.
    
    An archive containing the collected information will be generated in
    /var/tmp/sos.6ucjclgf and may be provided to a Red Hat support
    representative.
    
    ...
    
    Press ENTER to continue, or CTRL-C to quit.
  2. (オプション) Red Hat でテクニカルサポートケースをすでに作成している場合には、ケース番号を入力して sos レポートファイルの名前に追加します。--upload オプションを指定している場合は、対象のケースにアップロードされます。ケース番号がない場合は、このフィールドを空白にしておきます。ケース番号の入力は任意であるため、sos ユーティリティーの動作には影響はありません。

    Please enter the case id that you are generating this report for []: <8-digit_case_number>
  3. コンソール出力の末尾に表示されている sos レポートファイルの名前を書き留めておきます。

    ...
    Finished running plugins
    Creating compressed archive...
    
    Your sosreport has been generated and saved in:
    /var/tmp/secured-sosreport-server1-23456789-2022-02-27-zhdqhdi.tar.xz.gpg
    
    Size    15.44MiB
    Owner   root
    md5     ac62697e33f3271dbda92290583d1242
    
    Please send this file to your support representative.

検証手順

  1. sos ユーティリティーで、以下の要件を満たすアーカイブが作成されたことを確認します。

    • ファイル名が secured で始まる。
    • ファイル名が .gpg 拡張子で終わる。
    • /var/tmp/ ディレクトリーにある。

      [user@server1 ~]$ sudo ls -l /var/tmp/sosreport*
      [sudo] password for user:
      -rw-------. 1 root root 16190013 Jan 24 17:55 /var/tmp/secured-sosreport-server1-23456789-2022-01-27-zhdqhdi.tar.xz.gpg
  2. 暗号化に使用したキーと同じキーでアーカイブを復号できることを確認します。

    1. gpg コマンドを使用して、アーカイブを復号します。

      [user@server1 ~]$ sudo gpg --output decrypted-sosreport.tar.gz --decrypt /var/tmp/secured-sosreport-server1-23456789-2022-01-27-zhdqhdi.tar.xz.gpg
    2. プロンプトが表示されたら、GPG キーの作成に使用したパスフレーズを入力します。

      ┌────────────────────────────────────────────────────────────────┐
      │ Please enter the passphrase to unlock the OpenPGP secret key:  │
      │ "GPG User (first key) <root@example.com>"                      │
      │ 2048-bit RSA key, ID BF28FFA302EF4557,                         │
      │ created 2020-01-13.                                            │
      │                                                                │
      │                                                                │
      │ Passphrase: <passphrase>                                       │
      │                                                                │
      │         <OK>                                    <Cancel>       │
      └────────────────────────────────────────────────────────────────┘
    3. gpg ユーティリティーが、暗号化されていない、ファイル拡張子が .tar.gz のアーカイブを生成したことを確認します。

      [user@server1 ~]$ sudo ll decrypted-sosreport.tar.gz
      [sudo] password for user:
      -rw-r--r--. 1 root root 16190013 Jan 27 17:47 decrypted-sosreport.tar.gz