문제

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??

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top