summaryrefslogtreecommitdiff
path: root/data/live-build-config
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-06-12 09:30:30 +0200
committerGitHub <noreply@github.com>2022-06-12 09:30:30 +0200
commit001451a9c514e798538524d1beffbc9898eb00b9 (patch)
tree591b9504d73362251c52475b97697a315c86be17 /data/live-build-config
parent0c8c728dead25a201c013607c23b1fc21e7ad36a (diff)
parent1804a3ded6bb5c584146162fc7554e8928a04ca5 (diff)
downloadvyos-build-001451a9c514e798538524d1beffbc9898eb00b9.tar.gz
vyos-build-001451a9c514e798538524d1beffbc9898eb00b9.zip
Merge pull request #243 from sarthurdev/geoip
firewall: T4299: Include initial GeoIP database
Diffstat (limited to 'data/live-build-config')
-rwxr-xr-xdata/live-build-config/hooks/live/40-init-geoip-database.chroot16
1 files changed, 16 insertions, 0 deletions
diff --git a/data/live-build-config/hooks/live/40-init-geoip-database.chroot b/data/live-build-config/hooks/live/40-init-geoip-database.chroot
new file mode 100755
index 00000000..4f9186c3
--- /dev/null
+++ b/data/live-build-config/hooks/live/40-init-geoip-database.chroot
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# Geolocation data provided by DB-IP.com
+# License: https://creativecommons.org/licenses/by/4.0/ (CC BY 4.0)
+
+DATE_SUFFIX=$(date +%Y-%m)
+URL="https://download.db-ip.com/free/dbip-country-lite-${DATE_SUFFIX}.csv.gz"
+OUT_PATH="/usr/share/vyos-geoip/dbip-country-lite.csv.gz"
+
+mkdir -p $(dirname $OUT_PATH)
+wget -O - $URL > $OUT_PATH
+
+if [ $? -ne 0 ]; then
+ echo "Failed to download GeoIP database"
+ rm $OUT_PATH
+fi