Commit Graph

13 Commits

Author SHA1 Message Date
Chris PeBenito
78a15c92ac Nodecon: Implement network property.
The network property will return an IPv4Network or IPv6Network based on the
nodecon.  If the policy has host bits set, the ipaddress module will
simply ignore the host bits, so there may be unexpected results in network
comparisons.

Closes #108
2017-09-17 09:43:13 -04:00
Chris PeBenito
bfa50a42f8 NodeconQuery: Make ipaddress module usage unconditional.
Closes #107
2017-09-17 09:43:13 -04:00
Chris PeBenito
d82a28262c setools __init__: import query/analysis classes
Makes use simpler. The setools submodules map 1:1 to classes anyway;
the separate modules are simply to ease organization.

Change seinfo to use conditional setter use rather than conditional
instantiation of queries.  Note: pylint disable is added because pylint
gets confused by the reuse of the q variable and thinks that q is always
BoolQuery, so it incorrectly reports missing member functions.
2015-04-15 12:00:59 -04:00
Chris PeBenito
55b290a77d NodeconQuery: Sync __init__ named parameters to setters
This is to match up __init__ named parameters to the corresponding
setter names, so it is simpler to switch from using the named parameters
over to separate setter calls.
2015-04-15 11:24:41 -04:00
Chris PeBenito
9d51dcc7e3 Misc cleanups suggested by pylint
* unnecessary parentheses on return
* variable shadowing
* unused variables
* classmethod variable naming
2015-04-02 14:50:21 -04:00
Chris PeBenito
3e6a509ecb NodeconQueryTest: fix typo in messages 2015-03-27 13:22:12 -04:00
Chris PeBenito
c9c995e7f3 NodeconQueryTest: Change IP criteria to skip on Python < 3.3 2015-03-27 09:38:00 -04:00
Chris PeBenito
ed35d206d9 Change unit tests to use setUpClass for opening policies. 2015-03-18 09:44:16 -04:00
Chris PeBenito
9939f5241e Implement MLS range tests on several context-based queries. 2015-02-24 15:50:08 -05:00
Chris PeBenito
8ba3cf16f5 Change all unit tests for "unset" query to use full comparison.
Fully compare the lists rather than only counting objects.

Also fix comparison problem in Nodecon and Genfscon. In libqpol, the all
genfscons/nodecons iterators allocate new objects, so the pointer
comparison in PolicySymbol fails.
2014-11-25 13:24:36 -05:00
Chris PeBenito
448305f2ef Add NodeconQuery functions for matching on IP version. 2014-11-12 13:39:36 -05:00
Chris PeBenito
4798e10706 Work around IPv6Network constructor expanded netmask issue.
Python 3.3's IPv6Network constructor does not support an expanded netmask
for specifying the network, only CIDR.  Convert all netmasks to CIDR.

The code does not verify that the orignal expanded netmask from the policy
is correct; it counts all set bits in the netmask.

Also add IPv6 NodeconQuery unit tests.
2014-11-10 20:14:33 -05:00
Chris PeBenito
fc597fed99 Add nodecon query.
It could use IPv6 tests, but those have the same code paths as IPv4.
2014-11-05 13:09:35 -05:00