Page 1 of 1

GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2016-01-25 12:57
by doublem
Hallo zusammen,

auf einem OpenSUSE 13.2 Server mit Apache 2.4x mit GeoIP 1.5.1 möchte ich einige Länder + Crawler whitelisten, alles andere sperren.

Hier die /etc/apache2/conf.d/mod_geoip.conf:

Code: Select all

<IfModule mod_geoip.c>
    GeoIPEnable On
    GeoIPEnableUTF8 On
    # GeoIPOutput [Notes|Env|All]
    GeoIPOutput All

    <IfModule prefork.c>
        GeoIPDBFile /var/lib/GeoIP/GeoIP.dat MemoryCache
    </IfModule>
    <IfModule !prefork>
        GeoIPDBFile /var/lib/GeoIP/GeoIP.dat MMapCache
    </IfModule>
</IfModule>
Die /var/lib/GeoIP/GeoIP.dat ist vorhanden.

Und hier der vHost:

Code: Select all

<VirtualHost *:80>
        ServerName domain.eu
        UseCanonicalName Off
        DocumentRoot /srv/www/vhosts/csi203/domain.eu/httpdocs/web
        ErrorLog  /srv/www/vhosts/csi203/domain.eu/logs/error_log
        <Directory /srv/www/vhosts/csi203/domain.eu/httpdocs/web>
			<IfModule sapi_apache2.c>
					php_admin_value open_basedir "/srv/www/vhosts/csi203/domain.eu/httpdocs:/tmp"
			</IfModule>
			<IfModule mod_php5.c>
					php_admin_value open_basedir "/srv/www/vhosts/csi203/domain.eu/httpdocs:/tmp"
			</IfModule>
			<IfModule mod_rewrite.c>
					Options +SymLinksIfOwnerMatch
			</IfModule>
			AllowOverride None
			<IfModule !mod_geoip.c>
			Require all granted
			</IfModule>
			<IfModule mod_geoip.c>
					Require all granted
					# Whitelist
					SetEnvIfNoCase User-Agent (googlebot|bingbot|yahoo!\sslurp) AllowCountry
					SetEnvIf GEOIP_COUNTRY_CODE DE AllowCountry
					SetEnvIf GEOIP_COUNTRY_CODE AT AllowCountry
					SetEnvIf GEOIP_COUNTRY_CODE CH AllowCountry
					Allow from env=AllowCountry
					# Freigabe Loopback
					Require ip 192.168.0.1
			</IfModule>
        </Directory>
</VirtualHost>
Leider führt der Aufruf des vHosts zu einem
client denied by server configuration
.

Mit einem

Code: Select all

GeoIPEnable Off
funktioniert der Aufruf einwandfrei.

Was übersehe ich?

Vielen Dank!

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2016-01-25 14:24
by Joe User
Nach Deiner Config zu urteilen, solltest Du https://github.com/maxmind/geoip-api-mod_geoip2 Troubleshooting lesen und beachten.

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2016-01-25 16:42
by doublem
Hallo Joe User,

danke für Dein Feedback.

Die /var/lib/GeoIP/GeoIP.dat ist lesbar und die Domain wird nicht über das interne Netz aufgerufen.

Hast Du weitere Anhaltspunkte für mich?

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2016-01-25 17:24
by doublem
Fehler gefunden ;)

Im Apachen 2.4+ muss es natürlich

Code: Select all

Require env AllowCountry
statt

Code: Select all

Allow from env=AllowCountry
heißen.

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2016-01-25 18:41
by Joe User
Require all ... und Require ip ... sind dort wohl eher unerwünscht ;)

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2019-07-29 16:38
by Carsten66
Hallo in die Runde.

Ich habe das selbe Problem. werde massiv angegriffen aus Indien usw. Nun bräuchte ich Hilfe beim einrichten der geoip.
Leider ist letztes Jahr mein IT -Mann verstorben. Ich hatte mich jetzt versucht, jedoch klappt es nicht.

sobald ich geoipenable ON mache, geht nichts mehr.
#GeoIPEnable On
# Put countries to allow here
SetEnvIf GEOIP_COUNTRY_CODE DE AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE CH AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE AU AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE DEU AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE CHE AllowCountry
SetEnvIf GEOIP_COUNTRY_CODE AUT AllowCountry

Das Problem ist, es ist eine Seite gegen sexuellen missbrauch von Tieren und Kindern. Das gefällt den perversen nicht. Jetzt haben diese Zoophilen meine Seiten und Videos von mir in ihren Porno-Datebanken verlinkt, und jeder perverse greift jetzt auf unsere page zu.

einerseits ein gefallen, denn ich Speicher jede IP aus Deutschland, Schweiz oder Österreich. Viele perverse besuchen diese porno-seiten ohne VPN.

auf der anderen Seite brechen die Seiten ein wegen der massiven anfrage.



Mit freundlichen Grüßen Carsten

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2019-07-29 23:00
by Joe User
mod_goeip/mod_geoip2 werden nicht mehr supportet und die dazugehörigen Datenbanken sind nicht mehr nutzbar.

Bitte auf mod_maxminddb https://github.com/maxmind/mod_maxminddb umsteigen.

Re: GeoIP Konfiguration in Apache 2.4 vHosts

Posted: 2019-07-30 10:44
by ddm3ve
Carsten66 wrote: 2019-07-29 16:38 Hallo in die Runde.

Ich habe das selbe Problem. werde massiv angegriffen aus Indien usw. Nun bräuchte ich Hilfe beim einrichten der geoip.
Leider ist letztes Jahr mein IT -Mann verstorben. Ich hatte mich jetzt versucht, jedoch klappt es nicht.
Wie wäre es, wenn Du den Referer blockierst? Dann hast Du immer noch die Zugriffe dokumentiert....
Dennoch wäre die Last erstmal weg. Redirect oder deartiges.

Hier findest Du übrigens eine Liste der IP Ranges nach Länder, wenn Du auf Basis der IPs aussperren willst.:
https://die-ip-adresse.de/liste_laender_ip-adressen