Giter VIP home page Giter VIP logo

Comments (7)

stephensmalley avatar stephensmalley commented on July 4, 2024

Reproduced upstream, e.g. just mv /etc/selinux /etc/selinux.old and try running semanage as above.

from selinux.

fishilico avatar fishilico commented on July 4, 2024

This behavior is mainly due to having valid_types = list(list(sepolicy.info(... in class definitions instead of having them in class constructors (in seobject.py). This makes it harder to catch the fact that no policy is loaded.
I suggest moving the valid_types definitions to class constructors, to give importers of seobject.py the possibility to display a nice error message if no policy is loaded (or to specify a policy to be loaded).
What do you think of this?

from selinux.

bachradsusi avatar bachradsusi commented on July 4, 2024

I should probably drop the reference to this issue from my working commits in order to prevent another automatic closing. Sorry for the noise.

from selinux.

bachradsusi avatar bachradsusi commented on July 4, 2024

Fixed by a73b0bb e718c2a

from selinux.

devZer0 avatar devZer0 commented on July 4, 2024

on recent debian 9.7, i'm also getting this. some note about the missing package would be nice, i found this via strace...

from selinux.

renannprado avatar renannprado commented on July 4, 2024

@devZer0 would be nice if you say which is the missing package...

I have this problem in Ubuntu still.

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

from selinux.

JeanCarlosChavarriaHughes avatar JeanCarlosChavarriaHughes commented on July 4, 2024

Facing the same issue when doing:

# semanage
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 28, in <module>
    import seobject
  File "/usr/lib/python3/dist-packages/seobject.py", line 1039, in <module>
    class portRecords(semanageRecords):
  File "/usr/lib/python3/dist-packages/seobject.py", line 1041, in portRecords
    valid_types = list(list(sepolicy.info(sepolicy.ATTRIBUTE, "port_type"))[0]["types"])
  File "/usr/lib/python3/dist-packages/sepolicy/__init__.py", line 196, in <genexpr>
    return ({
  File "/usr/lib/python3/dist-packages/setools/typeattrquery.py", line 65, in results
    for attr in self.policy.typeattributes():
AttributeError: 'NoneType' object has no attribute 'typeattributes'

OR

# semanage permissive -a httpd_t
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 28, in <module>
    import seobject
  File "/usr/lib/python3/dist-packages/seobject.py", line 1039, in <module>
    class portRecords(semanageRecords):
  File "/usr/lib/python3/dist-packages/seobject.py", line 1041, in portRecords
    valid_types = list(list(sepolicy.info(sepolicy.ATTRIBUTE, "port_type"))[0]["types"])
  File "/usr/lib/python3/dist-packages/sepolicy/__init__.py", line 196, in <genexpr>
    return ({
  File "/usr/lib/python3/dist-packages/setools/typeattrquery.py", line 65, in results
    for attr in self.policy.typeattributes():
AttributeError: 'NoneType' object has no attribute 'typeattributes'

Environment

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic
Python 3.6.9
pip 20.2.3
python3-setools is already the newest version (4.1.1-3)

from selinux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.