Re: add httpd.conf directive

2007-09-18 Thread Philippe M. Chiasson
[EMAIL PROTECTED] wrote:
 Hello,
 
 I'm running mp1 with PerlAccessHandler handler.
 I want to add some config directive into httpd.conf,and let my module 
 use them for passing auth.
 ie,in httpd.conf I add these lines,
 
 PassAuthIPs12.34.56.78  23.45.67.89
 
 Then the requests from these IPs would get past.
 How can I do it?thanks.

You can implement your own httpd.conf directives with some effort:

http://perl.apache.org/docs/1.0/guide/config.html#Adding_Custom_Configuration_Directives
 and
http://perl.apache.org/docs/2.0/user/config/custom.html

But, for simple needs, you should also consider using PerlSetVar

http://perl.apache.org/docs/2.0/user/config/config.html#C_PerlSetVar_


Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm)\.org/



signature.asc
Description: OpenPGP digital signature


add httpd.conf directive

2007-09-17 Thread pennyyh

Hello,

I'm running mp1 with PerlAccessHandler handler.
I want to add some config directive into httpd.conf,and let my module 
use them for passing auth.

ie,in httpd.conf I add these lines,

PassAuthIPs12.34.56.78  23.45.67.89

Then the requests from these IPs would get past.
How can I do it?thanks.




Check out the new free AOL Email -- 2GB of storage and industry-leading 
spam and email virus protection.


Re: add httpd.conf directive

2007-09-17 Thread André Warnier



[EMAIL PROTECTED] wrote:

I'm running mp1 with PerlAccessHandler handler.
I want to add some config directive into httpd.conf,and let my module 
use them for passing auth.

ie,in httpd.conf I add these lines,

PassAuthIPs12.34.56.78  23.45.67.89

Then the requests from these IPs would get past.


Isn't that easier to do with the following standard Apache directives 
(independently of mod_perl) ?

location  /xyz
  Deny from all
  Allow from (list of IP's)
/location

If the above is not applicable, then you could use something like
location /xyz
  PerlSetVar AllowedIps ip1 ip2 ip3
  ...
/location

and in your module do

sub handler {
  my $r = shift; # the request object
  my $AllowedIps = $r-dir_config('AllowedIps') || ''; # get ip1 ip2 ip3
  ...
}
and I guess there must be a function in mod_perl to get the IP from 
which the request is coming, to compare.


Hope this helps.


Re: add httpd.conf directive

2007-09-17 Thread Jeff Pang
2007/9/17, André Warnier [EMAIL PROTECTED]:


 If the above is not applicable, then you could use something like
 location /xyz
PerlSetVar AllowedIps ip1 ip2 ip3
...
 /location

 and in your module do

 sub handler {
my $r = shift; # the request object
my $AllowedIps = $r-dir_config('AllowedIps') || ''; # get ip1 ip2 ip3
...
 }

Also you can add them in httpd.conf,

PerlAddVar PassAuthIPs 11.11.11.11
PerlAddVar PassAuthIPs 22.22.22.22
PerlAddVar PassAuthIPs 33.33.33.33

and in modperl handler,

@pass_ips = $r-dir_config-get('PassAuthIPs');

this would get the IPs you set with PassAuthIPs in httpd.conf.