Make Digital Beautiful.

und schnell

Aktualisierung der Geolokalisierungsdatenbanken für Crowdsec WordPress

Bash Script:

#!/bin/bash

# Set the path to the directory where the database is stored
DATABASE_DIR='PATH/TO/YOUR_WPCONTAINER/wp-content/plugins/crowdsec/geolocation'

export GEOIP_EDITION='GeoLite2-Country'
export GEOIP_LICENCE_KEY='YOUR KEY'
export GEOIP_TMP_FILE=geoip.tar.gz

curl -sS "https://download.maxmind.com/app/geoip_download?edition_id=${GEOIP_EDITION}&license_key=${GEOIP_LICENCE_KEY}&suffix=tar.gz" > $GEOIP_TMP_FILE && 
tar -xzf $GEOIP_TMP_FILE --wildcards "*/${GEOIP_EDITION}.mmdb" --strip=1                                                                                && 
rm $GEOIP_TMP_FILE
mv GeoLite2-Country.mmdb $DATABASE_DIR/GeoLite2-Country.mmdb

Das Skript ausführbar machen:

chmod +x geoupdate.sh

Per Crontab zweimal die Woche aktualisieren

0 6 * * 3,6 /path/to/geoupdate.sh >> /path/to/geo.log 2>&1

Dies führt das Skript „Um 06:00 Uhr am Mittwoch und Samstag“ aus.
Für Leute, wie mich gibt es hier ein nettes Tool, um die richtige Zeit zu generieren ⇾ https://crontab.guru/

Maxmind bezüglich Updates:

GeoLite2 databases are free IP geolocation databases comparable to, but less accurate than, MaxMind’s GeoIP2 databases. The GeoLite2 Country, City, and ASN databases are updated twice weekly, every Tuesday and Friday. GeoLite2 data is also available as a web service in the GeoLite2 Country and GeoLite2 City web services. Users of the GeoLite2 web services are limited to 1000 IP address lookups per service per day.

GeoLite2 Free Geolocation Data | MaxMind Developer Portal