搜索

1.7. 生成一个sos 报告,并使用基于一个密钥对的 GPG 加密对其进行保护

download PDF

这个步骤描述了如何根据 GPG 密钥环中的密钥来生成 sos 报告并使用 GPG2 加密进行保护。您可以使用这种加密方式来保护 sos 报告的内容,例如您需要保护保存在一个服务器中的 sos 报告内容。

注意

确定您在创建加密的 sos 报告时有足够的空间,因为它会临时使用双倍磁盘空间:

  1. sos 工具会创建一个未加密的 sos 报告。
  2. 该工具将 sos 报告加密作为一个新文件。
  3. 然后,这个工具会删除未加密的报告。

先决条件

  • 您已安装了 sos 软件包。
  • 您需要 root 权限。
  • 您已创建了 GPG2 密钥。

步骤

  1. 运行 sos report 命令,并使用 --encrypt-key 选项指定拥有 GPG 密钥环的用户名。您可以添加 --upload 选项,以在生成后将 sos 报告立即转移到红帽。

    注意

    运行 sos report 命令的用户必须是拥有用于加密和解密 sos 报告的 GPG 密钥环的用户。如果用户使用 sudo 运行 sos report 命令,还必须使用 sudo 设置密钥环,或者用户必须具有对该帐户的直接 shell 访问权限。

    [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. (可选) 如果您已经向红帽创建了技术支持问题单,请输入问题单号将其嵌入到 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
    sha256  bf303917b689b13f0c059116d9ca55e341d5fadcd3f1473bef7299c4ad2a7f4f
    
    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
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.