Received: from jazzhorn.ncsc.mil (mummy.ncsc.mil [144.51.88.129]) by tarius.tycho.ncsc.mil (8.13.1/8.13.1) with ESMTP id k4DAs2ac000969 for ; Sat, 13 May 2006 06:54:02 -0400 Received: from ug-out-1314.google.com (jazzhorn.ncsc.mil [144.51.5.9]) by jazzhorn.ncsc.mil (8.12.10/8.12.10) with ESMTP id k4DAs19L019875 for ; Sat, 13 May 2006 10:54:01 GMT Received: by ug-out-1314.google.com with SMTP id u2so538279uge for ; Sat, 13 May 2006 03:54:00 -0700 (PDT) From: "Mario Fanelli" To: "SeLinux Mailing List" Subject: Trouble with setexeccon/setcon Date: Sat, 13 May 2006 12:53:48 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_002D_01C6768C.4B4AF360" Message-ID: <4465bac8.7f1514c3.12f8.57e6@mx.gmail.com> Sender: owner-selinux@tycho.nsa.gov List-Id: selinux@tycho.nsa.gov This is a multi-part message in MIME format. ------=_NextPart_000_002D_01C6768C.4B4AF360 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > -----Messaggio originale----- > Da: Stephen Smalley [mailto:sds@tycho.nsa.gov] > Inviato: Friday, May 12, 2006 4:17 PM > A: Mario Fanelli > Cc: SeLinux Mailing List > Oggetto: Re: Trouble with setexeccon/setcon > > On Fri, 2006-05-12 at 15:40 +0200, Mario Fanelli wrote: > > > Yes, but runcon and newrole are user-space command. > > > > I have to modify the SuPhp C source code because I want that the > > process SuPhp has different security context depending of an > > environment variable that mod_suphp set. I try to use setexecon in > > mod_suphp beforce executing SuPhp but the security context don't > > change..setexeccon return -1.so I try to modify the suPhp exec with a > > calling to setcon but another setcon don't work. > > > > If I use runcon all works, but I need to modify the source code. > > Right, I meant to look at the runcon.c or newrole.c source code as > examples of how to use setexeccon() as well as how to create a context > in the first place from a combination of the caller's context and some > new type. What errno do you get after the failed setexeccon() call? In > addition to replacing object_r with a legitimate process role, you also > need to ensure that the role is authorized for the type/domain. > > -- > Stephen Smalley > National Security Agency I think that there is a problem with setcon/setexecon .. Perhaps now I try to write a wrapper program that execute the command "runcon -t dummy_change_context_t /path/of/suphp"..the program only use an enviroment variable "SUPHP_SELINUX_DOMAIN" and call execve() with same environment, but the result doesn't change Now I have written a policy for suPhp with a domain_auto_trans macro.when apache executes suphp, the context changes.but if I use a domain_trans and a setcon in suPhp, I obtain an error and I don't find any error message in /var/log/messages.I'm using a targetd policy and I put apache2 in unconfined_t domain. Where can I find the runcon/newrole source code? ------=_NextPart_000_002D_01C6768C.4B4AF360 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

> -----Messaggio originale-----
> Da: Stephen Smalley [mailto:sds@tycho.nsa.gov]
> Inviato: Friday, May 12, 2006 4:17 PM
> A: Mario Fanelli
> Cc: SeLinux Mailing List
> Oggetto: Re: Trouble with = setexeccon/setcon

> 

> On Fri, 2006-05-12 at 15:40 +0200, Mario Fanelli wrote: =

> 

> > Yes, but runcon and newrole are user-space command. =

> > 

> > I have to modify the SuPhp C source code because I want = that the

> > process SuPhp has different security context depending = of an

> > environment variable that mod_suphp set. I try to use setexecon in

> > mod_suphp beforce executing SuPhp but the security = context don’t

> > change..setexeccon return -1…so I try to modify = the suPhp exec with a

> > calling to setcon but another setcon don’t = work.

> >

> > If I use runcon all works, but I need to modify the = source code…

> 

> Right, I meant to look at the runcon.c or newrole.c source = code as

> examples of how to use setexeccon() as well as how to create = a context

> in the first place from a combination of the caller's = context and some

> new type.  What errno do you get after the failed = setexeccon() call?  In

> addition to replacing object_r with a legitimate process = role, you also

> need to ensure that the role is authorized for the = type/domain.

> 

> --

> Stephen Smalley

>  National Security Agency

 

I think that there is a problem with setcon/setexecon = ….

Perhaps now I try to write a wrapper program that execute the = command “runcon –t dummy_change_context_t  = /path/of/suphp”..the program only use an enviroment variable “SUPHP_SELINUX_DOMAIN” and = call execve() with same environment, but the result doesn’t = change

Now I have written a policy for suPhp with a domain_auto_trans = macro…when apache executes suphp, the context changes…but if I use a = domain_trans and a setcon in suPhp, I obtain an error and I don’t find any = error message in /var/log/messages…I’m using a targetd policy and = I put apache2 in unconfined_t domain…

Where can I find the runcon/newrole source = code?

 

------=_NextPart_000_002D_01C6768C.4B4AF360-- -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message.