Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installed OK but country always AA - help troubleshooting #15

Open
Bombdogs opened this issue Dec 7, 2016 · 3 comments
Open

Installed OK but country always AA - help troubleshooting #15

Bombdogs opened this issue Dec 7, 2016 · 3 comments

Comments

@Bombdogs
Copy link

Bombdogs commented Dec 7, 2016

Hi,

we've used this great VMOD for some time on Varnish3 without issue. Building a new server from scratch with Varnish4 (centOS based) and have built the GeoIP VMOD ok...

# ls -al /usr/lib64/varnish/vmods/
total 336
drwxr-xr-x 2 root root   4096 Dec  7 12:13 .
drwxr-xr-x 3 root root   4096 Dec  2 12:25 ..
-rwxr-xr-x 1 root root 120206 Dec  1 10:53 libvmod_directors.so
-rw-r--r-- 1 root root  61260 Dec  7 12:13 libvmod_geoip.a
-rwxr-xr-x 1 root root    971 Dec  7 12:13 libvmod_geoip.la
-rwxr-xr-x 1 root root  41337 Dec  7 12:13 libvmod_geoip.so
-rwxr-xr-x 1 root root  99764 Dec  1 10:53 libvmod_std.so

Have the following in the VCL...

import geoip;
sub vcl_recv
{
  set req.http.X-Forwarded-For = client.ip;
  set req.http.X-GeoIP = geoip.country_code(req.http.X-Forwarded-For);
  ...

However always getting "AA" for the country code - which the README explains is an error (have also tried the country & contry_code_from_ip equivelant methods). Ive checked that the IP is req.http.X-Forwarded-For is accurately reflecting user's IP. We have the Geoip package installed and the MaxMind .dat files are in place...

# ls -al /usr/share/GeoIP/
total 54620
drwxr-xr-x  2 root root     4096 Dec  7 12:53 .
drwxr-xr-x 81 root root     4096 Dec  7 10:23 ..
lrwxrwxrwx  1 root root       16 Dec  7 10:06 GeoIPASNum.dat -> GeoLiteASNum.dat
-rw-r--r--  1 root root  4705700 Jul 11 08:44 GeoIPASNumv6.dat
lrwxrwxrwx  1 root root       15 Dec  7 10:06 GeoIPCity.dat -> GeoLiteCity.dat
lrwxrwxrwx  1 root root       17 Dec  7 10:06 GeoIPCityv6.dat -> GeoLiteCityv6.dat
lrwxrwxrwx  1 root root       18 Dec  7 12:53 GeoIP.dat -> GeoLiteCountry.dat
-rw-r--r--  1 root root  1688515 Jul 11 08:44 GeoIPv6.dat
-rw-r--r--  1 root root  3958758 Jul 11 08:44 GeoLiteASNum.dat
lrwxrwxrwx  1 root root       16 Dec  7 10:06 GeoLiteASNumv6.dat -> GeoIPASNumv6.dat
-rw-r--r--  1 root root 21933406 Jul 11 08:44 GeoLiteCity.dat
-rw-r--r--  1 root root 22721994 Jul 11 08:45 GeoLiteCityv6.dat
-rw-r--r--  1 root root   904073 Jul 11 08:44 GeoLiteCountry.dat

Any help or guidance on what/where to check next would be greatly appreciated!

Many thanks,
Paul

@jesusmc
Copy link

jesusmc commented Aug 3, 2017

Hi,

Same problem, any solution? Ubuntu 16.04 LTS with Varnish 4.1

Thanks in advance.

@SpoddyCoder
Copy link

@jesusmc didn't find a solution I'm afraid. Ended up using the vmod here instead

https://github.com/fgsch/libvmod-geoip2

@jesusmc
Copy link

jesusmc commented Aug 3, 2017

Hi,

I debug for a couple of hours varnish, varnishd is not loading any GeoIP database file, so I think the init method is never called. I deploy your recomentadion @SpoddyCoder, it works perfectly.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants