Gentoo Archives: gentoo-hardened

From: Julius Loman <lomo@×××××××.net>
To: gentoo-hardened@l.g.o
Subject: Re: [gentoo-hardened] running php scripts as owner
Date: Wed, 28 Sep 2005 20:19:17
Message-Id: 20050928201707.GS25784@kyberia.net
In Reply to: Re: [gentoo-hardened] running php scripts as owner by Rumen Yotov
1 On Wed, Sep 28, 2005 at 07:58:59PM +0300, Rumen Yotov <rumen_yotov@×××.bg> wrote:
2 > On Wed, 28 Sep 2005 15:02:17 +0000
3 > Pedro Venda <pjvenda@××××××××××××.org> wrote:
4 >
5 > > On Wednesday 28 September 2005 07:16, Julius Loman wrote:
6 > > > On Wed, Sep 28, 2005 at 12:08:24AM -0700, Anthony Gorecki
7 > > <agorecki@××××××××××.com> wrote:
8 > > > > On Tuesday, September 27, 2005 23:57, Julius Loman wrote:
9 > > > > > For security reasons I want to have php scripts running
10 > > > > > under file owner UID.
11 > > > >
12 > > > > PHP's "safe mode" might offer the security that you're looking
13 > > > > for.
14 > > >
15 > > > I don't think so, at least files created by php scripts will be
16 > > > created with UID that php is running. I don't want this, so do
17 > > > users.
18 > >
19 > > This is indeed a serious issue and it deserves attention from careful
20 > > sysadmins.
21 > >
22 > > On my previous sysadmin job, me and my team discussed this issue
23 > > exactly. we were a team of sysadmins that (between many other things)
24 > > handled a sun solaris server with about 8000 user accounts.
25 > >
26 > > I can't remember all the arguments, but:
27 > > - suphp was abandoned due to poor testing and not supporting solaris
28 > > well;
29 > > - we didn't know fastcgi, but I assume it works by running php
30 > > scripts through a shell interpreter called as a cgi. it's an option,
31 > > and it doesn't require fastcgi... still it caused us trouble because
32 > > the interpreter was being called with the apache owner. the suexec
33 > > module has some limitations on this, since the php scripts didn't
34 > > have .cgi extensions.
35 > >
36 > > our solution involved patching apache's suexec to handle .php scripts
37 > > just like .cgi ones, running the interpreter on them.
38 > >
39 > > the guy who patched the suexec (and worked with me then) is on this
40 > > list and I believe he'll give it to you, if it looks pretty enough.
41 > > (CC'd him)
42 > >
43 > > as for performance, it surely dropped but we didn't really measure it
44 > > with numbers. that wasn't really the main concern.
45 > >
46 > > regards,
47 > > pedro venda.
48 > Hi,
49 > Maybe you all know this, but just to mention it - for quite a few of
50 > the daemons there're ready to use (selinux) policy configurations.
51 > SELinux policy ebuilds. Check all them by:"#eix selinux | grep policy".
52 > Unfortunately there's none for PHP, so somebody might want to write
53 > one and submit it for all the others to use.
54 > Think that using an MAC system by itself is quite a defence, all the
55 > other solutions will be weaker. Just my point here.
56 > PS: sorry but can't (easy) do this myself as i use RSBAC not SELinux.
57 > HTH.Rumen
58 yes, but unfortunately i haven't found a policy for suphp or fastcgi..
59 suexec will work i think... but patching suexec everytime i'm upgrading
60 apache is not an idea i like
61
62
63 --
64
65 [ Julius Loman ][ lomo@×××××××.net ][ http://lomo.kyberia.net ][ icq:35732873 ]

Replies

Subject Author
Re: [gentoo-hardened] running php scripts as owner "Ian P. Christian" <pookey@×××××××××.uk>