Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev

User/group security without CGI (SuEXEC)

 

 

Apache dev RSS feed   Index | Next | Previous | View Threaded


jille at quis

May 5, 2008, 4:26 AM

Post #1 of 6 (297 views)
Permalink
User/group security without CGI (SuEXEC)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello hackers!

I was thinking of creating a more secure environment for running
webscripts (mod_php in my case),
I want to run php scripts as their owner.

I tought of the following scheme's:
http://junk.quis.cx/fViKmLRi/apache-user-scheme-p1.png
http://junk.quis.cx/bPkxwAbI/apache-user-scheme-p2.png

And an setting:
ExecutiveUser %n # This should run php scripts as $script-owner
ExecutiveUser www-%n # this should run php scripts as www-$scriptowner
ExecutiveGroup www
ExecutiveGroup www-%n
(%n meaning the script-owners username, and eg %u for the script-owners uid)

This would (eg) enable me to:
quis[at]istud:~# id
uid=1000(quis) gid=1000(users) groups=1000(users),10000(www-quis)
quis[at]istud:~# id www-quis
uid=10000(www-quis) gid=10000(www-quis) groups=10000(www-quis)
quis[at]istud:~# chown quis:www-quis public_html
quis[at]istud:~# chmod 750 public_html

So only 'my' apache-runas user can access my scripts.

How do you think about this idea ?
It does decrease the performance a bit (Workers should parse the
request, put it in some shm, Executive should pick it up from the shm
and really run the php-script (See the links above for the terms Worker
and Executive)
But if the option is not specified it is possible to do it 'the old way'.
Would it be possible to implement this as an MPM, or MOD ?
(I don't know enough (yet) of apache to say that.)
If that is possible there is no loss when it is disabled.

- -- Jille Timmermans
Ps Feel free to shoot me or my idea, or give suggestions for improving it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkge7vAACgkQacI4LQTe9EXNlACfdvZODF399uuwaDFJrUoTISOO
dAcAmQFnPinNwCrpCnUVvxu20wwFmybo
=Y2CY
-----END PGP SIGNATURE-----


chip at force-elite

May 5, 2008, 11:29 AM

Post #2 of 6 (284 views)
Permalink
Re: User/group security without CGI (SuEXEC) [In reply to]

Jille Timmermans wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello hackers!
>
> I was thinking of creating a more secure environment for running
> webscripts (mod_php in my case),
> I want to run php scripts as their owner.
>
> I tought of the following scheme's:
> http://junk.quis.cx/fViKmLRi/apache-user-scheme-p1.png
> http://junk.quis.cx/bPkxwAbI/apache-user-scheme-p2.png
> .....

The image in p2, is roughly what the 'perchild' MPM tried to do.

Its all feasible, its mostly a question of having a willing developr to
iron out all of the bugs on perchild or start with a new code base.

....
> How do you think about this idea ?
> It does decrease the performance a bit (Workers should parse the
> request, put it in some shm, Executive should pick it up from the shm
> and really run the php-script (See the links above for the terms Worker
> and Executive)
> But if the option is not specified it is possible to do it 'the old way'.
> Would it be possible to implement this as an MPM, or MOD ?

Yes, it should be possible to do this in an MPM.

Not to discourage you, but this is a hard problem, and many hours have
been spent on it before without much resulting, but I would welcome
someone who wants to do it :-)

-Paul


lazy404 at gmail

May 5, 2008, 1:28 PM

Post #3 of 6 (282 views)
Permalink
Re: User/group security without CGI (SuEXEC) [In reply to]

2008/5/5 Jille Timmermans <jille[at]quis.cx>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello hackers!
>
> I was thinking of creating a more secure environment for running
> webscripts (mod_php in my case),
> I want to run php scripts as their owner.
>
> I tought of the following scheme's:
> http://junk.quis.cx/fViKmLRi/apache-user-scheme-p1.png
> http://junk.quis.cx/bPkxwAbI/apache-user-scheme-p2.png
>
> And an setting:
> ExecutiveUser %n # This should run php scripts as $script-owner
> ExecutiveUser www-%n # this should run php scripts as www-$scriptowner
> ExecutiveGroup www
> ExecutiveGroup www-%n
> (%n meaning the script-owners username, and eg %u for the script-owners
> uid)
>
> This would (eg) enable me to:
> quis[at]istud:~# id
> uid=1000(quis) gid=1000(users) groups=1000(users),10000(www-quis)
> quis[at]istud:~# id www-quis
> uid=10000(www-quis) gid=10000(www-quis) groups=10000(www-quis)
> quis[at]istud:~# chown quis:www-quis public_html
> quis[at]istud:~# chmod 750 public_html
>
> So only 'my' apache-runas user can access my scripts.
>
> How do you think about this idea ?
> It does decrease the performance a bit (Workers should parse the
> request, put it in some shm, Executive should pick it up from the shm
> and really run the php-script (See the links above for the terms Worker
> and Executive)
> But if the option is not specified it is possible to do it 'the old way'.
> Would it be possible to implement this as an MPM, or MOD ?
> (I don't know enough (yet) of apache to say that.)
> If that is possible there is no loss when it is disabled.
take a look at peruser (http://www.telana.com/peruser.php)

It supports ssl, keep-alive, chroot and chuid per vhost

in simple configurations it seems to work out of the box with some quirks
1) graceful segfaults (apache continues to work)
2) on machines with multiple processors it hangs badly on gaceful restarts
3) some minor issues with ssl cache

last week, I think I ironed out 1 & 2 graceful's work flawlessly on a
busy webserwer (2xdc opteron) (around 300 diferent users with many
more vhosts).

Sadly support list for peruser seems to be dead and latest patch is
based on 2.2.3.

I fixed 2 race conditions, added limited support for ssl for
NamevirtualHosts and did some minor patches.

All without answer so i guess peruser isn't in active development anymore.

There is still an memory leak to plug, maybe my patches did some wrong
but for now it's not a big headache.

Peruser now for me is quite usable, i have some ideas to improve it. I
will do it anyway because i need it for my work.

Somebody told me to fork it, but will anyone care ?

--
Michal Grzedzicki


jille at quis

May 8, 2008, 10:17 AM

Post #4 of 6 (259 views)
Permalink
Re: User/group security without CGI (SuEXEC) [In reply to]

Lazy wrote:
> 2008/5/5 Jille Timmermans <jille[at]quis.cx>:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Hello hackers!
>>
>> I was thinking of creating a more secure environment for running
>> webscripts (mod_php in my case),
>> I want to run php scripts as their owner.
>>
>> I tought of the following scheme's:
>> http://junk.quis.cx/fViKmLRi/apache-user-scheme-p1.png
>> http://junk.quis.cx/bPkxwAbI/apache-user-scheme-p2.png
>>
>> And an setting:
>> ExecutiveUser %n # This should run php scripts as $script-owner
>> ExecutiveUser www-%n # this should run php scripts as www-$scriptowner
>> ExecutiveGroup www
>> ExecutiveGroup www-%n
>> (%n meaning the script-owners username, and eg %u for the script-owners
>> uid)
>>
>> This would (eg) enable me to:
>> quis[at]istud:~# id
>> uid=1000(quis) gid=1000(users) groups=1000(users),10000(www-quis)
>> quis[at]istud:~# id www-quis
>> uid=10000(www-quis) gid=10000(www-quis) groups=10000(www-quis)
>> quis[at]istud:~# chown quis:www-quis public_html
>> quis[at]istud:~# chmod 750 public_html
>>
>> So only 'my' apache-runas user can access my scripts.
>>
>> How do you think about this idea ?
>> It does decrease the performance a bit (Workers should parse the
>> request, put it in some shm, Executive should pick it up from the shm
>> and really run the php-script (See the links above for the terms Worker
>> and Executive)
>> But if the option is not specified it is possible to do it 'the old way'.
>> Would it be possible to implement this as an MPM, or MOD ?
>> (I don't know enough (yet) of apache to say that.)
>> If that is possible there is no loss when it is disabled.
> take a look at peruser (http://www.telana.com/peruser.php)
>
> It supports ssl, keep-alive, chroot and chuid per vhost
>
> in simple configurations it seems to work out of the box with some quirks
> 1) graceful segfaults (apache continues to work)
> 2) on machines with multiple processors it hangs badly on gaceful restarts
> 3) some minor issues with ssl cache
>
> last week, I think I ironed out 1 & 2 graceful's work flawlessly on a
> busy webserwer (2xdc opteron) (around 300 diferent users with many
> more vhosts).
>
> Sadly support list for peruser seems to be dead and latest patch is
> based on 2.2.3.
>
> I fixed 2 race conditions, added limited support for ssl for
> NamevirtualHosts and did some minor patches.
>
> All without answer so i guess peruser isn't in active development anymore.
>
> There is still an memory leak to plug, maybe my patches did some wrong
> but for now it's not a big headache.
>
> Peruser now for me is quite usable, i have some ideas to improve it. I
> will do it anyway because i need it for my work.
>
> Somebody told me to fork it, but will anyone care ?
I would really like to run it myself,
and I know a few others who would also like it.

I am willing to help you, however I don't know how.
My C skills are not that good, so I can't do it on my own.
I might be able to kill bugs if apache crashes and I can get a backtrace.
I can help you test it on FreeBSD, (FreeBSD jails are quite useful for
testing).

I think peruser would be a nice feature for apache, it would be a shame
if it got abandoned.

-- Jille


fuankg at apache

May 14, 2008, 10:51 AM

Post #5 of 6 (213 views)
Permalink
Re: User/group security without CGI (SuEXEC) [In reply to]

Hi,
>>> How do you think about this idea ?
do you already know this:
http://www.suphp.org/

Guenter.


jille at quis

May 14, 2008, 1:22 PM

Post #6 of 6 (211 views)
Permalink
Re: User/group security without CGI (SuEXEC) [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, but as stated in my email,
suphp uses cgi, which I don't like (unnecessary exec()'s), and is the
entire origin of my 'idea'.

- -- Jille

Guenter Knauf schreef:
| Hi,
|>>> How do you think about this idea ?
| do you already know this:
| http://www.suphp.org/
|
| Guenter.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgrShsACgkQacI4LQTe9EWkOgCgyRHfH4b24W8Pry0sSv5ToEBz
RH4AoJDqNuW8otsNX3dBQbBdE3XTomH6
=DmiU
-----END PGP SIGNATURE-----

Apache dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.