Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[collect] SosNode._format_cmd local node return without sudo/su when already root. #3838

Conversation

TrevorBenson
Copy link
Member

Resolves: #3827
Resolves: #3828


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

Passing Tests

  1. sudo sos collect --batch --nopasswd-sudo --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
  2. sos collect --batch --nopasswd-sudo --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
  3. sudo sos collect --batch --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
  4. sudo sos collect --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
  5. sos collect --ssh-key ~/.ssh/id_setasside --ssh-user project-user --nodes 192.168.124.121
  6. sudo sos collect --password --ssh-user project-user --nodes 192.168.124.121
  7. sudo sos collect --nopasswd-sudo --password --ssh-user project-user --nodes 192.168.124.121
  8. sos collect --password --ssh-user project-user --nodes 192.168.124.121
  9. sos collect --nopasswd-sudo --password --ssh-user project-user --nodes 192.168.124.121

I did not think of any use cases that need/expect to run sudo -S {cmd} or su -c {quote(cmd)} when already the root user, or already running sudo etc.. However, this change would prevent that from happening on the local node executing sos collect.

I don't believe this introduces any unwanted changes. However, please let me know if there are any other test case combinations you would like performed to feel comfortable before merging.

@TrevorBenson
Copy link
Member Author

@jcastill I believe this resolves both #3827 and #3828. I'd appreciate your input in case I overlooked something. Thanks

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3838
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@TrevorBenson TrevorBenson changed the title [collect] SosNode._fmt_cmd local node return without sudo/su when already root. [collect] SosNode._format_cmd local node return without sudo/su when already root. Nov 15, 2024
Copy link
Member

@jcastill jcastill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! LGTM

@arif-ali arif-ali merged commit 25f5e26 into sosreport:main Nov 16, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants