Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > contrib-release > by-pkgid > 0a79c2f4a8b4059ce301ebce6e191af3 > files > 6

apache-mod_ipenv-1.0.2-6mdv2008.1.x86_64.rpm

What's this?
------------
ipenv is the module to set/unset environment variables
based on client IP addresses or client hostnames.

This is useful for these purposes.
 -access controls based on IP addresses and host names
  by corporating with mod_access(mod_authz_host for apache 2.2 or later).
 -URL rewritings based on IP addressed and host names
  by corporating with mod_rewrite.

Compilation and Installation
----------------------------
Compile and install with apxs (apxs2 in some environments).

 # apxs -c -i mod_ipenv.c

or

 $ apxs -c mod_ipenv.c
 # apxs -i mod_ipenv.c


Usage
-----
Write ip addresses and host names(domain names) in a text file.

 # cat access/localhost.conf
 127.0.0.1
 192.168.0.0/24
 .localdomain
 localhost.example.com

Load ipenv_module.

  LoadModule ipenv_module  mod_ipenv.so

Use SetEnvIp directive where you want control environment variables.

  <Directory "/var/www/html/local">
    SetEnvIp access/localhost.conf LOCAL
    Order deny,allow
    deny from all
    allow from LOCAL
  </Diretory>


Directive
---------
SetEnvIp ƒfƒBƒŒƒNƒeƒBƒu
  Description:  Sets/Unsets environment variables based on
                client IP addresses or host names.
  Syntax:       SetEnvIp file [!]envname
  Context:      server config, virtual host, directory, .htaccess
  Override:     FileInfo 
  
  Sets(Unsets when ! is prefixed) the environment variable when the IP address
  or the host name of the request client matches some entries in the file.
  The host name is resolved perfirming a double revese DNS lookup.
  
  Following entries can be written in the file.
  -comment
    Started with #, that line is ignored as a comment.
    Example:
      #some comments
  
  -IP address
    An complete IP address, the prefix of an IP address, an IP address with a netmask
    (i.e. subnet), or an IP address with a netmask specified with the number of the bits
    is allowed.
    Example:
      192.168.0.1
      192.168.0.
      192.168.0.0/255.255.255.0
      192.168.0.0/24
  
  -host name(FQDN)
    Example:
      host.example.com
  
  -domain name
    Example:
      .example.com


Notes
-----
Outside <Directory> or <Location>(that is, server-wide or virtual-server-wide
configurations), you cannot have mod_setenvif and mod_ipenv cooperate.
This is because mod_setenvif works earlier than mod_ipenv in server-wide
configurations (works as a post_read_request handler).
This problem will NOT be resolved in future releases.


TODO
----
-Running tests in various environments.
-Implementation to watch the timestamp of the file, and reload the cache
 when an update detected(like RewriteMap).


Bugs
----
When you find any bugs, please send report to
Ikeda Yasuyuki<yasuke@users.sourceforge.net>.


Copyright
---------
Copyright 2006 Ikeda Yasuyuki

ipenv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

ipenv is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ipenv; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA