You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
}, ' seconds. <p>The lifetime of cached captcha flow for some IP. <br>If a user has to interact with a captcha wall, we store in cache some values in order to know if he has to resolve or not the captcha again.<br>Minimum 1 second. Default: '.Constants::CACHE_EXPIRATION_FOR_CAPTCHA.'.', Constants::CACHE_EXPIRATION_FOR_CAPTCHA, 'width: 115px;', 'number');
198
198
199
+
// Field "crowdsec_geolocation_cache_duration"
200
+
addFieldString('crowdsec_geolocation_cache_duration', 'Geolocation cache duration', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_cache', function ($input) {
}, ' seconds. <p>The lifetime of cached country geolocation result for some IP.<br>Minimum 1 second. Default: '.Constants::CACHE_EXPIRATION_FOR_GEO.'.', Constants::CACHE_EXPIRATION_FOR_GEO, 'width: 115px;', 'number');
209
+
199
210
200
211
/***************************
201
212
** Section "Remediation" **
202
213
**************************/
203
214
204
215
add_settings_section('crowdsec_admin_advanced_remediations', 'Remediations', function () {
205
-
echo'Configuration some details about remediations.';
216
+
echo'Configure some details about remediations.';
206
217
}, 'crowdsec_advanced_settings');
207
218
208
219
// Field "crowdsec_fallback_remediation"
@@ -271,9 +282,51 @@ function convertInlineIpRangesToComparableIpBounds(string $inlineIpRanges): arra
271
282
'<br><strong>Comma (,)</strong> separated ips or ips ranges. Example: 1.2.3.4/24, 2.3.4.5, 3.4.5.6/27.<br><br>Some common CDN IP list: <a href="https://www.cloudflare.com/fr-fr/ips/" target="_blank">Cloudflare</a>, <a href="https://api.fastly.com/public-ip-list" target="_blank">Fastly</a>',
272
283
'fill the IPs or IPs ranges here...', '');
273
284
274
-
// Field "crowdsec_hide_mentions"
275
-
addFieldCheckbox('crowdsec_hide_mentions', 'Hide CrowdSec mentions', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_remediations', function () {}, function () {}, '
276
-
<p>Enable if you want to hide CrowdSec mentions on the Ban and Captcha pages</p>');
285
+
286
+
287
+
/***************************
288
+
** Section "Geolocation" **
289
+
**************************/
290
+
291
+
add_settings_section('crowdsec_admin_advanced_geolocation', 'Geolocation', function () {
'crowdsec_advanced_settings', 'crowdsec_admin_advanced_geolocation', function () {}, function () {}, '
298
+
<p>Enable if you want to use also CrowdSec country scoped decisions.<br>If enabled, bounced IP will be geolocalized and the final remediation will take into account any country related decision.</p>');
addFieldString('crowdsec_geolocation_maxmind_database_path', 'Path to the MaxMind database', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_geolocation', function ($input) {
323
+
return$input;
324
+
}, '<p>Relative path from <i>wp-content/plugins/cs-wordpress-bouncer/geolocation</i> folder</p>', 'GeoLite2-Country.mmdb', '');
325
+
326
+
addFieldCheckbox('crowdsec_geolocation_save_result', 'Save geolocalized country in cache', 'crowdsec_plugin_advanced_settings',
327
+
'crowdsec_advanced_settings', 'crowdsec_admin_advanced_geolocation', function () {}, function () {}, '
328
+
<p>Enabling this will avoid multiple call to the geolocation system (e.g. MaxMind database)</p> If enabled, the geolocalized country associated to the IP will be saved in cache.<br>See the <i>Geolocation cache duration</i> setting above to set the lifetime of this result.');
329
+
277
330
278
331
/*******************************
279
332
** Section "Debug mode" **
@@ -298,4 +351,25 @@ function convertInlineIpRangesToComparableIpBounds(string $inlineIpRanges): arra
298
351
// Field "crowdsec_display_errors"
299
352
addFieldCheckbox('crowdsec_display_errors', 'Enable errors display', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_display_errors', function () {}, function () {}, '
300
353
<p>Do not use in production. When this mode is enabled, you will see every unexpected bouncing errors in the browser.</p>');
354
+
355
+
/*******************************
356
+
** Section "Test mode" **
357
+
******************************/
358
+
359
+
add_settings_section('crowdsec_admin_advanced_test', 'Test settings', function () {
360
+
echo'Configure some test parameters.';
361
+
}, 'crowdsec_advanced_settings');
362
+
363
+
// Field "test ip"
364
+
addFieldString('crowdsec_forced_test_ip', 'Forced test IP', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_test', function ($input) {
365
+
return$input;
366
+
}, '<p>This Ip will be used instead of the current detected browser IP: '.$_SERVER['REMOTE_ADDR'].'.<br><strong>Must be empty in production.</strong></p>',
367
+
'1.2.3.4', '');
368
+
369
+
addFieldString('crowdsec_forced_test_forwarded_ip', 'Forced test X-Forwrded-For IP', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_test', function ($input) {
370
+
return$input;
371
+
}, '<p>This Ip will be used instead of the current X-Forwarded-For Ip if any.<br><strong>Must be empty in production.</strong></p>',
0 commit comments