0

I want to test a configuration in apache. How can I "debug" the configuration file ? For example, let's say that I have :

<IfModule mod_geoip.c>
    GeoIPEnable On
    GeoIPDBFile PATH_TO_LIB\GeoIP.dat
    GeoIPEnableUTF8 On
    GeoIPOutput All
</IfModule>

Can i send a fake IP locally to the header ? (ie) Can I locally fake/spoff another IP than 127.0.0.1 ?

Ismail H
  • 107
  • 7
  • Have you tried apachectl -M or apache2ctl -M? This will tell you if the module has been loaded. Other than that, you could put something that Apache will not like, such as a purposely bad command and if apache spits out an error - it parsed the conf file. Just putting "TEST IF THIS LINE IS CALLED" as you have should result in a conf file parse error. – Gmck Jan 06 '16 at 19:04
  • Thanks for the help. I now know that the line is called. (sorry can't uopvote the comment yet) – Ismail H Jan 07 '16 at 09:44
  • What is the actual module you are trying to load? Is it a standard apache mod? – Gmck Jan 07 '16 at 14:50
  • I edited the question @Gmck It is GeoIP that I am trying (desperatly) to test locally. – Ismail H Jan 07 '16 at 14:53
  • You have to test from a public IP address, not a local one. TCP relies on a 3 way handshake to initialize requests. if you spoof your originating IP address, you will never get past the synchronization stage and no HTTP information will be sent. – Gmck Jan 07 '16 at 15:13

1 Answers1

1

With that configuration you can't (at least easily). I suggest for testing, you add this option:

GeoIPScanProxyHeaders On

From the documentation (http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Proxy-Related_Directives)

When this is set, the module will look at several other sources for the IP address, in this order:

The HTTP_CLIENT_IP environment variable (set by Apache).

The HTTP_X_FORWARDED_FOR environment variable (set by Apache). The X-Forwarded-For for header (set by a proxy).

The HTTP_REMOTE_ADDR environment variable (set by Apache).

Set that option for testing and remove it when done. Then you can send arbitrary IP's as HTTP headers with curl, ex:

curl --header "X-Forwarded-For: 1.2.3.4" "http://your.site/path"

Fredi
  • 2,257
  • 10
  • 13