Configuring SELinux permissions on (SVS-V) IPC Semaphores

时光怂恿深爱的人放手 提交于 2019-12-18 14:54:41

问题


I have a bunch of programs which use IPC Semaphores to interact (semget).

One of the programs is an Apache module, which runs in (some sort of) restricted SELinux context (which I don't understand too well).

The module is capable of interacting with any regular files correctly, if of-course the files have their SELinux security context set appropriately.

However - when my (Module) goes to access the IPC Semaphore, the semget call fails with a EPERM. When SELinux is turned off, I don't get this error.

So - there is obviously something I need to do to set some sort of SELinux security context or something on the Semaphore for this to work. If it was a regular file, I could just call "chcon" on it. Since it's a System-V IPC Semaphore, I can't do that.

What can I do to make this work??


回答1:


The basic steps to get SELinux working with the changes you need are:

  1. Enable permissive mode
  2. Capture denials
  3. Add a new policy module or modify an existing policy module
  4. Enable enforcing mode and test

Exactly how to do these steps depends on what Linux distribution you are using; here are references for CentOS, Debian, Gentoo, RedHat and Ubuntu. You can also find SELinux information from NSA. The best documentation I found is from Gentoo: step 1, step 2, step 3, step 4.

As @smassey noted, you most probably need to modify some IPC permission.




回答2:


SELinux has persmission setting for more than just regular files, but also device and special files.

http://seedit.sourceforge.net/doc/access_vectors/access_vectors.html#SECTION00044000000000000000 is what you're looking for. Give read/write/etc permissions to the "sem" object.

Cheers



来源:https://stackoverflow.com/questions/7572974/configuring-selinux-permissions-on-svs-v-ipc-semaphores

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!