httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William McKee <will...@knowmad.com>
Subject Getting User and Group from custom httpd.conf
Date Fri, 12 Dec 2003 12:55:43 GMT
Hi,

This is my first posting to the list so please forgive my ignorance of
any customs. I am in the process of getting a test environment setup
using the Apache::Test package. While originally installing the package
a few months ago, I ran into a couple of problems which I posted to
rt.cpan.org. Stas kindly replied to both my tickets:
	#3860- a comment about problems with custom httpd in
		/usr/local/apache/bin
	#3861- problems with the generation of the httpd.conf file

Over the course of our conversation about the latter bug, Stas explained
that User and Group directives get set to 'nobody' if TEST is run as
root, otherwise these values get set to the current user. My web
environment is setup with 'www' as the owner of the Apache processes so
I needed to pass in the -User and -Group parameters to TEST to get the
proper settings for my environment.

Stas suggested that I look into a way of reading these values from the
system-installed httpd.conf file. I began to work on that task last
evening (yeah, I got a bit derailed for a few months). While doing so, I
sent the message at the end of this email to Stas. He suggested that I
join the mailing list and post my findings here.

As I contemplate this matter after a night's rest, I'm wondering if it's
such a good idea to get the values of User and Group from the
httpd.conf. It was rather easy to add the ability to pull these entries
from the original http.conf (save some extra logic that needs to be
written to only retrieve the first set from the global options) which
makes me wonder if there was a reason these have been purposely left out
of the TestConfigParse.pm module.

Thanks for any advice and pointers.

William


----- Forwarded message from Stas Bekman <stas@stason.org> -----

> To: william@knowmad.com
> From: Stas Bekman <stas@stason.org>
> Date: Thu, 11 Dec 2003 20:52:12 -0800
> Subject: [Fwd: [cpan #3861] Custom t/conf/httpd.conf.in is ignored]
> Organization: Hope, Humanized
> 
> Hi William,
> 
> this shouldn't be a private discussion. There is a team of developers that 
> handle that module. So if you'd be so kind to repost this to
> test-dev@httpd.apache.org and may be giving some more background on what 
> you are trying to overcome, that would be very helpful. (You may want to 
> subscribe to the list first - test-dev-subscribe@httpd.apache.org, 
> otherwise it may take some time for your message to get approved). I'm 
> about to leave shortly and won't be able to look at it untill I'm back a 
> few days later. So may be Geoff will be able to work with you to resolve 
> the issue while I'm away. Thank you.
> 
> -------- Original Message --------
> Subject: [cpan #3861] Custom t/conf/httpd.conf.in is ignored
> Date: Thu, 11 Dec 2003 21:26:54 -0500 (EST)
> From: Guest via RT <bug-Apache-Test@rt.cpan.org>
> Reply-To: bug-Apache-Test@rt.cpan.org
> To: AdminCc of cpan Ticket #3861: ;
> 
> 
> This message about Apache-Test was sent to you by guest <> via rt.cpan.org
> 
> Full context and any attached attachments can be found at:
> <URL: https://rt.cpan.org/Ticket/Display.html?id=3861 >
> 
> [STAS - Fri Oct  3 18:25:27 2003]:
> 
> >You should be able to grep for this kind of tokens. It's coming from
> >TestConfigParse.pm.
> 
> Hi Stas,
> 
> I've finally had a chance to take another look at parsing the httpd.conf
> file for the Group and User settings. I looked in the TestConfigParse.pm
> file; there's some nice, but complex, code in that module.
> 
> >From what I could figure out, the %wanted_config contains a hash of
> hashes which is used to parse the config file. The TAKE1 group appears
> to be made for retrieving a single key, so I added User and Group to
> that list.
> 
> Now, however, I'm stuck. If I dump the vars hashref after running
> inherit_config, the values of User and Group are my user id 'william'
> (despite the fact that I'm running the script as root). I also looked at
> the value of User when it was being parsed inside of the
> inheret_config_file_or_directory sub. The script had the right values.
> 
> I tried debugging but this part of the code is wrapped inside of an eval
> which sets ulimit before calling the script again. Is there a way to
> debug under this situation?
> 
> So, I'm not sure what needs to happen to get the correct User and Group
> values into the vars hash. Sorry it's been so long but hopefully you can
> pick up the thread by reviewing the messages at rt.cpan.org.
> 
> Now that I think about it, it could be that the parsing routine is
> getting the last User and Group values. Looking at my httpd.conf, this
> appears to be the case. However, those are settings for a VirtualHost
> which probably isn't what we want. We want the global User and Group
> settings which is typically(?) going to be the first value. So, how to
> skip further user and group lines in the parsing? Any suggestions?
> 
> Thanks,
> William
> 
> -- 
> 
> 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com

----- End forwarded message -----

-- 
Knowmad Services Inc.
http://www.knowmad.com

Mime
View raw message