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

add attributes to exclude fstypes and paths from suid_check find #94

Closed
wants to merge 1 commit into from
Closed

Conversation

mattlqx
Copy link
Contributor

@mattlqx mattlqx commented May 31, 2018

This profile has been blocking systems with network mounts for extended periods because find walks all of /. This pull by default will ignore network filesystems in the find as well as /sys, /proc and /var/lib/lxd/containers. They are also able to be overriden with the find_exclude_paths and find_exclude_fstypes attributes. This should speed up the profile execute greatly on systems with large network mounts.

Fixes #53 #78

@mattlqx
Copy link
Contributor Author

mattlqx commented May 31, 2018

Is there a reason rubocop is still set to ruby 1.9? Can it be increased to something like 2.2?

@chris-rock chris-rock requested a review from atomic111 May 31, 2018 17:38
@chris-rock
Copy link
Member

We should bump rubocop and the ruby version

Copy link
Member

@chris-rock chris-rock 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 @mattlqx for that proposed solution. Let me think about the breaking change behaviour

output.stdout.split(/\r?\n/)
end

def exclude_fstype_paths
mounts = inspec.command('mount')
Copy link
Member

Choose a reason for hiding this comment

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

Should we open a ticket in inspec to expose their point parsing? https://github.com/inspec/inspec/blob/master/lib/resources/mount.rb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It appears they're just inspecting files to see if they are mounts and getting their options from mount if so (https://github.com/inspec/inspec/blob/master/lib/resources/file.rb#L94), rather than parsing all mounts. I don't think the two are really compatible. Individual objects vs. "walking" mounts.

@exclude_paths = exclude_paths || default_exclude_paths
end

def default_exclude_fstypes
Copy link
Member

Choose a reason for hiding this comment

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

By adding those, we change the default behaviour, which results in a breaking change. @arlimus @atomic111 we have two options:

  • release a new major version
  • keep the old behaviour but allow the override
    What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My $0.02 is that it should be the default behavior and have a major version bump because the current default of walking network filesystems is prohibitively expensive and redundant when you have a lot of nodes mounting the same share. If you're using the audit cookbook to run this profile in that scenario, some nodes could take longer than the Chef run interval to even complete. If you're using push jobs on large groups, the job will take as long as the longest node, so using the current version of this profile has increased deploy times as well. IMO, if you want to check network shares for SUID, that should be done by a single ad-hoc process somewhere.

@atomic111
Copy link
Member

@mattlqx and @chris-rock i like this approach, but then we should check the mount point that they are mounted with nosuid. Then this solution would work without decreasing the security aspects of it. This means we need a control that checks the fstab and the current mounted filesystems, like nfs, nfs4 and so on.
after we merged this, we also should bump it to a new major version

This profile has been blocking systems with network mounts for extended periods because find walks all of /. This pull by default will ignore network filesystems in the find as well as /sys, /proc and /var/lib/lxd/containers. They are also able to be overriden with the `find_exclude_paths` and `find_exclude_fstypes` attributes. This should speed up the profile execute greatly on systems with large network mounts.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
@mattlqx mattlqx closed this Oct 22, 2019
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.

Permission search takes too long
3 participants