Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geoip: update GeoIP.conf with AccountID for geoipupdate #580

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions provision/geoip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ preflight_check() {
echo "ERROR: edit mail-toaster.conf and set MAXMIND_LICENSE_KEY"
exit 1
fi

if [ "$GEOIP_UPDATER" = "geoipupdate" ] && [ -z "$MAXMIND_ACCOUNT_ID" ]; then
echo "ERROR: edit mail-toaster.conf and set MAXMIND_ACCOUNT_ID"
exit 1
fi
}

install_geoip_geoipupdate()
Expand Down Expand Up @@ -77,6 +82,14 @@ configure_geoip()
if [ -f "$ZFS_DATA_MNT/geoip/GeoIP.conf" ]; then
tell_status "installing GeoIP.conf"
cp "$ZFS_DATA_MNT/geoip/GeoIP.conf" "$STAGE_MNT/usr/local/etc"
else
sed -i '' \
-e "/^AccountID/ s/YOUR_ACCOUNT_ID_HERE/$MAXMIND_ACCOUNT_ID/" \
-e "/^LicenseKey/ s/YOUR_LICENSE_KEY_HERE/$MAXMIND_LICENSE_KEY/" \
-e '/^EditionIDs/ s/GeoLite2-City/GeoLite2-City GeoLite2-ASN/' \
-e '/^# DatabaseDirectory/ s/^# //' \
-e '/^DatabaseDirectory/ s|/usr/local/share/GeoIP|/data/db|' \
"$STAGE_MNT/usr/local/etc/GeoIP.conf"
fi

geoip_periodic
Expand Down