Suppress rule generation for dontaudit rules
PATCH 1/1 Suppress rule generation for dontaudit rules
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
---
sepolgen/src/sepolgen/policygen.py +2 -0
@@ -139,6 +139,8 @@ class PolicyGenerator: def __add_allow_rules(self, avs): for av in avs: + if not av.denial: + continue rule = refpolicy.AVRule(av) if self.explain: rule.comment = refpolicy.Comment(explain_access(av, verbosity=self.explain))
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 10 lines · Karl MacMillan
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
Signed-off-by User "Karl MacMillan <[email protected]>"---
diff -r
56dbe9166d98-r2ad2d21fc724sepolgen/src/sepolgen/policygen.py
sepolgen/src/sepolgen/policygen.py class PolicyGenerator: · line 146
Quoted 8 lines
sepolgen/src/sepolgen/policygen.py +2
-0@@ -139,6 +139,8 @@ class PolicyGenerator: def __add_allow_rules(self, avs): for av in avs: + if not av.denial: + continue rule = refpolicy.AVRule(av) if self.explain: rule.comment = refpolicy.Comment(explain_access(av, verbosity=self.explain))
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Joshua Brindle
AppliedQuoted 12 lines · Stephen Smalley
Quoted 10 lines · Karl MacMillan
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
Signed-off-by User "Karl MacMillan <[email protected]>"---
diff -r
56dbe9166d98-r2ad2d21fc724sepolgen/src/sepolgen/policygen.pysepolgen/src/sepolgen/policygen.py +0
-0@@ -139,6 +139,8 @@ class PolicyGenerator:
Quoted 12 lines
sepolgen/src/sepolgen/policygen.py class PolicyGenerator: · line 146
Quoted 9 lines
sepolgen/src/sepolgen/policygen.py +2
-0def __add_allow_rules(self, avs): for av in avs: + if not av.denial: + continue rule = refpolicy.AVRule(av) if self.explain: rule.comment = refpolicy.Comment(explain_access(av, verbosity=self.explain))Acked-by Stephen Smalley <[email protected]>
Merged into 1.0.9
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 26 lines · Joshua Brindle
Quoted 12 lines · Stephen Smalley
Quoted 10 lines · Karl MacMillan
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
Signed-off-by User "Karl MacMillan <[email protected]>"---
diff -r
56dbe9166d98-r2ad2d21fc724sepolgen/src/sepolgen/policygen.pysepolgen/src/sepolgen/policygen.py +0
-0@@ -139,6 +139,8 @@ class PolicyGenerator:Quoted 12 lines
sepolgen/src/sepolgen/policygen.py class PolicyGenerator: · line 146
Quoted 9 lines
sepolgen/src/sepolgen/policygen.py +2
-0def __add_allow_rules(self, avs): for av in avs: + if not av.denial: + continue rule = refpolicy.AVRule(av) if self.explain: rule.comment = refpolicy.Comment(explain_access(av, verbosity=self.explain))Acked-by Stephen Smalley <[email protected]>
Quoted 1 line
Merged into 1.0.9
Reverted. Didn't work.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Joshua Brindle
Quoted 4 lines · Stephen Smalley
Quoted 2 lines · Karl MacMillan
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
[...]
Quoted 5 lines
Quoted 2 lines
Merged into 1.0.9
Reverted. Didn't work.
That's because it was wildly wrong - I thought I tested that, but I guess not. Correct patch below:
sepolgen/src/sepolgen/audit.py +2 -0
@@ -421,6 +421,8 @@ class AuditParser: """ av_set = access.AccessVectorSet() for avc in self.avc_msgs: + if avc.denial == True: + continue if avc_filter: if avc_filter.filter(avc): av_set.add(avc.scontext.type, avc.tcontext.type, avc.tclass,
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 31 lines · Karl MacMillan
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Joshua Brindle
Quoted 4 lines · Stephen Smalley
Quoted 2 lines · Karl MacMillan
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
[...]
Quoted 5 lines
Quoted 2 lines
Merged into 1.0.9
Reverted. Didn't work.
That's because it was wildly wrong - I thought I tested that, but I guess not. Correct patch below:
diff -r
e962f4f773fcsepolgen/src/sepolgen/audit.pysepolgen/src/sepolgen/audit.py +2
-0@@ -421,6 +421,8 @@ class AuditParser: """ av_set = access.AccessVectorSet() for avc in self.avc_msgs: + if avc.denial == True: + continue if avc_filter: if avc_filter.filter(avc): av_set.add(avc.scontext.type, avc.tcontext.type, avc.tclass,
Quoted 1 line
Signed-off-by Karl MacMillan <[email protected]>
Causes all avc messages to be discarded, yielding no output from audit2allow -a (with a number of avc messages in audit.log). NAK. Third time's the charm?
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 32 lines · Stephen Smalley
Quoted 31 lines · Karl MacMillan
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Joshua Brindle
Quoted 4 lines · Stephen Smalley
Quoted 2 lines · Karl MacMillan
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
[...]
Quoted 5 lines
Quoted 2 lines
Merged into 1.0.9
Reverted. Didn't work.
That's because it was wildly wrong - I thought I tested that, but I guess not. Correct patch below:
diff -r
e962f4f773fcsepolgen/src/sepolgen/audit.pysepolgen/src/sepolgen/audit.py +2
-0@@ -421,6 +421,8 @@ class AuditParser: """ av_set = access.AccessVectorSet() for avc in self.avc_msgs: + if avc.denial == True: + continue if avc_filter: if avc_filter.filter(avc): av_set.add(avc.scontext.type, avc.tcontext.type, avc.tclass,
Quoted 6 lines
Quoted 1 line
Signed-off-by Karl MacMillan <[email protected]>Causes all avc messages to be discarded, yielding no output from audit2allow -a (with a number of avc messages in audit.log). NAK. Third time's the charm?
We can hope - this version includes a test. If this isn't right someone else will have to fix this bug.
Suppress rule generation for dontaudit rules.
The current policy generation code incorrectly generates allow rules for dontaudit messages. This patch fixes that.
sepolgen/src/sepolgen/audit.py +3 -1
@@ -402,7 +402,7 @@ class AuditParser: self.__parse(l) self.__post_process() - def to_access(self, avc_filter=None): + def to_access(self, avc_filter=None, only_denials=True): """Convert the audit logs access into a an access vector set. Convert the audit logs into an access vector set, optionally
@@ -421,6 +421,8 @@ class AuditParser: """ av_set = access.AccessVectorSet() for avc in self.avc_msgs: + if avc.denial != True and only_denials: + continue if avc_filter: if avc_filter.filter(avc): av_set.add(avc.scontext.type, avc.tcontext.type, avc.tclass,
sepolgen/tests/test_audit.py +41 -0
57 lines not on this page · raw message
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.