From 12c36312b51a771763c3735f5be2a319762e0277 Mon Sep 17 00:00:00 2001 From: benniekiss <63211101+benniekiss@users.noreply.github.com> Date: Mon, 9 Sep 2024 12:27:42 -0400 Subject: [PATCH] [management] Auto update geolite (#2297) introduces helper functions to fetch and verify database versions, downloads new files if outdated, and deletes old ones. It also refactors filename handling to improve clarity and consistency, adding options to disable auto-updating via a flag. The changes aim to simplify GeoLite database management for admins. --- .../workflows/test-infrastructure-files.yml | 26 +-- .gitignore | 1 - client/ui/bundled.go | 12 + infrastructure_files/download-geolite2.sh | 109 --------- management/cmd/management.go | 8 +- management/cmd/root.go | 2 + management/server/geolocation/database.go | 52 +++-- management/server/geolocation/geolocation.go | 207 ++++++++++-------- .../server/geolocation/geolocation_test.go | 14 +- management/server/geolocation/store.go | 72 +----- management/server/geolocation/utils.go | 19 ++ .../server/http/geolocation_handler_test.go | 11 +- ...-Test.mmdb => GeoLite2-City_20240305.mmdb} | Bin ...{geonames-test.db => geonames_20240305.db} | Bin 14 files changed, 199 insertions(+), 334 deletions(-) create mode 100644 client/ui/bundled.go delete mode 100755 infrastructure_files/download-geolite2.sh rename management/server/testdata/{GeoLite2-City-Test.mmdb => GeoLite2-City_20240305.mmdb} (100%) rename management/server/testdata/{geonames-test.db => geonames_20240305.db} (100%) diff --git a/.github/workflows/test-infrastructure-files.yml b/.github/workflows/test-infrastructure-files.yml index 03ecbd445..d1aef3324 100644 --- a/.github/workflows/test-infrastructure-files.yml +++ b/.github/workflows/test-infrastructure-files.yml @@ -209,8 +209,8 @@ jobs: working-directory: infrastructure_files/artifacts run: | sleep 30 - docker compose exec management ls -l /var/lib/netbird/ | grep -i GeoLite2-City.mmdb - docker compose exec management ls -l /var/lib/netbird/ | grep -i geonames.db + docker compose exec management ls -l /var/lib/netbird/ | grep -i GeoLite2-City_[0-9]*.mmdb + docker compose exec management ls -l /var/lib/netbird/ | grep -i geonames_[0-9]*.db test-getting-started-script: runs-on: ubuntu-latest @@ -237,7 +237,7 @@ jobs: run: test -f management.json - name: test turnserver.conf file gen postgres - run: | + run: | set -x test -f turnserver.conf grep external-ip turnserver.conf @@ -278,7 +278,7 @@ jobs: run: test -f management.json - name: test turnserver.conf file gen CockroachDB - run: | + run: | set -x test -f turnserver.conf grep external-ip turnserver.conf @@ -291,21 +291,3 @@ jobs: - name: test relay.env file gen CockroachDB run: test -f relay.env - - test-download-geolite2-script: - runs-on: ubuntu-latest - steps: - - name: Install jq - run: sudo apt-get update && sudo apt-get install -y unzip sqlite3 - - - name: Checkout code - uses: actions/checkout@v3 - - - name: test script - run: bash -x infrastructure_files/download-geolite2.sh - - - name: test mmdb file exists - run: test -f GeoLite2-City.mmdb - - - name: test geonames file exists - run: test -f geonames.db diff --git a/.gitignore b/.gitignore index cdce46975..d0b4f82dd 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,3 @@ infrastructure_files/setup.env infrastructure_files/setup-*.env .vscode .DS_Store -GeoLite2-City* \ No newline at end of file diff --git a/client/ui/bundled.go b/client/ui/bundled.go new file mode 100644 index 000000000..e2c138b14 --- /dev/null +++ b/client/ui/bundled.go @@ -0,0 +1,12 @@ +// auto-generated +// Code generated by '$ fyne bundle'. DO NOT EDIT. + +package main + +import "fyne.io/fyne/v2" + +var resourceNetbirdSystemtrayConnectedPng = &fyne.StaticResource{ + StaticName: "netbird-systemtray-connected.png", + StaticContent: []byte( + "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01\x00\x00\x00\x01\x00\b\x06\x00\x00\x00\\r\xa8f\x00\x00\x00\xc3zTXtRaw profile type exif\x00\x00x\xdamP\xdb\r\xc3 \f\xfc\xf7\x14\x1d\xc1\xaf\x80\x19\x874\xa9\xd4\r:~\r8Q\x88r\x92χ\x9d\x1cư\xff\xbe\x1fx50)\xe8\x92-\x95\x94СE\vW\x17\x86\x03\xb53\xa1v>@\xc1S\x1dNɞų\x8c\x86\xa5\xf8\xeb\xa8\xd3d\x83T]-\x17#{Gc\x9d\x1bEGf\xbb\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b7\xb5\xc8\x11з\r\\\\\xb75y\x0f\xb8\xdc\x01\x06\x9ftɐ\x1c\xc9OS(\x14\x80\xf73\xfa\xa6\x1c\xd0\x7f\v\xf4\xae\xb9\xbd\xb5\xf6q\xfa\x00d\xa8\xab\xe4\rpp\b\x8c\x15){\xdd\xe3\xdd=\x9d\xbd\xfd{\xa6\xd5\xdf\x0fںr\xd0VwQ\xba\x00\x00\rxiTXtXML:com.adobe.xmp\x00\x00\x00\x00\x00\n\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\xf0C\xff\xd9\x00\x00\x00\x06bKGD\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\tpHYs\x00\x00\v\x13\x00\x00\v\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\atIME\a\xe8\x02\x17\r$'\xdd\xf7ȗ\x00\x00\x13;IDATx\xda\xed\x9d]o\x14W\x9a\xc7\xff\xa7\xaamh\xbf\xc46,I`\x99\xa1\xc3\ni\xb5{1\x95O0\xe4\x1b\xc0'X\xf2\t`.W`hp\xa2\xb9\fH{O\xa3\xcc\xc5\xecJ3q\xa4\x1d\xed\xcdJx>Aj/\"EBJګL \xb1\x00g\xf1\v\xb6\xbb\xeb\xec\x85mb\f\xb6\xfb\xa5^Ω\xfa\xfd\xee\x928v\xf7\xa9z\xfe\xcfs\x9e\xa7ο$\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\u0603a\t\xc0g\xd6\x7f\x1f5\x92\x8e\"k\xd4\b\xa4s\xb2jH\x9afez\n\xfe\xdb\b\x00x\x81mF\x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x00\xcan\xf3\x85\x00乀\xc7:Wk\x17~\x90\u0084\xc5pI\x00\xd6\x0e\xa8\x00\x8c\xdac\xdd\xea\x8e\xfd\x10\x80\x14Y\x9b\x8b\xaeʪaF;\x1a\xb9\xf0\x18\x11pI\x00\x0ehȚD\xb7M3^f\x85\x10\x80\xa1XoF\r\x19]{uc\xd574r\xfeG\x16\xc6\x15\xba\xc1\x9b\x0eA%}\xbb\x0f\x02P\x00IM\xb7d\xd5x\xed\xfe\x9aXWxn\x89\xc5q\xa6\x0f\xf0\xfa6\xc0\x84\xfa\x88UA\x00R\xc9\xfe\xc6\xea\xca\xdb\xfe[x\xe2\x05\"\xe0\xe06\xa0J6_\b@\xd6\xd9?\xd4\x17\x87\xfd\xf7\xf0\xc4\v\x85\xa7\x9f\xb3P\x8e\b\x80\x95\x96\x19\xfb!\x00\xa9\xb0r'\xba\xb2\xff1්\xc0\xfb\xcf\x11\x01w*\x80{d\x7f\x04 \x9d\x05\vt\xabןE\x04\nf\xedX%\xde\xee\x83\x00\xe4\xb5\xf7\x9f\x8b\xdeh\xfc!\x02\x0eW\x00ݠ\x926_\xfd\xc0i\xc0^\x83\xbf\x195l\xa8\xef\x06\xfd\xff;\x8b\xa70\n\xc9\xfb\xe6~g\xbd=\xd5\xfa\xaf\x0fX\t*\x80\xa1Ij\xbd\x97\xfeo\xa3vnI\xc1\x89\x17,d\x8e\x84'V\xc8\xfeT\x00\xc5g\xff\xbdl=:û\x02\xf2\xc8lc\x9b\xf3\xef\xfc\xe1?/\xb3\x12T\x00\xc3\xef%kz\x98\xd6\xef\x1a9\xffD\xa6\xbeɢf\x99\xd5F;\xeav&~\xc7J \x00C\xb3r'\xba\xd2o\xe3\xef\xf0\xba4\xd1ȅ\x1f\x10\x81,K\xff\xa9\xf5\xd6\xcc\x1f\xff\xd8f%\x10\x80\xa1K\xff~\xc6~\xfd\x88@\xed\xfc\x13\x99\xd1\x0e\x8b\x9c>\xed\xb0\xb1\xc4\xde\x1f\x01H#P\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ⴟg\"\x10\x1c\xdf\xc2\xe6\xcbA\xbck\x02\xd2\xf8+\x8eA\xadŰ\xf9\xa2\x02H\rl\xbe\x8a\xad\x04\x061\x14\xc1\xe6\v\x01H\x85չ\xe8\x126_\xc5R;\xb7ԗ\b`\xf3\x85\x00\xa4\xb7_1\xfa\x8cK\xe6\x86\b\xf4\xe4%\x10&\xcb#'W\x19\xfb!\x00\xc3\xc3\xd8\xcf-z1\x141\xf5\xcd{\xf5\xbb\vd\x7f\x97\x93\xaa\x0f\x1f\x12\x9b/G\xe9\x06\xda\xfa\xe6\xecA\x86\"\xed\xe9?\xff\x99\xc6\x1f\x15\xc0\xf0`\xf3\xe5(ar\xe01\xe2Zc\x89ҟ\n \xa5\xec\xcf\xd8\xcfi\xf6[\x8ba\xf3E\x05\x90\xde\xcd\x15\xd2\xf8s>\x8b\xec1\x141a\x82͗G\xd4\\\xfep\xabs\xd1%\x19E\x92\xda\\*\xc7E\xe0XG#\xff\xf0X\x1b\x8b\xa7\xbe\x9c\xf9\xc3<\xd7\v\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\xe4\xff\x01\xf6P(\xf3)+S\x1f\x00\x00\x00\x00IEND\xaeB`\x82"), +} diff --git a/infrastructure_files/download-geolite2.sh b/infrastructure_files/download-geolite2.sh deleted file mode 100755 index 4a9db5e01..000000000 --- a/infrastructure_files/download-geolite2.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -# to install sha256sum on mac: brew install coreutils -if ! command -v sha256sum &> /dev/null -then - echo "sha256sum is not installed or not in PATH, please install with your package manager. e.g. sudo apt install sha256sum" > /dev/stderr - exit 1 -fi - -if ! command -v sqlite3 &> /dev/null -then - echo "sqlite3 is not installed or not in PATH, please install with your package manager. e.g. sudo apt install sqlite3" > /dev/stderr - exit 1 -fi - -if ! command -v unzip &> /dev/null -then - echo "unzip is not installed or not in PATH, please install with your package manager. e.g. sudo apt install unzip" > /dev/stderr - exit 1 -fi - -download_geolite_mmdb() { - DATABASE_URL="https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City/download?suffix=tar.gz" - SIGNATURE_URL="https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City/download?suffix=tar.gz.sha256" - # Download the database and signature files - echo "Downloading mmdb signature file..." - SIGNATURE_FILE=$(curl -s -L -O -J "$SIGNATURE_URL" -w "%{filename_effective}") - echo "Downloading mmdb database file..." - DATABASE_FILE=$(curl -s -L -O -J "$DATABASE_URL" -w "%{filename_effective}") - - # Verify the signature - echo "Verifying signature..." - if sha256sum -c --status "$SIGNATURE_FILE"; then - echo "Signature is valid." - else - echo "Signature is invalid. Aborting." - exit 1 - fi - - # Unpack the database file - EXTRACTION_DIR=$(basename "$DATABASE_FILE" .tar.gz) - echo "Unpacking $DATABASE_FILE..." - mkdir -p "$EXTRACTION_DIR" - tar -xzvf "$DATABASE_FILE" > /dev/null 2>&1 - - MMDB_FILE="GeoLite2-City.mmdb" - cp "$EXTRACTION_DIR"/"$MMDB_FILE" $MMDB_FILE - - # Remove downloaded files - rm -r "$EXTRACTION_DIR" - rm "$DATABASE_FILE" "$SIGNATURE_FILE" - - # Done. Print next steps - echo "" - echo "Process completed successfully." - echo "Now you can place $MMDB_FILE to 'datadir' of management service." - echo -e "Example:\n\tdocker compose cp $MMDB_FILE management:/var/lib/netbird/" -} - - -download_geolite_csv_and_create_sqlite_db() { - DATABASE_URL="https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City-CSV/download?suffix=zip" - SIGNATURE_URL="https://pkgs.netbird.io/geolocation-dbs/GeoLite2-City-CSV/download?suffix=zip.sha256" - - - # Download the database file - echo "Downloading csv signature file..." - SIGNATURE_FILE=$(curl -s -L -O -J "$SIGNATURE_URL" -w "%{filename_effective}") - echo "Downloading csv database file..." - DATABASE_FILE=$(curl -s -L -O -J "$DATABASE_URL" -w "%{filename_effective}") - - # Verify the signature - echo "Verifying signature..." - if sha256sum -c --status "$SIGNATURE_FILE"; then - echo "Signature is valid." - else - echo "Signature is invalid. Aborting." - exit 1 - fi - - # Unpack the database file - EXTRACTION_DIR=$(basename "$DATABASE_FILE" .zip) - DB_NAME="geonames.db" - - echo "Unpacking $DATABASE_FILE..." - unzip "$DATABASE_FILE" > /dev/null 2>&1 - -# Create SQLite database and import data from CSV -sqlite3 "$DB_NAME" <