This is right behavior. When you create some file it inherits it's parent's context.I need to create a directory in a C binary.
I am currently doing something similar to this:
status = mkdir("/home/cnd/mod1", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);But when the directory is created it ends up with the wrong SELinux context. It inherits it's parent's context andnot the one defined in file context.
You can define filename transation in selinux policy related to your daemon.Is there a C call that can be used that understands how to correctly create and label SElinux directories?
-- selinux mailing list selinux@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/selinux
-- Regards. -- Lukas Vrabec SELinux Solutions Red Hat, Inc.