pam_geoip(8)
π pam_geoip(8) β the manual, but make it make sense π
okay bestie, sit down, hydrate, because we're talking about pam_geoip β the PAM module that checks where in the world your remote user is logging in from. yes, like, geographically. no cap. πΊοΈβ¨
π NAME
pam_geoip β GeoIP account management module for (Linux-)PAM
like it's literally in the name bestie, geo + ip, we're doing location vibes inside your PAM stack π«Ά
β¨ SYNOPSIS
account required pam_geoip.so [system_file=file] [geoip_db=file]
[action=name] [language=name] [debug]
that's it, that's the whole incantation π
π¦ DESCRIPTION
so the pam_geoip module does one (1) thing and does it gorgeously: it checks whether the remote logged-in user is logging in from a given location. it's giving pam_access(8) energy, except instead of matching host names / IPs it uses a GeoIP2 City or GeoIP2 Country database. glow up fr fr πΈ
the matching happens on given country and city names, or on distance from a given location. and heads up: if you're rocking a country database, then country matching is all you get, that's the whole menu.
this PAM module provides the account hook only. that's the only hook. don't ask for more, she's specialized. π
if an IP isn't found in the GeoIP2 database, the location it matches against gets set to "UNKNOWN, *", and obviously no distance matching is possible for those, like, how would you even. π
and here's a cute lil twist: if a file named /etc/security/geoip.SERVICE.conf can be opened (with SERVICE being the name of the PAM service), that one gets used instead of the default /etc/security/geoip.conf. sneaky. iconic. β¨
the first matching entry in the geoip.conf(5) file wins β like first come first served at a sample sale β so the action given in that line is what gets returned to PAM:
allowβ returnsPAM_SUCCESSdenyβ returnsPAM_PERM_DENIEDignoreβ returnsPAM_IGNORE
π OPTIONS
these options may be given in the PAM config file as parameters:
system_file=/path/to/geoip.confβ the configuration file forpam_geoip. default is/etc/security/geoip.conf. for the format of this file, go readgeoip.conf(5).
NOTE: when a file/etc/security/geoip.SERVICE.conffile is present, this switch is ignored (with"SERVICE"being the name of the PAM service, e.g."sshd"). so like, don't be shocked when yoursystem_filejust gets ghosted. π
geoip_db=/path/to/GeoLite2-City.mmdbβ the GeoIP2 database to use. default:/usr/share/GeoIP/GeoLite2-City.mmdb. this must be a "GeoIP2 City Edition" or a "GeoIP2 Country Edition" file, see<https://www.maxmind.com/en/geoip2-databases>and<https://dev.maxmind.com/geoip/geoip2/geolite2/>for more information. no knockoff databases pls, she can tell. π
the database can contain IPv4 or IPv6 addresses or both. multitasking queen. π
action=ACTIONβ sets the default action if no location matches. default is"deny". other possible values are"allow"or"ignore". for the meanings of these, see above (scroll up bestie, we literally just did this). β¬οΈlanguage=NAMEβ sets the language to be used to find names (city etc.). default is"en". πdebugβ adds some debugging output to syslog. for when you need to know why, and honestly same. π
π FILES
/etc/security/geoip.confβ the default configuration file for this module/etc/security/geoip.SERVICE.confβ the default configuration file for PAM service SERVICE/etc/pam.d/*β thePAM(7)configuration files
π SEE ALSO
geoip.conf(5), pam_access(8), pam.d(5), pam(7)
like go read those too, they're the supporting cast and they ate π
π«Ά AUTHOR
Amish β GeoIP2 Hanno Hecker β Legacy GeoIP "<vetinari@ankh-morp.org>"
and that's the whole page bestie!! this version is from 2024-02-05, and it belongs to the pam_geoip(8) manual β so if you ever forget where you read all this, it's literally right there in the footer, periodt. πβ¨π
π¦ where this page comes from
- debian trixie: libpam-geoip 2.1.1-8 Β· BSD-3-Clause
- ubuntu noble: libpam-geoip 2.1.1-8 Β· BSD-3-Clause
- ubuntu questing: libpam-geoip 2.1.1-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms