containers / udica

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

If udica is run directly from git without installing, it fails #36

Closed bachradsusi closed 5 years ago

bachradsusi commented 5 years ago

Describe the bug

README.md says:

Alternatively tou can run udica directly from git:

$ python3 -m udica --help

--help works but when you try to generate a policy you get:

# python3 -m udica -i 78f693e41d93 bz1123

Policy bz1123 created!
Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/p/devel/github/containers/udica/udica/__main__.py", line 134, in <module>
    main()
  File "/home/p/devel/github/containers/udica/udica/__main__.py", line 129, in main
    load_policy(opts)
  File "/home/p/devel/github/containers/udica/udica/policy.py", line 193, in load_policy
    chdir(TEMPLATES_STORE)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/udica/templates'
wrabcak commented 5 years ago

Hi @bachradsusi , Thanks for reporting this issue. I created commit which should fix it. Could you please also test it and confirm if it's fixed your issue?

https://github.com/wrabcak/udica/tree/fb-local-templates

Thanks, Lukas.

bachradsusi commented 5 years ago

I wonder if it's enough to use just this:

-TEMPLATES_STORE = '/usr/share/udica/templates'
+TEMPLATES_STORE = './templates' if exists('./templates') else '/usr/share/udica/templates'
wrabcak commented 5 years ago

I wonder if it's enough to use just this:

Yes, it is.

-TEMPLATES_STORE = '/usr/share/udica/templates'
+TEMPLATES_STORE = './templates' if exists('./templates') else '/usr/share/udica/templates'