1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-09-16 19:02:23 +02:00

Fix missing Maxmind license key issue (#566)

* Add option to add maxmind license key in setup

* Update symfony/http-foundation to patch security vulnerability

* Remove echo statement

* fix typo
This commit is contained in:
Chaoyi Zha 2020-10-06 14:18:26 -04:00 committed by GitHub
parent f9622d733b
commit 8d55dabee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1633 additions and 996 deletions

View File

@ -106,6 +106,8 @@ class SetupController extends Controller {
$polr_recaptcha_site_key = $request->input('setting:recaptcha_site_key');
$polr_recaptcha_secret_key = $request->input('setting:recaptcha_secret_key');
$maxmind_license_key = $request->input('maxmind:license_key');
$acct_username = $request->input('acct:username');
$acct_email = $request->input('acct:email');
$acct_password = $request->input('acct:password');
@ -148,6 +150,7 @@ class SetupController extends Controller {
'APP_STYLESHEET' => $app_stylesheet,
'POLR_GENERATED_AT' => $date_today,
'POLR_SETUP_RAN' => $polr_setup_ran,
'MAXMIND_LICENSE_KEY' => $maxmind_license_key,
'DB_HOST' => $db_host,
'DB_PORT' => $db_port,
@ -240,7 +243,7 @@ class SetupController extends Controller {
if (env('SETTING_ADV_ANALYTICS')) {
$geoip_db_created = self::updateGeoIP();
if (!$geoip_db_created) {
return redirect(route('setup'))->with('error', 'Could not fetch GeoIP database for advanced analytics. Perhaps your server is not connected to the internet?');
return redirect(route('setup'))->with('error', 'Could not fetch GeoIP database for advanced analytics. Perhaps your server is not connected to the internet or your MAXMIND_LICENSE_KEY is incorrect?');
}
}

View File

@ -15,7 +15,8 @@
"geoip2/geoip2": "^2.4",
"nesbot/carbon": "^1.22",
"doctrine/dbal": "^2.5",
"google/recaptcha": "~1.1"
"google/recaptcha": "~1.1",
"symfony/http-foundation": "2.7.51"
},
"require-dev": {
"fzaninotto/faker": "~1.0",

2585
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ return [
'maxmind_database' => [
'class' => \Torann\GeoIP\Services\MaxMindDatabase::class,
'database_path' => storage_path('app/geoip.mmdb'),
'update_url' => 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz',
'update_url' => sprintf('https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=%s&suffix=tar.gz', env('MAXMIND_LICENSE_KEY')),
'locales' => ['en'],
],

View File

@ -0,0 +1,20 @@
# Obtaining a MaxMind GeoIP License Key
-----------------
If you would like to use "advanced analytics" in order to get more insights on your users, you must input a MaxMind GeoIP license key during the setup process or add it later to your configuration file (`.env`).
To obtain a license key, create an account on [MaxMind's website](https://www.maxmind.com/en/geolite2/signup). After you create your account and confirm your email, go to your [MaxMind account page](https://www.maxmind.com/en/accounts/current/license-key) to generate a license key for use with Polr. If you are asked whether your license key will be used for "GeoIP Update", answer no.
Copy your newly generated license key and input it into Polr.
## Troubleshooting
### I'm having trouble running `php artisan geoip:update`, and I'm using an older version of Polr
If you are on an older version of Polr, your installation may be updated. Update Polr by running `git pull` and then add a new entry to your `.env` configuration file:
```
MAXMIND_LICENSE_KEY="LICENSE_KEY_GOES_HERE"
```
Then, run `php artisan config:cache` and `php artisan geoip:update` again.

View File

@ -4,6 +4,7 @@ pages:
- User Guide:
- 'Installation': 'user-guide/installation.md'
- 'Upgrading': 'user-guide/upgrading.md'
- 'Obtaining a MaxMind License Key': 'user-guide/maxmind-license.md'
- 'Troubleshooting': 'user-guide/troubleshooting.md'
- Developer Guide:
- 'Libraries': 'developer-guide/libraries.md'

View File

@ -26,6 +26,9 @@ POLR_GENERATED_AT="{{$POLR_GENERATED_AT}}"
# e.g true
POLR_SETUP_RAN={{$POLR_SETUP_RAN}}
# Steps for obtaining a Maxmind License Key: https://docs.polrproject.org/en/latest/user-guide/maxmind-license
MAXMIND_LICENSE_KEY="{{$MAXMIND_LICENSE_KEY}}"
DB_CONNECTION=mysql
# Set to your DB host (e.g localhost)
DB_HOST="{{{$DB_HOST}}}"

View File

@ -65,6 +65,16 @@ Setup
<option value='true'>Enable advanced analytics</option>
</select>
<p>
MaxMind GeoIP License Key (required for advanced analytics only):
</p>
<p>
<input type='text' class='form-control' name='maxmind:license_key' value=''>
<p class='text-muted'>
To obtain a free MaxMind GeoIP license key, follow <a href="https://docs.polrproject.org/en/latest/user-guide/maxmind-license">these instructions</a> on Polr's documentation website.
</p>
<p>Shortening Permissions:</p>
<select name='setting:shorten_permission' class='form-control'>
<option value='false' selected='selected'>Anyone can shorten URLs</option>