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

Add self-hosted guide for setting up geo-supported management #149

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/components/NavigationDocs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
},
Expand Down
60 changes: 60 additions & 0 deletions src/pages/selfhosted/geo-support.mdx
Original file line number Diff line number Diff line change
@@ -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.

<Note>
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.
</Note>

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.
Loading