containers / udica

This repository contains a tool for generating SELinux security profiles for containers
GNU General Public License v3.0
479 stars 47 forks source link

not able to execute udica command successfully for generating policy #41

Closed borntorock closed 4 years ago

borntorock commented 5 years ago

Describe the bug While trying to run the udica -j container.json my_container command, I'm getting the below ImportError message. Tried with python3.4, 3.6.3 as well with python 2.7.5 on Centos7.

I tried to install the udica from source via git clone and via pip (after uninstalling, at a different time). Some sources mentioned about instally pysed module, but this also doesn't resolve the issue.

Traceback (most recent call last):
  File "/usr/bin/udica", line 9, in <module>
    load_entry_point('udica==0.1.9', 'console_scripts', 'udica')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "build/bdist.linux-x86_64/egg/udica/__main__.py", line 22, in <module>
  File "build/bdist.linux-x86_64/egg/udica/policy.py", line 20, in <module>
ImportError: cannot import name replace

To Reproduce Steps to reproduce the behavior:

  1. yum install python-pip
  2. pip install udica
  3. udica -j container.json my_container

Expected behavior udica command be successfully executed and able to generate policy.

Additional context Add any other context about the problem here.

wrabcak commented 5 years ago

Hi @borntorock , Thank you for report. By using which container engine you started your container? Podman or docker? Could you also share the version of the container engine?

I'm afraid in CentOS 7 there is old version for podman/docker so maybe that's the reason why udica is broken.

JAORMX commented 4 years ago
...
ImportError: cannot import name replace

This line looks quite fishy.

From what I can tell, this is a python 2.7/3.X issue. The package replace exists in python 3.X but not in 2.7.