OwlCyberDefense / setools

setools has moved to https://github.com/SELinuxProject/setools
Other
91 stars 34 forks source link

ability to match subset permissions #57

Closed bachradsusi closed 9 years ago

bachradsusi commented 9 years ago

I'm working on rewrite policycoreutils to use setools4 and for 'sepolicy communicate' I need to make a query which will match a subset ["open", "write"] of permissions.

setools.TERuleQuery(p, ruletype=["allow"], source="httpd_t", tclass=["file"], perms=["open","write"])

gets rules which have "open" or "write" permission

setools.TERuleQuery(p, ruletype=["allow"], source="httpd_t", tclass=["file"], perms=["open","write"], perms_equal=True)

gets rules which have only "open" and "write" permissions

But I haven't found how to create a query which would match rules with "open" and "write". If there's no such option, could be something added? E.g via keyword perms_subset.

pebenito commented 9 years ago

There isn't currently support for match on subset of permissions, but it can be added.

https://github.com/TresysTechnology/setools/blob/master/setools/mixins.py#L71