You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Adam Tilghman <ag...@ieng9.ucsd.edu> on 2004/05/14 20:06:58 UTC

Discover which MPM is loaded?

Hi,

I'm writing a module which plays with seteuid/setegid,
and should therefore only be run under the prefork MPM.

I'd like to ensure that the currently loaded MPM is "prefork" during
the initialization stage of my module, but I haven't been able to find
a way to determine which MPM is currently running.

Is there a simple method I've missed,
or can anybody offer suggestions where I should look?

Thanks,

-- 
Adam Tilghman  |  Systems Support / Academic Computing  |     +1 858 822 0711
 agt@ucsd.edu  |  University of California, San Diego   | fax +1 858 534 7018

Re: Discover which MPM is loaded?

Posted by Mark Wolgemuth <ma...@employease.com>.
On May 15, 2004, at 12:25 PM, Adam Tilghman wrote:

>>> I'm writing a module which plays with seteuid/setegid,
>>> and should therefore only be run under the prefork MPM.
>>
>> at low level your reliance is on a single-threaded process handling
>> requests?
>
> That's correct - I'm switching UID/GID on every request based on
> the provided authenticated username.  It seems to me a multi-threaded
> server wouldn't be able to handle this situation very well.
>

You know, I'd recommend using apache in reverse proxy mode.
You can then implement a module that rewrites the ProxyPass destination 
according to authenticated user name. This is done my modifying the 
host/port component of the location stored in r->filename.
If you hook your handler APR_HOOK_FIRST, but after mod_proxy, you can 
accomplish this. Then, the target destination would be another instance 
of apache running entirely in that user.

Of course, this would assume you have enough memory to handle multiple 
instances, and that you know the list of users ahead of time.

On the plus side, it prevents any potential wierdness with launching 
per-request server instances, and will be much more efficient in the it 
allows you to use threads.

--mark

>> ap_mpm_query() can check for such MPM characteristics
>
> Thanks! I'll check out that function.
>
> -- 
> Adam Tilghman  |  Systems Support / Academic Computing  |     +1 858 
> 822 0711
>  agt@ucsd.edu  |  University of California, San Diego   | fax +1 858 
> 534 7018
>


Re: Discover which MPM is loaded?

Posted by Mark Wolgemuth <ma...@employease.com>.
On May 17, 2004, at 1:18 PM, Adam Tilghman wrote:

>>> That's correct - I'm switching UID/GID on every request based on
>>> the provided authenticated username.  It seems to me a multi-threaded
>>> server wouldn't be able to handle this situation very well.
>> You know, I'd recommend using apache in reverse proxy mode.
> [...]
>> Of course, this would assume you have enough memory to handle multiple
>> instances, and that you know the list of users ahead of time.
>
> We're going to be using this module to support mod_dav in a university
> setting, with 30k potential users and hundreds of simultaneous 
> sessions.
>
> It seems to me that running in reverse proxy mode as you suggest would
> require one running instance per possible UID, which would be fine for
> tens or even hundreds of users, but not for the number we have to 
> support.
>
> Am I understanding this reverse proxy concept properly?
>

Yes, you are. It's not tenable for the deploy senario you require. I 
use this method for loadbalancing, where it distributes to < 1000 
instances.

> Thanks!
>
> -- Adam
>


Re: Discover which MPM is loaded?

Posted by Enrico Weigelt <we...@metux.de>.
* Adam Tilghman <ag...@ieng9.ucsd.edu> wrote:

<snip>
> It seems to me that running in reverse proxy mode as you suggest would
> require one running instance per possible UID, which would be fine for
> tens or even hundreds of users, but not for the number we have to support.

You're probably interested in metuxmpm, which is able to run different
vhosts on different users.
We could change it to use also auth credentials instead of vhost for 
the user selection.

http://nibiru.borg.metux.de:7000/wiki.mpm/


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact@metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------
 -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------

Re: Discover which MPM is loaded?

Posted by Adam Tilghman <ag...@ieng9.ucsd.edu>.
> >That's correct - I'm switching UID/GID on every request based on
> >the provided authenticated username.  It seems to me a multi-threaded
> >server wouldn't be able to handle this situation very well.
> You know, I'd recommend using apache in reverse proxy mode.
[...]
> Of course, this would assume you have enough memory to handle multiple 
> instances, and that you know the list of users ahead of time.

We're going to be using this module to support mod_dav in a university
setting, with 30k potential users and hundreds of simultaneous sessions.  

It seems to me that running in reverse proxy mode as you suggest would
require one running instance per possible UID, which would be fine for
tens or even hundreds of users, but not for the number we have to support.

Am I understanding this reverse proxy concept properly?

Thanks!

-- Adam

Re: Discover which MPM is loaded?

Posted by mark <ma...@node.to>.
On May 15, 2004, at 12:25 PM, Adam Tilghman wrote:

>>> I'm writing a module which plays with seteuid/setegid,
>>> and should therefore only be run under the prefork MPM.
>>
>> at low level your reliance is on a single-threaded process handling
>> requests?
>
> That's correct - I'm switching UID/GID on every request based on
> the provided authenticated username.  It seems to me a multi-threaded
> server wouldn't be able to handle this situation very well.
>

You know, I'd recommend using apache in reverse proxy mode.
You can then implement a module that rewrites the ProxyPass destination 
according to authenticated user name. This is done my modifying the 
host/port component of the location stored in r->filename.
It looks like "proxy:protocol://host:port/file" when in reverse proxy".
If you hook your handler APR_HOOK_FIRST, but after mod_proxy, you can 
accomplish this. Then, the target destination would be another instance 
of apache running entirely in that user.

Of course, this would assume you have enough memory to handle multiple 
instances, and that you know the list of users ahead of time.

On the plus side, it prevents any potential wierdness with launching 
per-request server instances, and will be much more efficient in the it 
allows you to use threads.

--mark


>> ap_mpm_query() can check for such MPM characteristics
>
> Thanks! I'll check out that function.
>
> -- 
> Adam Tilghman  |  Systems Support / Academic Computing  |     +1 858 
> 822 0711
>  agt@ucsd.edu  |  University of California, San Diego   | fax +1 858 
> 534 7018
>


Re: Discover which MPM is loaded?

Posted by Adam Tilghman <ag...@ieng9.ucsd.edu>.
> >I'm writing a module which plays with seteuid/setegid,
> >and should therefore only be run under the prefork MPM.
> 
> at low level your reliance is on a single-threaded process handling 
> requests?

That's correct - I'm switching UID/GID on every request based on
the provided authenticated username.  It seems to me a multi-threaded
server wouldn't be able to handle this situation very well.

> ap_mpm_query() can check for such MPM characteristics

Thanks! I'll check out that function.

-- 
Adam Tilghman  |  Systems Support / Academic Computing  |     +1 858 822 0711
 agt@ucsd.edu  |  University of California, San Diego   | fax +1 858 534 7018

Re: Discover which MPM is loaded?

Posted by Jeff Trawick <tr...@attglobal.net>.
Adam Tilghman wrote:
> Hi,
> 
> I'm writing a module which plays with seteuid/setegid,
> and should therefore only be run under the prefork MPM.

at low level your reliance is on a single-threaded process handling requests?

ap_mpm_query() can check for such MPM characteristics