simp / inspec-profile-disa_stig-el7

InSpec Profile for the EL7 DISA STIG
Apache License 2.0
22 stars 46 forks source link

Improve PAM resource matching ability #19

Closed samcornwell closed 6 years ago

samcornwell commented 6 years ago

The new PAM resource is a bit limited in the ability to match parameters against a range of numerical values (for example). A regular expression is required. One solution to this would be if PAM resource could match values using native matchers.

trevor-vaughan commented 6 years ago

@samcornwell Could you provide an example of this where the arguments are known? One of the reasons that I didn't go down this route was that you would need to know exactly what you are looking at. Or are you suggesting that, should we have a number, we try numeric matches and fall back to a regex if that raises an exception?

samcornwell commented 6 years ago

I'm just saying that something like with_args(/remember=(\d{2,}|[5-9])/) would be better if we could select the arg remember and apply the real construct >= 5 to its value somehow.

My ruby and RSpec foo are not good enough to know exactly how to do it most easily. I thought it would be ideal to be able to be able to select the arg inline (like is done with with_args) and apply one of the the native matchers to it, but I don't know if it's possible to do that easily. Perhaps one would have to define their own ops and pass those in, or chain them.

Maybe the best way would be to select the rules using a where, and iterate over those using a PamRule resource or structure. A new resource is more work than I intended to propose though.

samcornwell commented 6 years ago

fixed by #41