Tuesday, May 22, 2012

mod_rpaf install in debian

Its a module for Apache2 which takes the last IP from the 'X-Forwarded-For' header.
rpaf is short for reverse proxy add forward.
It changes the remote address of the client visible to other Apache modules when two conditions are satisfied. First condition is that the remote client is actually a proxy that is defined in httpd.conf. Secondly if there is an incoming X-Forwarded-For header and the proxy is in its list of known proxies it takes the last IP from the incoming X-Forwarded-For header and changes the remote address of the client in the request structure.
Module configuration is pretty simple, there are only two directives to set; RPAFenable and RPAFproxy_ips. With the later you can define which IP's are your frontend proxies that sends the correct X-Forwarded-For headers. If you do not use the RPAFproxy_ips directive then the module will not change the remote address of the incoming connection at any time. RPAFsethostname will, when enabled, take the incoming X-Host header and update the virtualhost settings accordingly.
# apt-get install libapache2-mod-rpafor
# aptitude install libapache2-mod-rpaf

After installing the above package please enable it:

# a2enmod rpaf# apache2ctl -t
# apache2ctl restart

The configuration file will be automatically be created at this location.
/etc/apache2/mods-available/rpaf.conf

Now, mod_rpaf will grab IP from X_FORWARDED_FOR header and place it in REMOTE_ADDR server variable.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews