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

Change local and remote file system detection #1573

Merged
merged 3 commits into from Aug 19, 2020

Conversation

jan-cerny
Copy link
Member

@jan-cerny jan-cerny commented Aug 18, 2020

The previous way was unreliable because some remote file systems were
detected as local. For example, the SMB mounts that used paths with
backslashes were not recognized as remote file systems. The getmntent
function returns a file system type, so we can use it for detection of
remote file systems.

The new solution is inspired by systemd, function fstype_is_network:
https://github.com/systemd/systemd/blob/21fd6bc263f49b57867d90d2e1f9f255e5509134/src/basic/mountpoint-util.c#L290

It also handles FUSE file systems. Also, we are cancelling the TODO idea
of providing the data at the build time and removing the dead code (if
0).

GPFS is also treated as remote system because we have multiple reports that GPFS shouldn't be scanned.

Resolves: RHBZ#1869195, RHBZ#1870087, RHBZ#1840575, RHBZ#1840578

The previous way was unreliable because some remote file systems were
detected as local. For example, the SMB mounts that used paths with
backslashes were not recognized as remote file systems.  The `getmntent`
function returns a file system type, so we can use it for detection of
remote file systems.

The new solution is inspired by systemd, function `fstype_is_network`:
https://github.com/systemd/systemd/blob/21fd6bc263f49b57867d90d2e1f9f255e5509134/src/basic/mountpoint-util.c#L290

It also handles FUSE file systems. Also, we are canceling the TODO idea
of providing the data at the build time and removing the dead code (if
0).

Resolves: RHBZ#1869195
const char *fstype = ment->mnt_type;
if (oscap_str_startswith(fstype, "fuse.")) {
fstype += strlen("fuse.");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great. I would suggest to add a comment that points to the source of the inspiration, so it could be easily revised later.
Alternatively, we could consider calling the systemd function if it is possible, but that may be too risky, so maybe not.

Copy link
Member Author

Choose a reason for hiding this comment

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

@matejak I have added a comment.

"ncpfs",
"ncp",
"nfs",
"nfs4",
Copy link
Contributor

Choose a reason for hiding this comment

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

We have an issue with gpfs filesystems, so I would add that one here. This link indicates that gpfs is the right type string: https://www.ibm.com/developerworks/systems/library/es-gpfs/index.html

Copy link
Member Author

Choose a reason for hiding this comment

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

@matejak I have added gpfs to the list.

that points out to the original source for reference
This link indicates that gpfs is the right type string:
https://www.ibm.com/developerworks/systems/library/es-gpfs/index.html

Resolves: RHBZ#1840575, RHBZ#1840578
@jan-cerny jan-cerny added this to the 1.3.4 milestone Aug 19, 2020
@jan-cerny jan-cerny marked this pull request as ready for review August 19, 2020 12:57
@matejak
Copy link
Contributor

matejak commented Aug 19, 2020

This is a nice, streamlined approach for the local/network logic. Thank you for the PR!

@matejak matejak merged commit 547b167 into OpenSCAP:maint-1.3 Aug 19, 2020
@jan-cerny jan-cerny deleted the rhbz1869195 branch August 20, 2020 07:09
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.

None yet

2 participants