From 4881cb026ef5db16f7c8f15956770cfa9a1f9628 Mon Sep 17 00:00:00 2001 From: Bethuel Mmbaga Date: Wed, 28 Feb 2024 15:57:00 +0300 Subject: [PATCH] Add self-hosted guide for setting up geo-supported management (#149) * Add Geolocation support guide and update navigation * Expanded geolocation support guide in NetBird documentation * geo support docs reviewed --------- Co-authored-by: Julia --- src/components/NavigationDocs.jsx | 1 + src/pages/selfhosted/geo-support.mdx | 60 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/pages/selfhosted/geo-support.mdx diff --git a/src/components/NavigationDocs.jsx b/src/components/NavigationDocs.jsx index ec5c0134..a1c1008b 100644 --- a/src/components/NavigationDocs.jsx +++ b/src/components/NavigationDocs.jsx @@ -75,6 +75,7 @@ export const docsNavigation = [ { title: 'Advanced guide', href: '/selfhosted/selfhosted-guide' }, { title: 'Management SQLite Store', href: '/selfhosted/sqlite-store'}, { title: 'Supported IdPs', href: '/selfhosted/identity-providers' }, + { title: 'Management Geolocation', href: '/selfhosted/geo-support' }, { title: 'Troubleshooting', href: '/selfhosted/troubleshooting' }, ], }, diff --git a/src/pages/selfhosted/geo-support.mdx b/src/pages/selfhosted/geo-support.mdx new file mode 100644 index 00000000..4a324417 --- /dev/null +++ b/src/pages/selfhosted/geo-support.mdx @@ -0,0 +1,60 @@ +# Management Geolocation + +Traditionally, NetBird's management system has relied on Geolocation databases. In version 0.26.0, we introduced support for posture checks. From this version onwards, NetBird uses the GeoLite2 City database from [MaxMind](https://www.maxmind.com) to identify a peer's geographical location based on its IP address. + + +Even though we distribute the databases, MaxMind retains ownership. Please refer to the [license agreement](https://www.maxmind.com/en/geolite2/eula) details on MaxMind's website for specifics. + + +This guide outlines the steps to configure Management with the GeoLite2 database + +## Downloading the databases + +Upon NetBird Application startup, our management checks if the GeoLite2 databases exist in its data directory. If not present, the +databases will be downloaded from the following URLs: + +- GeoLite2 City Database: [Download Link](https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City/download?suffix=tar.gz) +- GeoLite2 City Database (SHA256): [Download Link](https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City/download?suffix=tar.gz.sha256) +- GeoLite2 City CSV Database: [Download Link](https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City-CSV/download?suffix=zip) +- GeoLite2 City CSV Database (SHA256): [Download Link](https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City-CSV/download?suffix=zip.sha256) + +After downloading, the management system prepares the databases for use. If the databases already exist, the system will load and utilize the existing ones. + +## Updating the GeoLite2 Database + +The GeoLite2 databases are updated twice a week to reflect changes in geolocation data. It's crucial to keep your +local GeoLite2 databases updated. You can achieve this manually through the script provided below. + +Here are the steps to update the GeoLite2 databases: + +### Step 1. Switch to the infrastructure files directory: +```bash +cd netbird/infrastructure_files/ +``` + +### Step 2. Run the script to download the GeoLite2 databases: +```bash +./download-geolite2.sh +``` +After successfully running the script, two database files (`geonames.db` and `GeoLite2-City.mmdb`) are created in the +`netbird/infrastructure_files/` directory. + +### Step 3. The next step involves moving these files into our management service container. + +Move the `geonames.db` database: +```bash +docker-compose cp geonames.db management:/var/lib/netbird/ +``` + +Move the `GeoLite2-City.mmdb` database: +```bash +docker-compose cp GeoLite2-City.mmdb management:/var/lib/netbird/ +``` + +4. To complete the process, restart the management service to ensure that it loads the updated databases: + +```bash +docker-compose restart management +``` +This completes the upgrade process. Your GeoLite2 databases are now up-to-date. +By following the guide above, your GeoLite2 databases should always be updated with the latest geolocation data. \ No newline at end of file