MAXMINDをIPアドレス逆引きのために設定する

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

@pfaffman 様、「マイライセンスキー」のURLにはMaxMindのアカウントIDが含まれているため、あなた以外の方には機能しません :wink:

「いいね!」 3

うまくいきました!:winking_face_with_tongue:

面白いのは、3年間誰も文句を言わなかったことです!これはwikiなので、あなたが修正できます。もし覚えていれば、コンピューターにアクセスできたときに更新を試みます。

「いいね!」 2

このようなページを実際に読んでいる人がどれだけいるかを示しています :grin:

ページを編集しました :nerd_face:

「いいね!」 3

そうですよね!?そして、私はそれを作成するのにかなりの時間を費やしました。リンクが私だけに機能していたことにどうして気づかなかったのかわかりませんが、ログインする必要があったことが私や他の多くの人を十分に気を散らませたのだと思います。

「いいね!」 2

ちょっとした疑問ですが、@evertさん、括弧をそのまま残すつもりでしたか?もしそうなら、ボタンにした方が見栄えが良いでしょうか?

ボタンの例

ライセンスキーの管理

<kbd>ライセンスキーの管理</kbd>
「いいね!」 3

いいですよ、なぜだめなのですか? :+1:t2:

「いいね!」 2

私の知る限りでは問題ないようです

image

しかし、すべてのユーザーの場所が「不明」と表示されます

どなたか助けていただけると幸いです。

文字を削除して再構築する必要があります。# 文字は YAML ファイル全体をコメントにします。

「いいね!」 5

ありがとうございます。書き出して終了、または再構築もしますか?

再構築が必要です。そうしないと、Discourse は app.yml の変更を認識しません。

「いいね!」 4

ありがとうございます。完了し、動作しています :hugs:

「いいね!」 2

ほとんどの方には言うまでもないことかもしれませんが、VPNを使用しているユーザーは他のユーザーよりも多くの警告を生成する可能性があります。これは管理者への注意喚起であり、必ずしも悪意のあるユーザーを示すものではありません。

「いいね!」 2

完璧です!このチュートリアルをありがとう。

「いいね!」 1

すみません、Discourseが管理パネルでIPルックアップ(逆引きIP)を実行する際、オフラインのGeoIPデータベースに依存していますか、それとも毎回外部APIにクエリを送信していますか?よろしくお願いします!!

「いいね!」 1

文脈として、私の好みは、外部APIを呼び出すのではなく、DiscourseをローカルのGeoLite2-City.mmdbファイルにポイントすることで、IPルックアップをオフラインで処理することです。

まだIPv6に対応していないのですか?そろそろこのトラフィックをIPv4にリダイレクトする時期かもしれませんね。

私は立ち往生しています。正しくセットアップされていると思うのですが、MaxMind DBのダウンロードで401エラーが発生しています。

私は標準的なインストール、自己ホスト、最新の状態です。
MaxMindにアカウントを作成し、新しいライセンスキーを追加しました。

app.yml の ENV セクションを次のように編集しました:

  ## MaxMindの地理的IPアドレス検索用のIPアドレスキー
  ## 詳細は https://meta.discourse.org/t/-/137387/23 を参照
  DISCOURSE_MAXMIND_ACCOUNT_ID: [私のアカウントID]
  DISCOURSE_MAXMIND_LICENSE_KEY: [私のライセンスキー]

その後、./launcher rebuild app を実行しました。

再構築の際、次のような「401 Unauthorized」エラーがログに出力されました:

MaxMind database GeoLite2-City download failed. : OpenURI::HTTPError : 401 Error
MaxMind database GeoLite2-ASN download failed. : OpenURI::HTTPError : 401 Error

(もちろん、DBファイルは /var/www/discourse/vendor/data に届きませんでした)

この提案に従い、MaxMind開発者ポータルで見つけたコマンドを使用して、同じ資格情報でデータベースを直接ダウンロードしました:

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

これは正常に動作しました。

Discourseから接続する際に401エラーが発生する原因として、私が見落としている可能性のあるものは何でしょうか?