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

Fix hostname plugin for RedHat systems #513

Merged
merged 10 commits into from
Jan 31, 2024
Merged

Conversation

florisvanstal
Copy link
Contributor

Wrote as fix for ticket DIS-2796, where the hostname could not be found for Red Hat systems. The hostname for these files is instead of /etc/hostname found within /etc/sysconfig/network.

@florisvanstal florisvanstal marked this pull request as draft January 23, 2024 16:47
@florisvanstal florisvanstal marked this pull request as ready for review January 23, 2024 16:49
@cecinestpasunepipe cecinestpasunepipe self-requested a review January 23, 2024 18:01
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9aec3c3) 73.76% compared to head (553adeb) 73.79%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #513      +/-   ##
==========================================
+ Coverage   73.76%   73.79%   +0.03%     
==========================================
  Files         276      276              
  Lines       22997    23012      +15     
==========================================
+ Hits        16963    16981      +18     
+ Misses       6034     6031       -3     
Flag Coverage Δ
unittests 73.79% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pyrco pyrco left a comment

Choose a reason for hiding this comment

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

florisvanstal and others added 5 commits January 25, 2024 16:27
The functionality of the injected target is not RedHat specific, hence a target of type Unix is more fitting. Changed therefore the injected target for the tests to be Unix.
(#DIS-2796)
…type path

This commit removes a redundant conversion from str to Path. These can be better compared through getting a string representation from a Path, which is less expensive.
@florisvanstal florisvanstal changed the title Added fix as per #DIS-2796 Fix hostname plugin to retrieve the hostname from the correct file for Redhat systems Jan 25, 2024
These tests cover cases where the path supplied does not match the expected path or the file is empty. These test cases highlighted bugs introduced from past commits, which are also fixed in this commit.
Copy link
Contributor

@cecinestpasunepipe cecinestpasunepipe left a comment

Choose a reason for hiding this comment

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

Tested on RH 7, works.

@florisvanstal florisvanstal requested a review from pyrco January 29, 2024 16:01
@Schamper Schamper changed the title Fix hostname plugin to retrieve the hostname from the correct file for Redhat systems Fix hostname plugin for RedHat systems Jan 29, 2024
@pyrco pyrco merged commit 0a8e69d into fox-it:main Jan 31, 2024
16 checks passed
Poeloe pushed a commit that referenced this pull request Feb 29, 2024
Zawadidone pushed a commit to Zawadidone/dissect.target that referenced this pull request Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants