Commit Graph

820 Commits

Author SHA1 Message Date
Chris PeBenito
90a9e54a89 qpol.i: Remove SWIG qpol wrapper. 2018-06-15 20:26:49 -04:00
Chris PeBenito
a1aa0f33f5
Merge pull request #181 from bigon/bug_174
Fix build failure with GCC 7 due to possible truncation of snprintf o…
2017-11-09 18:06:28 -05:00
Chris PeBenito
e278288bf7 .travis.yml: Add retry for swig download. 2017-10-26 22:23:49 -04:00
Laurent Bigonville
e41adf0164 Fix build failure with GCC 7 due to possible truncation of snprintf output
setools fails to build under GCC7 -Wformat -Werror with the following error:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-sign-compare -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Ilibqpol -Ilibqpol/include -I/usr/include/python3.6m -c libqpol/policy_extend.c -o build/temp.linux-amd64-3.6/libqpol/policy_extend.o -Werror -Wextra -Waggregate-return -Wfloat-equal -Wformat -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-include-dirs -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wunknown-pragmas -Wwrite-strings -Wno-missing-field-initializers -Wno-unused-parameter -Wno-cast-qual -Wno-shadow -Wno-unreachable-code -fno-exceptions
libqpol/policy_extend.c: In function 'policy_extend':
libqpol/policy_extend.c:161:27: error: '%04zd' directive output may be truncated writing between 4 and 10 bytes into a region of size 5 [-Werror=format-truncation=]
    snprintf(buff, 9, "@ttr%04zd", i + 1);
                           ^~~~~
libqpol/policy_extend.c:161:22: note: directive argument in the range [1, 4294967295]
    snprintf(buff, 9, "@ttr%04zd", i + 1);
                      ^~~~~~~~~~~

Increase the size of the buffer to avoid collisions

Closes: https://github.com/TresysTechnology/setools/issues/174
Signed-off-by: Laurent Bigonville <bigon@bigon.be>
2017-09-26 16:36:59 +02:00
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
856b56accb Update NetworkX support to 2.0. NetworkX 2.0 has API breakage.
Now SETools requires NetworkX 2.0+.
2017-09-23 14:03:26 -04:00
Chris PeBenito
8339fd3b1c SELinuxPolicy: Remove deprecated methods. 2017-09-20 19:40:34 -04:00
Chris PeBenito
486de4695e Nodecon: Fix deprecation warning messages. 2017-09-20 19:40:09 -04:00
Chris PeBenito
9fa55c25cb Update unit tests for Python 3 only use. 2017-09-19 20:58:03 -04:00
Chris PeBenito
9e9d9fec9d Used 'yield from' where possible. 2017-09-17 09:43:13 -04:00
Chris PeBenito
576268eeca Use the suppress context manager where possible to improve readability. 2017-09-17 09:43:13 -04:00
Chris PeBenito
1dd0bf31e1 ApolMainWindow: IOError is an alias for OSError in Python 3. 2017-09-17 09:43:13 -04:00
Chris PeBenito
af88deac17 PermissionMapEditor, EdgeAttrList: Use list .clear() method.
Closes #110
2017-09-17 09:43:13 -04:00
Chris PeBenito
d0ca705cc7 Drop explicit inheritance of object as all classes are new-style in Python 3.
Closes #109
2017-09-17 09:43:13 -04:00
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
904a83b27e Implement exception chaining.
Closes #106.
2017-09-17 09:43:13 -04:00
Chris PeBenito
e292a77c52 Drop support for Python < 3.4. 2017-09-17 09:43:13 -04:00
Chris PeBenito
58f62bf627 Start 4.2 development. 2017-09-17 09:43:13 -04:00
Chris PeBenito
7e6126d026 Merge pull request #175 from fishilico/document_build_ext
Document that build_ext needs to be run before build
2017-08-25 21:57:21 -04:00
Nicolas Iooss
761915e025
Document that build_ext needs to be run before build
When installing setools with python setup.py install,
setools/policyrep/qpol.py is not copied to the destination directory.
This is because the file is generated in step build_ext and Python files
are copied beforehand (in step build_py).

A simple workaround consists in running "setup.py build_ext" before
building and installing setools. Document this in the README.

Closes: https://github.com/TresysTechnology/setools/issues/173
2017-08-25 20:47:57 +02:00
Chris PeBenito
f8c8ff0aee Merge pull request #172 from bachradsusi/byteswap.h
bswap_* macros are defined in byteswap.h
2017-08-10 17:03:27 -04:00
Petr Lautrbach
2ac588919d bswap_* macros are defined in byteswap.h
Fixes ImportError on s390x:
/usr/lib64/python3.6/site-packages/setools/policyrep/_qpol.cpython-36m-s390x-linux-gnu.so: undefined symbol: bswap_32
2017-08-10 08:23:47 +02:00
Chris PeBenito
16a3ffbdf1 DomainTransitionAnalysis: Silence wrong lint errors. 2017-08-05 17:14:54 -04:00
Chris PeBenito
e918b3741a .travis.yml: Switch to tox-travis 2017-08-05 16:49:23 -04:00
Chris PeBenito
f8eaafc53f setup.py: Update for travis-ci. 2017-08-05 15:55:35 -04:00
Chris PeBenito
0a5897aeaa .travis.yml: Update for 2.7 userspace. 2017-08-05 15:55:07 -04:00
Chris PeBenito
43fee33c71 Merge pull request #168 from karlwmacmillan/append_perm_map
Mark append as a 10 in the perm_map file.
2017-03-13 15:47:03 -05:00
Karl MacMillan
26a8b1ba73 Mark append as a 10 in the perm_map file.
I checked and it looks like append has been a 1 for permission weighting since
the very beginning. But that makes no sense - append lets you write to files.
So this should be a 10.

I changed all instances of append but, honestly, I'm not clear on many of them.

I did verify that if you open a file with O_APPEND and then write to that file
you only need append - you don't need write. Here is my test program:

int main(int argc, char** argv) {
  int fd = open("test_file", O_APPEND | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG);
  char buf[256];

  ssize_t b = write(fd, buf, 256);
  printf("%zd\n", b);
}

Running this in a domain with no permissions shows that we need:

allow lprog user_home_dir_t:file { append create open };

Which is what I expected - but this being wrong for so long made me question
my understanding of how this worked.
2017-03-12 22:54:31 -04:00
Chris PeBenito
a484867c94 Merge pull request #166 from fishilico/fix_apol_help
Fix Apol help
2017-02-15 18:33:17 -05:00
Nicolas Iooss
dae1080d51
Update compiled Apol Help files 2017-02-15 21:37:49 +01:00
Nicolas Iooss
3868613c8f
Generate Apol compressed help file with "setup.py build_qhc"
"setup.py build_qhc" invokes qcollectiongenerator on qhc/apol.qhcp,
which produces two files:
- apol.qhc, a Qt Help Collection file
- apol.qch, a Qt Compressed Help file

As apol.qhc is merely a set of metadata with a relative link to
apol.qch, Qt Assistant requires both files in order to display Apol
help.

Make "setup.py build_qhc" build both files in setoolsgui/apol/.

Moreover '*.qch' needs to be added to package_data in order to install
apol.qch.

Fixes: https://github.com/TresysTechnology/setools/issues/165
2017-02-15 21:37:45 +01:00
Chris PeBenito
e3a905f027 Update README and Travis-CI for new libsepol dependence. 2017-01-23 18:31:57 -05:00
Karl MacMillan
e743d2a0ea Ftrules hashtab (#164)
* Search for libsepol in /usr/local

* Support filename transition and range transitions rules in the new hashtable storage of libsepol

* Fix off-by-one bug in traversing hashtables and minor compile fixes under Fedora 25.

* Remove debugging.

* The policy_define.c that uses hashtables was not setting the otype for filetrans_rules. This
appears intentional (the hashtable is just being filled out to detect duplicates based on the comments),
but for qpol was causing problems.
2017-01-23 18:27:22 -05:00
Chris PeBenito
f9a235c2d7 Update Changelog for 4.1.0-rc. 2016-12-11 16:28:47 -05:00
Chris PeBenito
6815c422a9 README: Add SEPOL_SRC docs. 2016-12-04 11:18:39 -05:00
Chris PeBenito
566e61137d _avrule_expand_generator: Improve performance of permission unioning. 2016-12-03 17:06:37 -05:00
Chris PeBenito
5200f0c666 TERulesDifference: Fix bug with unioning permissions.
Unit tests did not correctly test this scenario.
2016-12-03 12:19:53 -05:00
Chris PeBenito
d0288fa861 README.md: Add an explicit build command to the install instructions.
If you switch between branches, the qpol C extension may not be rebuilt
correctly otherwise, causing breakage.
2016-11-20 09:49:59 -05:00
Chris PeBenito
e97afd7467 SEToolsTreeWidget: Subclass QTreeWidget to copy tree to clipboard.
Closes #122
2016-11-13 16:42:42 -05:00
Chris PeBenito
e434c1e688 Merge pull request #157 from fishilico/swig-exception-typo
policyrep: fix a mispelling in SWIG error message
2016-11-13 00:38:17 -05:00
Chris PeBenito
263ba9c070 Merge pull request #156 from fishilico/reproducible_sesearch-A
Make "search -A" output reproducible
2016-11-13 00:37:55 -05:00
Nicolas Iooss
988da4d1f2
Make "search -A" output reproducible
With Python 3, the values in a set are randomly organised. Therefore the
representation of the set of permissions of an allow/dontaudit/...
statement is not stable across execution.

Sort the permissions when converting them as strings.
2016-11-12 22:38:32 +01:00
Nicolas Iooss
d99a5cc31b
policyrep: fix a mispelling in SWIG error message 2016-11-12 21:46:06 +01:00
Chris PeBenito
42c2bbd606 Move data in as package data.
Closes #136.
2016-11-12 11:13:21 -05:00
Chris PeBenito
6927ea885b SummaryTab: Fix handle_unknown output. 2016-11-11 18:22:07 -05:00
Chris PeBenito
60e8b9d7fb setup.py: Support locally-built libsepol.
Set the SEPOL_SRC env. variable to the path to the compiled libsepol
source tree.

Closes #138
2016-11-11 18:21:48 -05:00
Chris PeBenito
c0ebad8d15 SELinuxPolicy: Create enumerations for handle_unknown and target_platform. 2016-11-11 13:58:43 -05:00
Chris PeBenito
85f9a32125 sediff: Fix enum usage. 2016-09-11 10:33:18 -04:00