Commit Graph

117 Commits

Author SHA1 Message Date
Stephen Smalley
b4cca24240 Update VERSION and ChangeLog files for 2.6 final release.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2016-10-14 11:31:26 -04:00
Stephen Smalley
4257778f18 Update VERSION and ChangeLog files for 2.6-rc2 release.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2016-10-06 10:23:40 -04:00
Stephen Smalley
0cea223d33 Update VERSION and ChangeLog files for 2.6-rc1 release.
Intentionally jumping versions in sepolgen to make it consistent
with the rest.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2016-09-30 12:15:08 -04:00
Stephen Smalley
d10c8b81d4 sepolgen: fix make test
make test in sepolgen was broken because checkmodule now requires
the module name to match the file name.  Fix it.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2016-09-12 09:42:38 -04:00
Stephen Smalley
77475b2228 Updated libsepol and sepolgen ChangeLogs.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2016-05-09 08:19:30 -04:00
Nicolas Iooss
18a74d7885 sepolgen: remove additional files when cleaning
Remove the files created by Python 3 and refpolicy building process.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2016-05-09 08:15:41 -04:00
Nicolas Iooss
8e30f76c6d Update .gitignore files
Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2016-05-09 08:14:54 -04:00
Stephen Smalley
4534c08686 Updated sepolgen ChangeLog.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2016-03-25 14:15:34 -04:00
Miroslav Grepl
9136e7a9bc policycoreutils/sepolgen: Add support for TYPEBOUNDS statement in INTERFACE policy files.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1319338

$ sepolgen-ifgen
/usr/share/selinux/devel/include/contrib/docker.if: Syntax error on line 503 docker_t [type=IDENTIFIER]
/usr/share/selinux/devel/include/roles/unconfineduser.if: Syntax error on line 706 unconfined_t [type=IDENTIFIER]

Signed-off-by: Miroslav Grepl <mgrepl@redhat.com>
2016-03-25 14:11:00 -04:00
Steve Lawrence
2b69984b0c Update ChangeLog and VERSION for final release
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2016-02-23 11:31:41 -05:00
Steve Lawrence
e97d3eca99 Update libsepol, libsemanage, policycoreutils, and sepolgen ChangeLogs
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2016-02-01 09:05:47 -05:00
Nicolas Iooss
302443cbbb sepolgen: Support latest refpolicy interfaces
Some refpolicy interfaces use:

* "$" character in paths, for example in kernel/selinux.if:

    genfscon selinuxfs /booleans/$2 gen_context(system_u:object_r:$1,s0)

* empty members in ifelse statement, for example in system/init.if:

    ifelse(`$5',`',`',`
        ...
    ')

Modify sepolgen/refparser grammar accordingly.

This fixes the following syntax errors reported by sepolgen-ifgen:

    /usr/share/selinux/refpolicy/include/kernel/selinux.if: Syntax error
    on line 43 gen_context [type=GEN_CONTEXT]
    /usr/share/selinux/refpolicy/include/system/init.if: Syntax error on
    line 1416 ' [type=SQUOTE]
    /usr/share/selinux/refpolicy/include/system/init.if: Syntax error on
    line 1422 ' [type=SQUOTE]

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2016-02-01 08:54:30 -05:00
Nicolas Iooss
211baf74ef sepolgen: Make sepolgen-ifgen output deterministic with Python>=3.3
Since Python 3.3, dictionary hashes are randomized and iterating over
them is no longer deterministic.  This makes it difficult to compare
outputs of sepolgen-ifgen command.

Make sepolgen-ifgen deterministic again with Python>=3.3 by always
sorting the dictonaries and sets which are used to produce output.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2016-02-01 08:54:30 -05:00
Steve Lawrence
b3b5ede9ca Update ChangeLog and VERSION for release candidate
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2016-01-07 10:01:31 -05:00
James Carter
b6e70257bd Updated sepolgen ChangeLog
Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
2015-11-19 16:17:05 -05:00
Petr Lautrbach
5f2aca2418 sepolgen: Use key function in sort()
In Py3.0, the cmp parameter in sort() function was removed and key keyword is
available since Py2.4.

Fixes: # cat avc.log | audit2allow -R
Traceback (most recent call last):
  File "/usr/bin/audit2allow", line 363, in <module>
    app.main()
  File "/usr/bin/audit2allow", line 351, in main
    self.__output()
  File "/usr/bin/audit2allow", line 308, in __output
    g.set_gen_refpol(ifs, perm_maps)
  File "/usr/lib64/python3.4/site-packages/sepolgen/policygen.py", line 101, in set_gen_refpol
    self.ifgen = InterfaceGenerator(if_set, perm_maps)
  File "/usr/lib64/python3.4/site-packages/sepolgen/policygen.py", line 353, in __init__
    self.hack_check_ifs(ifs)
  File "/usr/lib64/python3.4/site-packages/sepolgen/policygen.py", line 365, in hack_check_ifs
    params.sort(param_comp)
TypeError: must use keyword argument for key function

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2015-11-13 10:32:07 -05:00
Stephen Smalley
a0e52def36 Update sepolgen ChangeLog.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-10-27 13:30:03 -04:00
Nicolas Iooss
90cff8243e sepolgen: Reset line numbers when parsing files
When running sepolgen-ifgen on refpolicy (git master branch), the
following messages show up:

    /usr/share/selinux/refpolicy/include/kernel/selinux.if: Syntax error
    on line 3369 gen_context [type=GEN_CONTEXT]
    /usr/share/selinux/refpolicy/include/system/init.if: Syntax error on
    line 188379 ' [type=SQUOTE]
    /usr/share/selinux/refpolicy/include/system/init.if: Syntax error on
    line 188385 ' [type=SQUOTE]

The line numbers are incorrect because the lineno member of the lexer
object is not resetted after each file has been processed.  After fixing
this, the messages are nicer:

    /usr/share/selinux/refpolicy/include/kernel/selinux.if: Syntax error
    on line 43 gen_context [type=GEN_CONTEXT]
    /usr/share/selinux/refpolicy/include/system/init.if: Syntax error on
    line 1416 ' [type=SQUOTE]
    /usr/share/selinux/refpolicy/include/system/init.if: Syntax error on
    line 1422 ' [type=SQUOTE]

As line 43 of kernel/selinux.if contains a genfscon statement with a
gen_context component, the reported line numbers are now correct.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2015-10-27 13:28:18 -04:00
Stephen Smalley
40b80ad8b2 Updated sepolgen ChangeLog.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-08-05 15:16:18 -04:00
Robert Kuska
1ee796ccb7 sepolgen: convert cmp functions to key functions
In python3 it is needed to pass compare function as a key argument
instead of directly passing compare function to sort function

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-08-05 15:10:21 -04:00
Robert Kuska
60956ac7ec sepolgen: Decode output from Popen in Python3
In Python3 output from Popen communicate function
returns bytes, to handle output as a string it is needed
to properly decode it.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-08-05 15:10:16 -04:00
Stephen Smalley
23f6db52a5 Updated policycoreutils and sepolgen ChangeLogs.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-07-31 11:18:39 -04:00
Petr Lautrbach
7bd95d71f1 policycoreutils: Comment constraint rules in audit2allow and sepolgen output
Constraint rules in output need to be commented in order to make a policy
compilable.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1155974

Patch-by: Miroslav Grepl <mgrepl@redhat.com>
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2015-07-31 11:16:00 -04:00
Stephen Smalley
2202a68d5a Updated sepolgen ChangeLog.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-07-16 13:11:14 -04:00
Robert Kuska
a280b06dd9 sepolgen: Edit tests so they pass even on Python3 where hash is random.
By default in Python3 hash uses random seed as salt, this leads to
different order in output from functions which rely on hash as are
dicts and sets. Tests in sepolgen relied on the frozen order.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:03 -04:00
Robert Kuska
a9fb9053f7 sepolgen: Close files after reading/writing in tests.
Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:03 -04:00
Robert Kuska
15a7553d22 sepolgen: Apply fixes discovered by 2to3 where needed.
Replace usage of print statement with print function.
Use `in` instead of `has_key` when checking for key in dict.
When using `raise` add text (if any) as parameter of exception function.
Add Python3 imports of moved modules.
Replace `map` with list comprehension.
Use reserved word `as` in try-except when catching exception.
Replace `ifilter` function with `filter`.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:03 -04:00
Robert Kuska
c2ecb8e3ec sepolgen: Replace usage of xrange inside of tests.
xrange function is gone in Python3 and instead range is
xrange by default. Also it doesnt seem to be important
to have xrange used in tests on Python2.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
2747dfb880 sepolgen: Replace usage of attributes of types module
In Python3 all strings are by default Unicode and both Unicode and String
types are removed from types module. We introduce separate
variables `bytes_type` and `string_type` to reflect Python3 understanding
of strings, on Python2 `bytes_type` refers to <str> and `string_type` to
<unicode>, on Python3 `bytes_type` are <bytes> and `string_type` <str>.
As all strings are Unicodes by default on Python3 we encode them to
bytes when needed as late as possible.

Also other attributes were replaced with their equivalents from
builtins which are available for both Python3 and Python2.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
aa903a27ba sepolgen: Replace usage of __cmp__ with rich comparison.
In Python3 the __cmp__ function is removed, and rich
comparison should be used instead.
Also the cmp function is gone in Python3 therefore it is
reimplemented in util.py and used if running on Python3.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
aee172010a sepolgen: Unicode-objects must be encoded before hashing.
sha256 hash operates with bytes and in Python3 all strings are unicode
by default, we must encode the data before hashing to ensure they
are bytes in Python3

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
788f5dba54 sepolgen: Use sort function with key parameter.
Since Python 2.4 .sort() as well as the new sorted() function
take a key parameter which should be a function that returns
a sorting key.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
467c2a45b9 sepolgen: Replace func_code calls with __code__.
In Python 3, special function attributes have been
renamed for consistency with other attributes.
__code__ attribute is also present in py2.7 and py2.6

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
fd00e882c4 sepolgen: Use relative imports for modules within sepolgen.
Python 3 changes the syntax for imports from within a package,
requiring you to use the relative import syntax,
saying from . import mymodule instead of the just import mymodule.

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Robert Kuska
e25d39addc sepolgen: Replace deprecated *Equals functions in tests
Also remove usage of cmp in tests as cmp is removed in Python3

Signed-off-by: Robert Kuska <rkuska@redhat.com>
2015-07-16 13:06:02 -04:00
Stephen Smalley
3057bcf6a0 Update ChangeLogs.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2015-03-18 08:37:10 -04:00
Daniel De Graaf
f029067709 libsepol, checkpolicy: add device tree ocontext nodes to Xen policy
In Xen on ARM, device tree nodes identified by a path (string) need to
be labeled by the security policy.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2015-03-18 08:16:44 -04:00
Steve Lawrence
f0c9966f88 Bump to final release 2015-02-02 09:38:10 -05:00
Steve Lawrence
823ebc8c6b Bump to release candidate 7 2014-12-03 10:06:26 -05:00
Steve Lawrence
07e75a9cc7 Bump to release candidate 6 2014-11-12 08:30:15 -05:00
Steve Lawrence
d1db56c52b Bump to release candidate 5 2014-10-29 11:01:03 -04:00
Steve Lawrence
6280387034 Bump to release candidate 4 2014-10-06 15:03:24 -04:00
Steve Lawrence
ff5bbe6dcf Bump VERSION/ChangeLog for release candidate 3
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2014-10-02 10:16:34 -04:00
Nicolas Iooss
e4d693ae87 Use $(PYTHON) instead of "python" in every Makefile
This fixes the build with "make PYTHON=python2" on systems where python
is python3.

For PYLIBVER and PYTHONLIBDIR definitions, I tested Python 2.5, 2.6, 2.7,
3.3 and 3.4.  For each of them, these commands print the expected result:

    python -c 'import sys;print("python%d.%d" % sys.version_info[0:2])'"
    python -c "from distutils.sysconfig import *;print(get_python_lib(1))"

Acked-by: Steve Lawrence <slawrence@tresys.com>
2014-10-02 09:56:49 -04:00
Steve Lawrence
213c3189d0 Bump versions for r2
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2014-08-27 11:47:04 -04:00
Steve Lawrence
8f9d3a7c95 Fix typos in ChangeLog and Versions 2014-08-26 14:20:48 -04:00
Steve Lawrence
79fd2d06ab Bump versions and update ChangeLog
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2014-08-26 09:48:54 -04:00
Steve Lawrence
8b4fb2d2de sepolgen: remove unnecessary grammar in interface call param list
The addition of this rule caused interface vectors to be less accurate.
The grammar looks correct without the rule, so remove it.

Reverted hunk from commit 17cc87e56b

Signed-off-by: Steve Lawrence <slawrence@tresys.com>
2014-08-26 07:59:08 -04:00
Stephen Smalley
75fdea94bb Bump version for bug fix to sepolgen-ifgen.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-10-31 10:13:10 -04:00
Dan Walsh
bbf72baca1 Add back attributes flag to fix exception crash. 2013-10-31 10:11:20 -04:00