summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-06-04 22:02:11 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2022-06-10 11:47:21 +0200
commit1804a3ded6bb5c584146162fc7554e8928a04ca5 (patch)
tree777fe4633791ff594047602e42d8858265f963d3
parent813069a5f0b8ca8eee1ef574b7ca31597a27059e (diff)
downloadvyos-build-1804a3ded6bb5c584146162fc7554e8928a04ca5.tar.gz
vyos-build-1804a3ded6bb5c584146162fc7554e8928a04ca5.zip
firewall: T4299: Include initial GeoIP database
-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