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

Octal Permissions Match #666

Closed
fcaviggia opened this issue Apr 19, 2016 · 2 comments
Closed

Octal Permissions Match #666

fcaviggia opened this issue Apr 19, 2016 · 2 comments

Comments

@fcaviggia
Copy link

Description

Inspec should be able to allow more restrictive permissions in checking the octal permission value of a file. For example, the following test should work:

describe file('/etc/shadow') do
  it { should be_file }
  its('mode') { should match (/0(0|4)00/) }
end

This test should allow the check to allow either 0000 or 0400 as valid.

InSpec and Platform Version

$ inspec version
0.14.2

@arlimus
Copy link
Contributor

arlimus commented Apr 20, 2016

@fcaviggia Mode comes in the form of an integer, which makes means that you cannot match it to a regex. Even with the integer-regex matcher in #667, it remains tricky, since mode comes in the form of an octal. @alexpop presented one workaround via mode.to_s(8) and cmp in that MR. Another would require a special matcher for mode...

@fcaviggia
Copy link
Author

Very awesome work - I saw the commits a few seconds ago! That will allow me to compare for more restrictive permissions (which should satisfy requirements).

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

No branches or pull requests

2 participants