1.7. Generating an sos report and securing it with GPG encryption based on a keypair
This procedure describes how to generate an sos report and secure it with GPG2 encryption based on a keypair from a GPG keyring. You might want to secure the contents of an sos report with this type of encryption if, for example, you want to protect an sos report stored on a server.
Ensure you have sufficient space when creating an encrypted sos report, as it temporarily uses double the disk space:
-
The
sosutility creates an unencryptedsosreport. -
The utility encrypts the
sosreport as a new file. - The utility then removes the unencrypted archive.
Prerequisites
-
You have installed the
sospackage. -
You need
rootprivileges. - You have created a GPG2 key.
Procedure
Run the
sos reportcommand and specify the user name that owns the GPG keyring with the--encrypt-keyoption. You can add the--uploadoption to transfer thesosreport to Red Hat immediately after generating it.참고The user running the
sos reportcommand must be the same user that owns the GPG keyring used to encrypt and decrypt thesosreport. If the user usessudoto run thesos reportcommand, the keyring must also be set up usingsudo, or the user must have direct shell access to that account.[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.Optional: If you have already opened a Technical Support case with Red Hat, enter the case number to embed it in the
sosreport file name, and it will be uploaded to that case if you specified the--uploadoption. If you do not have a case number, leave this field blank. Entering a case number is optional and does not affect the operation of thesosutility.Please enter the case id that you are generating this report for []: <8-digit_case_number>Take note of the
sosreport file name displayed at the end of the console output.... 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.
Verification
Verify that the
sosutility created an archive meeting the following requirements:-
File name starts with
secured. -
File name ends with a
.gpgextension. Located in the
/var/tmp/directory.[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
-
File name starts with
Verify you can decrypt the archive with the same key you used to encrypt it.
Use the
gpgcommand to decrypt the archive.[user@server1 ~]$ sudo gpg --output decrypted-sosreport.tar.gz --decrypt /var/tmp/secured-sosreport-server1-23456789-2022-01-27-zhdqhdi.tar.xz.gpgWhen prompted, enter the passphrase you used when creating the GPG key.
┌────────────────────────────────────────────────────────────────┐ │ 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> │ └────────────────────────────────────────────────────────────────┘Verify that the
gpgutility produced an unencrypted archive with a.tar.gzfile extension.[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