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

Linux post libs comments and specs #19682

Merged
merged 17 commits into from
Feb 28, 2025

Conversation

h00die
Copy link
Contributor

@h00die h00die commented Nov 27, 2024

This PR does a few things for linux post libs:

  1. adds function comments
  2. adds specs
  3. creates a new packages module which can be used to check what version of a package is installed. Ubuntu needrestart LPE (CVE-2024-48990) #19676 (comment)
  4. rubocops the libraries

Copy link
Contributor

@cdelafuente-r7 cdelafuente-r7 left a comment

Choose a reason for hiding this comment

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

Thank you @h00die for adding documentation and specs. I just added a couple of comments.

return Rex::Version.new(package_version)
elsif ['redhat', 'fedora'].include?(info[:distro])
package_version = cmd_exec("rpm -q #{package}")
return nil if package_version.include?('is not installed')
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't tested it, but I'm wondering if rpm returns a message in English on a non-English installation.

This also applies to the system commands called in this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good thinking, I'm not sure

Copy link
Contributor

Choose a reason for hiding this comment

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

From my initial testing, it seems like the message changes based on the language. One way could be to use rpm -V [package name] or rpm -qa | grep [package name]. However, I think these solutions would require to run first check for presence and then fetching the version.

@h00die
Copy link
Contributor Author

h00die commented Nov 28, 2024

Appreciate, I'm going to get specs working for all the linux post libs before putting this up for official review. Good question about language though

@h00die
Copy link
Contributor Author

h00die commented Dec 2, 2024

While this is in draft, it's going to be a little bit of a headache, lots of stuff going on. prob not worth reviewing till its out of draft tbh

@h00die
Copy link
Contributor Author

h00die commented Dec 11, 2024

Ready for review, 5 tests are failing for more or less the same thing. @smcintyre-r7 was trying to help me with this, but I'll need more help getting session emulation working correctly.

@h00die h00die marked this pull request as ready for review December 11, 2024 22:55
@msutovsky-r7 msutovsky-r7 self-assigned this Feb 6, 2025
@h00die
Copy link
Contributor Author

h00die commented Feb 12, 2025

session issues resolved. merged all the changes since this thing was originally submitted to resolve a conflict

Copy link
Contributor

@msutovsky-r7 msutovsky-r7 left a comment

Choose a reason for hiding this comment

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

Hi @h00die , did you check output of the commands for different language variants of distributions? If we can use English phrases as checks for presence of package.

@h00die
Copy link
Contributor Author

h00die commented Feb 20, 2025

Hi @h00die , did you check output of the commands for different language variants of distributions? If we can use English phrases as checks for presence of package.

I was able to verify Ubuntu (German), Fedora (German), Gentoo (German). I picked German because it seemed less likely to have character/word overlap with English.

Copy link
Contributor

@msutovsky-r7 msutovsky-r7 left a comment

Choose a reason for hiding this comment

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

Awesome @h00die , I don't have any additional questions/comments. If you're not planning to add any other changes, I can merge it.

@h00die
Copy link
Contributor Author

h00die commented Feb 27, 2025

i'm happy with it at this point!

@msutovsky-r7 msutovsky-r7 merged commit 36b13f5 into rapid7:master Feb 28, 2025
62 checks passed
@msutovsky-r7 msutovsky-r7 added the rn-no-release-notes no release notes label Feb 28, 2025
@msutovsky-r7 msutovsky-r7 added rn-enhancement release notes enhancement and removed rn-no-release-notes no release notes labels Feb 28, 2025
@msutovsky-r7
Copy link
Contributor

Release Notes

This update is landed in commit
36b13f5 - there's typo in the commit name mentioning incorrect pull request. This pull requests add additional tests for Linux post functionality along with additional comments for better understanding and adds new library for work with Linux packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library rn-enhancement release notes enhancement tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants