Configura MAXMIND per le ricerche IP inverse

What is MAXMIND and why would I want it?

Discourse uses MAXMIND to provide geographical information for reverse IP lookups.

location

Without Maxmind’s database you’ll see something like this:
nolocation

Or perhaps you’ve noticed this message fly by when you rebuild your container:

MaxMind IP database download requires an account ID and a license key
Please set DISCOURSE_MAXMIND_ACCOUNT_ID and DISCOURSE_MAXMIND_LICENSE_KEY. See https://meta.discourse.org/t/configure-maxmind-for-reverse-ip-lookups/173941 for more details.

Why would I care?

It’s often useful for moderators to see where someone is logging in from to determine if the person is who (and where) they say they are or to diagnose problems with your site. (“Oh, we frequently see problems with Special-ISP”.)

Also, as of 2.2.0.beta4, Discourse also uses this information to notify admins if a login is seen from a new location. Without the Maxmind database, Discourse cannot provide this notification.

What if I don’t setup a MaxMind account and generate a license key

You won’t be able to do reverse lookups. If the issues above do not concern you, then it is a good bet that nothing bad will happen if you just ignore this.

How do I setup a MaxMind account and obtain an Account ID and a license key?

See Maxmind’s https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key page for up-to-date instructions, but you need to

  • Visit the GeoLite2 Sign Up page.
  • generate a license key on the Manage License Keys tab in the left navigation bar once you’ve logged in. Generate a new key, and copy the account ID and the license key. If you lose it, you’ll need to generate a new one.

You then add that key to the ENV section of your app.yml with a line like this:

  DISCOURSE_MAXMIND_ACCOUNT_ID: your-account-id-here
  DISCOURSE_MAXMIND_LICENSE_KEY: your-key-here

Or via discourse-setup when prompted.

Notes for IPv6 users

The Standard install doesn’t fully support IPv6 out of the box. If you have a server with IPv6 configured and need Maxmind information for IPv6 addresses, you’ll need to make sure that the user’s actual IP address is what is getting to Discourse, normally by using an external proxy that passes the remote IP address to Discourse. This requires more systems administration expertise than the standard install.

31 Mi Piace

@pfaffman, l’URL di ‘My License Keys’ contiene il tuo ID account MaxMind e quindi non funzionerà per nessun altro tranne te :wink:

3 Mi Piace

Funziona per me! :winking_face_with_tongue:

La cosa divertente, però, è che nessun altro si è lamentato per 3 anni! È una wiki, quindi puoi sistemarla. Cercherò di aggiornarla quando sarò al computer, se riuscirò a ricordarmene.

2 Mi Piace

Mostra quante persone leggono effettivamente pagine come queste :grin:

Ho modificato la pagina :nerd_face:

3 Mi Piace

Già!? E ci ho passato un bel po’ di tempo a crearlo. Non sono sicuro di come mi sia sfuggito che il link funzionasse solo per me, ma immagino che dover accedere sia stato sufficiente a distrarmi e forse a molte altre persone.

2 Mi Piace

Solo una domanda per curiosità, @evert, intendevi lasciare le parentesi quadre lì? Se sì, forse starebbe meglio come pulsante?

Esempio di pulsante

Manage License Keys

<kbd>Manage License Keys</kbd>
3 Mi Piace

Certo, perché no? :+1:t2:

2 Mi Piace

Per quanto ne so, sono pronto a partire

image

ma tutti gli utenti mostrano la posizione “sconosciuta”

Qualsiasi aiuto è apprezzato.

Devi rimuovere il carattere # davanti e ricostruire. Il carattere # rende l’intera riga un commento nel file YAML.

5 Mi Piace

Grazie, basta scrivere ed uscire o ricostruire anche?

Devi ricostruire. Altrimenti Discourse non vedrà le modifiche a app.yml.

4 Mi Piace

Grazie, fatto e funzionante :hugs:

2 Mi Piace

Probabilmente è superfluo dirlo per molti qui, ma qualcuno che utilizza una VPN potrebbe generare più avvisi di altri. È un incentivo per gli amministratori, ma non indica necessariamente un utente malintenzionato.

2 Mi Piace

Perfetto! grazie per questo tutorial.

1 Mi Piace

Mi scusi,
Quando Discourse esegue una ricerca IP (reverse-IP) per il pannello di amministrazione, si basa su un database GeoIP offline o interroga un’API esterna ogni volta?

grazie!!

1 Mi Piace

Per contesto, la mia preferenza è gestire le ricerche IP offline puntando Discourse a un file locale GeoLite2-City.mmdb, piuttosto che chiamare un’API esterna.

Ancora nessun supporto per IPv6? Forse è ora di reindirizzare questo traffico a v4 ):

Beh, sono bloccato. Penso di essere configurato correttamente, ma sto ricevendo un errore 401 per i download del database MaxMind.

Sono su un’installazione standard, self-hosted e aggiornata.

Ho creato un account su MaxMind e aggiunto una nuova chiave di licenza.

Ho modificato la sezione ENV di app.yml come segue:

  ## La chiave di geolocalizzazione IP di MaxMind per la ricerca dell'indirizzo IP
  ## vedi https://meta.discourse.org/t/-/137387/23 per dettagli
  DISCOURSE_MAXMIND_ACCOUNT_ID: [il mio ID account]
  DISCOURSE_MAXMIND_LICENSE_KEY: [la mia chiave di licenza]

…poi ho eseguito ./launcher rebuild app

Durante il rebuild, sono stati registrati questi errori “401 Unauthorized”:

Download del database MaxMind GeoLite2-City fallito. : OpenURI::HTTPError : 401 Error
Download del database MaxMind GeoLite2-ASN fallito. : OpenURI::HTTPError : 401 Error

(…e ovviamente nessun file del database è arrivato nella mia /var/www/discourse/vendor/data)

Secondo questa suggerimento ho usato un comando trovato sul Portale sviluppatori di MaxMind — con le stesse credenziali — per scaricare direttamente un database:

curl -O -J -L -u [my account ID]:[my license key] \
'https://download.maxmind.com/geoip/databases/GeoLite2-City/download?suffix=tar.gz'

…che ha funzionato senza problemi.

Cosa potrei aver trascurato che causa un 401 quando mi connetto da Discourse?