mirror of
https://github.com/OutlineFoundation/outline-server.git
synced 2026-08-04 14:37:34 +00:00
Use DB-IP's Geolocation database instead of MaxMind's (#557)
* Use DB-IP's free IP-to-Country database instead of MaxMind's This avoids the necesseity to either (1) bundle MaxMind's database in our docker image or (2) require server admins to individually create MaxMind accounts due to the new requirements for using GeoLite2 databases. See https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/ * Add attribution to DB-IP for the GeoIP database * Make sure that we deal with lag between the changeover of the current month and release of new versions of the DB-IP database * Respond to review comments * Attribute DB-IP in the update script * Respond to review comments * Respond to review comments
This commit is contained in:
parent
9400cb1fc6
commit
db6aba33b2
10 changed files with 6737 additions and 1495 deletions
|
|
@ -11,8 +11,9 @@
|
|||
* Ensure `bower_components` and `node_modules` are up to date and only include dependencies of the Electron app by running `yarn run clean && yarn && yarn do yarn do server_manager/web_app/build`
|
||||
* `cd src/server_manager`
|
||||
* `yarn workspace outline-manager licenses generate-disclaimer --prod > /tmp/yarn`
|
||||
* `node <bower-disclaimer repo root>/build > /tmp/bower`
|
||||
* `pushd <bower-disclaimer root> && yarn run clean && yarn && yarn licenses generate-disclaimer > /tmp/bower && popd`
|
||||
* `cat /tmp/{yarn,bower} > ui_components/licenses/licenses.txt`
|
||||
* `cat ui_components/licenses/db-ip_license.txt >> ui_components/licenses/licenses.txt`
|
||||
|
||||
Done!
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
------
|
||||
|
||||
IP Geolocation by DB-IP (https://db-ip.com)
|
||||
|
||||
This database is licensed under a Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/)
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -38,7 +38,7 @@ umask 0007
|
|||
# upon a limit of 32k files.
|
||||
ulimit -n 32768
|
||||
|
||||
# Start cron, which is used to check for updates to the GeoIP database
|
||||
# Start cron, which is used to check for updates to the IP-to-country database
|
||||
crond
|
||||
|
||||
node app/server/main.js
|
||||
|
|
|
|||
|
|
@ -1,13 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Download the GeoLite2 country database into the same location
|
||||
# Download the IP-to-country MMDB database into the same location
|
||||
# used by Alpine's libmaxminddb package.
|
||||
|
||||
# IP Geolocation by DB-IP (https://db-ip.com)
|
||||
|
||||
TMPDIR="$(mktemp -d)"
|
||||
FILENAME="GeoLite2-Country.mmdb"
|
||||
LIBDIR="/var/lib/libmaxminddb"
|
||||
curl --silent "https://geolite.maxmind.com/download/geoip/database/$FILENAME.gz" -o "$TMPDIR/$FILENAME.gz"
|
||||
FILENAME="ip-country.mmdb"
|
||||
|
||||
# We need to make sure that we grab an existing database at install-time
|
||||
for monthdelta in {0..10}; do
|
||||
newdate=$(date --date="-$monthdelta month" +%Y-%m)
|
||||
ADDRESS="https://download.db-ip.com/free/ip-country-${newdate}.mmdb.gz"
|
||||
curl --fail --silent "${ADDRESS}" -o "$TMPDIR/$FILENAME.gz" > /dev/null && break
|
||||
if (( monthdelta == 10 )); then
|
||||
# A weird exit code on purpose -- we should catch this long before it triggers
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
gunzip "$TMPDIR/$FILENAME.gz"
|
||||
LIBDIR="/var/lib/libmaxminddb"
|
||||
mkdir -p $LIBDIR
|
||||
mv -f "$TMPDIR/$FILENAME" $LIBDIR
|
||||
rmdir $TMPDIR
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import * as server_config from './server_config';
|
|||
import {OutlineSharedMetricsPublisher, PrometheusUsageMetrics, RestMetricsCollectorClient, SharedMetricsPublisher} from './shared_metrics';
|
||||
|
||||
const DEFAULT_STATE_DIR = '/root/shadowbox/persisted-state';
|
||||
const MMDB_LOCATION = '/var/lib/libmaxminddb/GeoLite2-Country.mmdb';
|
||||
const MMDB_LOCATION = '/var/lib/libmaxminddb/ip-country.mmdb';
|
||||
|
||||
async function exportPrometheusMetrics(registry: prometheus.Registry, port): Promise<http.Server> {
|
||||
return new Promise<http.Server>((resolve, _) => {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export class OutlineShadowsocksServer implements ShadowsocksServer {
|
|||
private readonly metricsLocation: string) {}
|
||||
|
||||
// Annotates the Prometheus data metrics with countries.
|
||||
// ipCountryFilename is the location of the GeoLite2-Country.mmdb file.
|
||||
// ipCountryFilename is the location of the ip-country.mmdb IP-to-country database file.
|
||||
enableCountryMetrics(ipCountryFilename: string): OutlineShadowsocksServer {
|
||||
this.ipCountryFilename = ipCountryFilename;
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Database and Contents Copyright (c) 2018 MaxMind, Inc.
|
||||
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
|||
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/.
|
||||
|
||||
This database incorporates GeoNames [http://www.geonames.org] geographical data, which is made available under the Creative Commons Attribution 3.0 License. To view a copy of this license, visit http://www.creativecommons.org/licenses/by/3.0/us/.
|
||||
Loading…
Add table
Add a link
Reference in a new issue