From 0909c0d15058ddf023369afefab634781cc2702d Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 4 Jan 2015 13:40:34 +0100 Subject: [PATCH] Automatically download and update GeoIP Databases. --- config/cron/crontab | 3 +++ .../networking/red.up/99-geoip-database | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/initscripts/init.d/networking/red.up/99-geoip-database diff --git a/config/cron/crontab b/config/cron/crontab index d78d08f593..54e9b5fee2 100644 --- a/config/cron/crontab +++ b/config/cron/crontab @@ -57,3 +57,6 @@ HOME=/ # Re-read firewall rules every Sunday in March, October and November to take care of daylight saving time 00 3 * 3 0 /usr/local/bin/timezone-transition /usr/local/bin/firewallctrl 00 2 * 10-11 0 /usr/local/bin/timezone-transition /usr/local/bin/firewallctrl + +# Update GeoIP database once a month. +3 2 1 * * * [ -f "/var/ipfire/red/active" ] && /usr/local/bin/xt_geoip_update >/dev/null 2>&1 diff --git a/src/initscripts/init.d/networking/red.up/99-geoip-database b/src/initscripts/init.d/networking/red.up/99-geoip-database new file mode 100644 index 0000000000..020f2fa2da --- /dev/null +++ b/src/initscripts/init.d/networking/red.up/99-geoip-database @@ -0,0 +1,20 @@ +#!/bin/bash + +# Get the GeoIP database if no one exists yet. + +DIR=/usr/share/xt_geoip + +found=false + +# Check if the directory contains any data. +for i in $DIR/*; do + found=true + break +done + +# Download ruleset if none has been found. +if ! ${found}; then + /us/local/bin/xt_geoip_update >/dev/null 2>&1 +fi + +exit 0 -- 2.39.5