Commit Graph

63 Commits

Author SHA1 Message Date
Chris PeBenito
0a8b3d4bb1 seinfo: Use subset in PortconQuery config.
This will allow users to specify a single port number and see which
portcons apply.  This is more in line with user expectations than the
current exact match behavior.  Closes #171.
2017-09-25 20:17:59 -04:00
Chris PeBenito
cc313f9791 __future__ print functions no longer need importing. 2017-09-24 20:40:29 -04:00
Chris PeBenito
e292a77c52 Drop support for Python < 3.4. 2017-09-17 09:43:13 -04:00
Chris PeBenito
96428e6309 Implement an enumeration for *bounds rule types. 2016-09-03 16:44:13 -04:00
Chris PeBenito
9648d013a2 Implement an enumeration for constraint rule type. 2016-09-03 16:44:13 -04:00
Chris PeBenito
9f8f8f72c1 Change tool exception handlers to re-raise the exception if debugging.
This will allow the debugger to catch the exception for debugging purposes.
2016-07-22 19:14:40 -04:00
Chris PeBenito
4af429d2a6 SELinuxPolicy: rename extended permission rule count property names for consistency
Also move the properties and Xen properties into proper order.
2016-03-28 11:16:05 -04:00
Chris PeBenito
1d27478b60 seinfo: fix defaults and typebounds count formatting. 2016-03-28 09:36:27 -04:00
Chris PeBenito
5fec77088a seinfo: move Xen options to a separate option grouping 2016-03-21 10:58:05 -04:00
Steve Lawrence
21864a7ea6 Change extended avrules to be more similar to normal avrules
- Add an iterator to extract the extended permissions rather than
  returning only a string
- Add queries for determining if an avrule is extended, and what its
  type the extended avrule is (e.g. ioctl)
- Removed tests, but should probably revert that change and make sure
  they still work
- Fixed some warnings about unsigned/signed comparisons with ebitmaps
- Updates seinfo and sesearch to support new extended avrule changes

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2016-03-21 10:57:21 -04:00
Richard Haines
3532ed2fff setools-V4: Add updates for testing V30 xen and xperms
Add updates to seinfo and sesearch to test libqpol updates
added via [1].

Also include extra tests for Xen and xperms. Note, xperms
cannot yet test the extended perms as needs more work on
libqpol.

[1] 0001-setools-V4-libqpol-policy-V30-updates-xen-xperm-stat.patch

Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
2016-03-21 10:56:37 -04:00
Chris PeBenito
7d88a1424e cli: switch to logging.exception for debug reporting of unrecoverable exception. 2016-03-04 13:59:21 -05:00
Chris PeBenito
89a96a422a Change #! to use standard Python form 2016-02-26 09:12:34 -05:00
Chris PeBenito
ae8ca1f094 seinfo: add typebounds info
Closes #68
2016-02-10 21:55:01 -05:00
Chris PeBenito
a3d554bc4c seinfo: add default_* details
Closes #69
2016-02-01 09:13:30 -05:00
Chris PeBenito
7a7d49d93f Display unknown permissions setting in general seinfo output. 2015-11-30 11:49:58 -05:00
Chris PeBenito
b38aa9af6f seinfo: clarify empty attribute expansion
Use "empty attribute" instead of "empty set".
2015-10-15 16:00:13 -04:00
Chris PeBenito
e6f59d04e5 Refactor SETools queries/analyses to use descriptors instead of get/setters
This is Pythonic.
2015-05-16 21:59:10 -04:00
Chris PeBenito
20ee139f3b SELinuxPolicy: add support for finding the policy to load.
Restore legacy CLI tool behavior for not having to specify a policy to load
2015-05-08 15:21:00 -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
f3ca479a27 Address remaining pylint errors.
Also implement some suggested changes.
2015-04-06 09:51:32 -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
c224995eeb Fully configure logging in CLI tools. 2015-03-25 13:40:03 -04:00
Chris PeBenito
402c6d1c6f seinfo: add useful expanded info for attributes 2015-03-22 11:46:44 -04:00
Chris PeBenito
b7ae7520a7 Add --common option to seinfo for CommonQuery. 2015-03-20 11:50:25 -04:00
Chris PeBenito
1dd17a0718 Remove unnecessary option defaults in CLI tools. 2015-03-19 15:20:37 -04:00
Chris PeBenito
de716ba6a5 Add logging.
Not comprehensive yet. Only planning to do setools pkg (not policyrep),
with the exception being the SELinuxPolicy class in policyrep.

Avoids performance-critical paths.  Use only info and debug so in normal
cases the user only sees messages if they ask for it (e.g. -v).
2015-03-19 08:07:23 -04:00
Chris PeBenito
4ecd6d00a5 Implement TypeAttributeQuery.
closes #13
closes #14
2015-03-16 10:46:33 -04:00
Chris PeBenito
39898d9572 Fix dereferencing in policyrep.typeattr factories.
Qpol already dereferences aliases internally.
2015-03-16 10:40:53 -04:00
Chris PeBenito
f4b1b68195 Rename type attribute interfaces.
Make sure they reflect that they are for type rather than role attributes.
2015-03-16 10:38:43 -04:00
Chris PeBenito
e3f2a98c43 Merge validatetrans into constraints in policyrep. 2015-03-14 14:52:58 -04:00
Chris PeBenito
3c8afd93e2 Reorder seinfo options. 2015-03-13 13:00:55 -04:00
Chris PeBenito
659ae2b7b2 Implement ValidatetransQuery.
Still needs unit tests.
2015-03-12 13:45:42 -04:00
Chris PeBenito
6849f127a7 Implement permissive types query in seinfo. 2015-03-08 15:00:51 -04:00
Chris PeBenito
8812f02411 Implement part of ConstraintQuery.
Still requires criteria on the constraint expression.

closes #6
closes #12
2015-03-08 14:50:43 -04:00
Chris PeBenito
edb19126c9 Add --debug options to CLI tools.
Catch all exceptions in the main bulk of the CLI code. We can't do anything
if there is an exception, so either print the error message from the
exception, or print the traceback if debug is enabled.
2015-03-07 11:41:04 -05:00
Chris PeBenito
ac19359b71 Implement SensitivityQuery
closes #19
closes #20
2015-03-07 11:16:59 -05:00
Chris PeBenito
e55764700c Refactor MLS-related objects.
Drop the "MLS" prepended to category, sensitivity, level, and range
objects.
2015-03-07 09:39:01 -05:00
Chris PeBenito
320c5e60f2 Implement MLSCategoryQuery.
closes #21
2015-03-06 09:19:35 -05:00
Chris PeBenito
2f44b599ca Reflow lines with new max line length.
Undo past whitespace fixes that are now unnecessary now that the max
line length increased to 100.
2015-02-14 10:40:38 -05:00
Chris PeBenito
2d1c9184ed Reorder parameters to meet PEP8 standards.
Except max line length of 100.
2015-02-12 13:59:54 -05:00
Chris PeBenito
a809d3c557 Change to ternary for MLS enabled/disabled display in seinfo.
For style consistency in seinfo.
2015-02-06 09:11:44 -05:00
Chris PeBenito
7a9915f34a Move seinfo --flat option out of components option group. 2015-02-06 09:10:06 -05:00
Chris PeBenito
d2bc5be9d9 Whitespace fix in seinfo. 2015-02-06 09:08:45 -05:00
Fernand Lone-Sang
daa53937de add a --flat option to seinfo 2015-02-06 00:22:46 +01:00
Fernand Lone-Sang
3b324d7f5e adding a --all switch to seinfo
There are 3 major changes in this commit:

1/ Setting the default values to None instead of "". Indeed, when --all is
   passed to the command line, default values are set to "" making the
   'if insinstance(xxx, str)' being True, and thus the script takes the wrong
   branch.
2/ if/elif/else have been replaced by if/else structure, to enable selection of
   multiple switches. Selected component queries are stacked and displayed at
   the end
3/ like the original seinfo, we append some descriptions string (info: count +
   indented results) to the output
2015-02-04 10:25:03 +01:00
Chris PeBenito
c687d1d473 Fix copy-paste error in seinfo. 2014-11-30 16:27:55 -05:00
Chris PeBenito
36abf44bce PEP8 fixes in seinfo 2014-11-30 13:31:31 -05:00
Chris PeBenito
6258b648aa Implement policy statistics functions.
Do counting in C where possible.
2014-11-30 13:30:36 -05:00
Chris PeBenito
16f2eab30c Restructure seinfo
* Restructure queries to only have one output
* Fix portcon help info to be clearer about specifying ports
* Cover all functions with exception handling
2014-11-30 09:34:59 -05:00