vetinari / pam_geoip

pam_geoip - GeoIP account management module for (Linux-)PAM
2 stars 0 forks source link

GeoIP_record_by_name always returns null with country db #1

Open indigoxela opened 7 years ago

indigoxela commented 7 years ago

Hi, I'm not sure if this is the right place for a bugreport or this is just a mirror.

When using GeoIP.dat (country) with pam_geoip, no record is found.

Log output: ...no record for X.X.X.X setting GeoIP to 'UNKNOWN,*'

The IP of course has a record in the db: geoiplookup -f /path/to/GeoIP.dat X.X.X.X outputs the correct country

When using GeoLiteCity.dat, everything works fine.

I'm no c programmer, so I'm just guessing: Function GeoIP_record_by_name is not part of pam_geoip, but comes with libgeoip (geoip api by maxmind). https://github.com/maxmind/geoip-api-c/blob/master/libGeoIP/GeoIPCity.c

Possibly it requires GeoLiteCity.dat and is unusable with GeoIP.dat?

My versions are Debian distri packages and possibly outdated: libpam-geoip 1.1-1 libgeoip1:i386 1.6.2-4

vetinari commented 7 years ago

The country version does not work, only the city version of the DB

indigoxela commented 7 years ago

The country version does not work, only the city version of the DB

Well, if this is the known behaviour and you don't plan to implement support for the geolite country db, it would be helpful, if this requirement was clarified somewhere in the docs.

Right now both manpages are misleading, because they mention country db and claim that it's supported. http://ankh-morp.org/code/pam_geoip/

vetinari commented 7 years ago

Can you set the "debug" flag in the pam.d/ file for the geoip and check which file it detects? Messages should contain "GeoIP DB" or "GeoIP edition: "

indigoxela commented 7 years ago

Here's the debug output with both - GeoLiteCity.dat and GeoIP.dat - for the same location. Both geoip db's are fresh, from May 2.

GeoLiteCity.dat output (which is working):

GeoIP edition: 2
GeoIP v4 edition: city rev1
GeoIP DB is City: yes
GeoIP record for 213.163.X.X: AT,mylocation
GeoIP coordinates for 213.163.X.X: 4X.266701,X.700000

GeoIP.dat (which fails):

GeoIP edition: 1
GeoIP v4 edition: country
GeoIP DB is City: no
no record for 213.163.X.X, setting GeoIP to 'UNKNOWN,*'
GeoIP record for 213.163.X.X: UNKNOWN,*

This is the verbose version output of geoiplookup:

GeoLiteCity.dat GeoIP City Edition, Rev 1: GEO-533LITE 20170502 Build 1 Copyright (c) 2017 MaxMind Inc All Rights Reserved

GeoIP.dat GeoIP Country Edition: GEO-106FREE 20170502 Build 1 Copyright (c) 2017 MaxMind Inc All Rights Reserved

With geoiplookup (commandline tool) both db's return the correct location.