How do I create a directory in C that will follow selinux file context rules?

Lukas Vrabec lvrabec at redhat.com
Thu Mar 26 16:46:47 UTC 2015


I'm afraid my solution will not work with RHEL 6.5.
We must come with some other solution.
>
> I have tried this using a filestran pattern but it doesn't seem to work.
>
> > Date: Wed, 25 Mar 2015 09:32:32 +0100
> > From: mgrepl at redhat.com
> > To: swazup at hotmail.com; selinux at lists.fedoraproject.org
> > Subject: Re: How do I create a directory in C that will follow 
> selinux file context rules?
> >
> > On 03/24/2015 10:45 PM, Jayson Hurst wrote:
> > > 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 and
> > >
> > > not the one defined in file context.
> >
> > What is your OS?
> >
> > >
> > >
> > >
> > > Is there a C call that can be used that understands how to 
> correctly create and label SElinux directories?
> > >
> > >
> > >
> > > --
> > > selinux mailing list
> > > selinux at lists.fedoraproject.org
> > > https://admin.fedoraproject.org/mailman/listinfo/selinux
> > >
> >
> >
> > --
> > Miroslav Grepl
> > Software Engineering, SELinux Solutions
> > Red Hat, Inc.
>
>
> --
> selinux mailing list
> selinux at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/selinux

-- 

Thank you.

--
Lukas Vrabec
SELinux Solutions
Red Hat, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/selinux/attachments/20150326/90a23116/attachment.html>


More information about the selinux mailing list