Skip to content

Commit 6148b19

Browse files
feat(blaas): Add subscribe button (#167)
* feat(settings): Add intro before settings * feat(metrics): Rename usage metrics into remediation metrics * chore(*): Prepare release 2.11.0 * test(e2e): Fix missing remediation metrics replacement * feat(blaas): Update blaas intro * docs(user guide): Fix typos * docs(*): Update WordPress redame.txt
1 parent 859898f commit 6148b19

File tree

15 files changed

+158
-69
lines changed

15 files changed

+158
-69
lines changed

.wordpress-org/screenshot-11.png

63.8 KB
Loading

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
---
8+
9+
## [2.11.0](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.11.0) - 2025-06-02
10+
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.10.0...v2.11.0)
11+
12+
13+
### Added
14+
15+
- Add Blocklist as a Service (BLaaS) subscription button
16+
17+
718
---
819

920
## [2.10.0](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.10.0) - 2025-05-09
@@ -312,7 +323,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
312323
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v1.11.0...v2.0.0)
313324

314325
### Changed
315-
- All source code has been refactored using new CrowdSec PHP librairies:
326+
- All source code has been refactored using new CrowdSec PHP libraries:
316327
- Logs messages have been changed
317328
- User Agent sent to CrowdSec LAPI has been changed to `csphplapi_WordPress/vX.Y.Z`
318329

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
4+
5+
- [CrowdSec WordPress Bouncer](#crowdsec-wordpress-bouncer)
6+
- [Usage](#usage)
7+
- [Installation](#installation)
8+
- [Technical notes](#technical-notes)
9+
- [Developer guide](#developer-guide)
10+
- [License](#license)
11+
12+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
13+
114
# CrowdSec WordPress Bouncer
215

316
![CrowdSec WordPress Bouncer](https://raw.githubusercontent.com/crowdsecurity/cs-wordpress-bouncer/main/.wordpress-org/banner-1544x500.png "CrowdSec WordPress Bouncer")

crowdsec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://github.com/crowdsecurity/cs-wordpress-bouncer
55
* Description: Safer Together. Protect your WordPress application with CrowdSec.
66
* Tags: security, captcha, ip-blocker, crowdsec, hacker-protection, appsec
7-
* Version: 2.10.0
7+
* Version: 2.11.0
88
* Author: CrowdSec
99
* Author URI: https://www.crowdsec.net/
1010
* Github: https://github.com/crowdsecurity/cs-wordpress-bouncer
@@ -13,7 +13,7 @@
1313
* Requires PHP: 7.2
1414
* Requires at least: 4.9
1515
* Tested up to: 6.8
16-
* Stable tag: 2.10.0
16+
* Stable tag: 2.11.0
1717
* Text Domain: crowdsec-wp
1818
* First release: 2021.
1919
*/

docs/USER_GUIDE.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- [Usage](#usage)
1313
- [Features](#features)
1414
- [Apply a remediation: captcha or ban](#apply-a-remediation-captcha-or-ban)
15-
- [Usage metrics](#usage-metrics)
15+
- [Remediation metrics](#remediation-metrics)
1616
- [Understanding the limitations of the bouncer](#understanding-the-limitations-of-the-bouncer)
1717
- [Configurations](#configurations)
1818
- [General settings](#general-settings)
@@ -71,9 +71,9 @@ Please note that it is possible to customize all the colors of these pages in a
7171

7272
On the other hand, all texts are also fully customizable. This will allow you, for example, to present translated pages in your users’ language.
7373

74-
#### Usage metrics
74+
#### Remediation metrics
7575

76-
If you activate usage metrics push, the bouncer will provide usage data to the Local API, allowing for a unified view of its behavior and insights.
76+
If you activate remediation metrics push, the bouncer will provide usage data to the Local API, allowing for a unified view of its behavior and insights.
7777

7878
Please see [below setting](#advanced-settings) and [CrowdSec documentation](https://doc.crowdsec.net/docs/next/observability/usage_metrics/) for more information.
7979

@@ -140,8 +140,8 @@ If you are using a Block as a Service (BLaaS) LAPI URL (i.e. starting with `http
140140
note the following:
141141

142142
- The Authentication type must be "Bouncer API key"
143-
- Stream mode must be enabled (see Communication mode with the Local API in Advanced Settings)
144-
- Usage Metrics cannot be sent (see Usage Metrics in [Advanced settings](#advanced-settings)).
143+
- Stream mode must be enabled (see Communication mode with the Local API in [Advanced settings](#advanced-settings)).
144+
- Remediation Metrics cannot be sent (see Remediation Metrics in [Advanced settings](#advanced-settings)).
145145
- AppSec component cannot be used (see Appsec Component in [Advanced settings](#advanced-settings))
146146

147147
***
@@ -272,7 +272,7 @@ In the `Theme customization` part, you can modify texts and colors of ban and ca
272272

273273
#### Advanced settings
274274

275-
In the `Advanced` part, you can enable/disable the stream mode, enable/disable usage metrics, choose your cache system for your CrowdSec Local API, handle your remediation policy, manage geolocation feature, adjust some debug parameters and testing parameters.
275+
In the `Advanced` part, you can enable/disable the stream mode, enable/disable remediation metrics, choose your cache system for your CrowdSec Local API, handle your remediation policy, manage geolocation feature, adjust some debug parameters and testing parameters.
276276

277277
![Communication mode](images/screenshots/config-communication-mode.png)
278278

@@ -298,17 +298,17 @@ With the stream mode, every decision is retrieved in an asynchronous way. Here y
298298

299299
***
300300

301-
![Usage Metrics](images/screenshots/config-usage-metrics.png)
301+
![Remediation Metrics](images/screenshots/config-usage-metrics.png)
302302

303303
***
304304

305-
`Usage Metrics → Enable the Usage Metrics`
305+
`Remediation Metrics → Enable the Remediation Metrics`
306306

307-
Enable usage metrics to gain visibility: monitor incoming traffic and blocked threats for better security insights.
307+
Enable remediation metrics to gain visibility: monitor incoming traffic and blocked threats for better security insights.
308308

309-
If this option is enabled, a cron job will push usage metrics to the Local API every 15 minutes.
309+
If this option is enabled, a cron job will push remediation metrics to the Local API every 15 minutes.
310310

311-
**N.B** : There is also a push button if you want to push usage metrics manually.
311+
**N.B** : There is also a push button if you want to push remediation metrics manually.
312312

313313
***
314314

@@ -322,23 +322,23 @@ Choose the cache technology that will use your CrowdSec Local API.
322322

323323
The File system cache is faster than calling Local API. Redis or Memcached is faster than the File System cache.
324324

325-
**N.B**. : There are also a `Clear now` button fo all cache technologies and a `Prune now` button dedicated to the file system cache.
325+
**N.B**. : There are also a `Clear now` button for all cache technologies and a `Prune now` button dedicated to the file system cache.
326326

327327
***
328328

329329
`Caching configuration → Recheck clean IPs each (live mode only)`
330330

331331
The duration between re-asking Local API about an already checked clean IP.
332332

333-
Minimum 1 second. Note that this setting can not be apply in stream mode.
333+
Minimum 1 second. Note that this setting cannot be used in stream mode.
334334

335335
***
336336

337337
`Caching configuration → Recheck bad IPs each (live mode only)`
338338

339339
The duration between re-asking Local API about an already checked bad IP.
340340

341-
Minimum 1 second. Note that this setting can not be apply in stream mode.
341+
Minimum 1 second. Note that this setting cannot be used in stream mode.
342342

343343

344344
***
@@ -378,7 +378,7 @@ Example of DSN: memcached://localhost:11211.
378378

379379
Enable if you want to ask the AppSec component for a remediation based on the current request, in case the initial LAPI remediation is a bypass.
380380

381-
Not available if you use TLS certficates as authentication type.
381+
Not available if you use TLS certificates as authentication type.
382382

383383
For more information on the AppSec component, please refer to the [documentation](https://docs.crowdsec.net/docs/appsec/intro/).
384384

-154 Bytes
Loading

inc/Admin/advanced-settings.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,16 @@ function crowdsec_multi_save_advanced_settings()
157157
** Section "Usage Metrics" **
158158
**************************/
159159
$isUsageMetricsEnabled = is_multisite() ? get_site_option('crowdsec_usage_metrics') : get_option('crowdsec_usage_metrics');
160-
add_settings_section('crowdsec_admin_advanced_usage_metrics', 'Usage Metrics', function () {
160+
add_settings_section('crowdsec_admin_advanced_usage_metrics', 'Remediation Metrics', function () {
161161
}, 'crowdsec_advanced_settings',['after_section' => '<hr>']);
162162

163163
// Field "crowdsec_usage_metrics"
164-
addFieldCheckbox('crowdsec_usage_metrics', 'Enable Usage Metrics', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_usage_metrics', function () {
164+
addFieldCheckbox('crowdsec_usage_metrics', 'Enable Remediation Metrics', 'crowdsec_plugin_advanced_settings', 'crowdsec_advanced_settings', 'crowdsec_admin_advanced_usage_metrics', function () {
165165
// Usage metrics push just activated.
166166
$lapiUrl = is_multisite() ? get_site_option('crowdsec_api_url') : get_option('crowdsec_api_url');
167167
if (0 === strpos($lapiUrl, Constants::BAAS_URL)) {
168-
AdminNotice::displayError('Pushing usage metrics with a Block as a Service LAPI ('.esc_html($lapiUrl).') is not supported. ');
168+
AdminNotice::displayError('Pushing remediation metrics with a Block as a Service LAPI ('.esc_html
169+
($lapiUrl).') is not supported. ');
169170
return false;
170171
}
171172
scheduleUsageMetricsPush();
@@ -175,9 +176,9 @@ function crowdsec_multi_save_advanced_settings()
175176
unscheduleUsageMetricsPush();
176177
return false;
177178
}, '
178-
<p>Enable usage metrics to gain visibility: monitor incoming traffic and blocked threats for better security insights.</p>
179-
<p>If this option is enabled, a cron job will push usage metrics to the Local API every 15 minutes.</p>
180-
<p>For more information about usage metrics, please refer to the <a href="https://doc.crowdsec.net/docs/next/observability/usage_metrics/" target="_blank">documentation</a>.</p>
179+
<p>Enable remediation metrics to gain visibility: monitor incoming traffic and blocked threats for better security insights.</p>
180+
<p>If this option is enabled, a cron job will push remediation metrics to the Local API every 15 minutes.</p>
181+
<p>For more information about remediation metrics, please refer to the <a href="https://doc.crowdsec.net/docs/next/observability/usage_metrics/" target="_blank">documentation</a>.</p>
181182
<div id="usage-metrics-report">
182183
<p>'.displayBouncerMetricsInAdminPage().'</p>
183184
</div>

inc/Admin/init.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function clearBouncerCacheInAdminPage()
3232
{
3333
try {
3434
$configs = getDatabaseConfigs();
35-
// If usage metrics are enabled, we need to push them before clearing the cache.
35+
// If remediation metrics are enabled, we need to push them before clearing the cache.
3636
$isUsageMetricsEnabled = is_multisite() ? get_site_option('crowdsec_usage_metrics') : get_option('crowdsec_usage_metrics');
3737
$bouncer = new Bouncer($configs);
3838
if ($isUsageMetricsEnabled) {
@@ -42,7 +42,7 @@ function clearBouncerCacheInAdminPage()
4242
$bouncer->clearCache();
4343
$message = __('CrowdSec cache has just been cleared.');
4444
if ($isUsageMetricsEnabled){
45-
$message .= __('<br>As usage metrics push is enabled, metrics have been pushed before clearing the cache.');
45+
$message .= __('<br>As remediation metrics push is enabled, metrics have been pushed before clearing the cache.');
4646
}
4747
// In stream mode, immediately warm the cache up.
4848
$streamMode = is_multisite() ? get_site_option('crowdsec_stream_mode') : get_option('crowdsec_stream_mode');
@@ -106,7 +106,7 @@ function pushBouncerMetricsInAdminPage()
106106
$configs = getDatabaseConfigs();
107107
$bouncer = new Bouncer($configs);
108108
$bouncer->pushUsageMetrics(Constants::BOUNCER_NAME, Constants::VERSION);
109-
AdminNotice::displaySuccess(__('CrowdSec usage metrics have just been pushed.'));
109+
AdminNotice::displaySuccess(__('CrowdSec remediation metrics have just been pushed.'));
110110
} catch (Exception $e) {
111111
if(isset($bouncer) && $bouncer->getLogger()) {
112112
$bouncer->getLogger()->error('', [
@@ -117,7 +117,7 @@ function pushBouncerMetricsInAdminPage()
117117
'line' => $e->getLine(),
118118
]);
119119
}
120-
AdminNotice::displayError('Technical error while pushing usage metrics: '.$e->getMessage());
120+
AdminNotice::displayError('Technical error while pushing remediation metrics: '.$e->getMessage());
121121
}
122122
}
123123

@@ -127,7 +127,7 @@ function resetBouncerMetricsInAdminPage()
127127
$configs = getDatabaseConfigs();
128128
$bouncer = new Bouncer($configs);
129129
$bouncer->resetUsageMetrics();
130-
AdminNotice::displaySuccess(__('CrowdSec usage metrics have been reset successfully.'));
130+
AdminNotice::displaySuccess(__('CrowdSec remediation metrics have been reset successfully.'));
131131
} catch (Exception $e) {
132132
if(isset($bouncer) && $bouncer->getLogger()) {
133133
$bouncer->getLogger()->error('', [
@@ -138,7 +138,7 @@ function resetBouncerMetricsInAdminPage()
138138
'line' => $e->getLine(),
139139
]);
140140
}
141-
AdminNotice::displayError('Technical error while resetting usage metrics: '.$e->getMessage());
141+
AdminNotice::displayError('Technical error while resetting remediation metrics: '.$e->getMessage());
142142
}
143143
}
144144

@@ -258,7 +258,7 @@ function displayBouncerMetricsInAdminPage()
258258
]);
259259
}
260260

261-
AdminNotice::displayError('Technical error while displaying usage metrics: ' . esc_html($e->getMessage()));
261+
AdminNotice::displayError('Technical error while displaying remediation metrics: ' . esc_html($e->getMessage()));
262262
return '';
263263
}
264264
}
@@ -270,7 +270,7 @@ function displayResetMetricsInAdminPage()
270270
$configs = getDatabaseConfigs();
271271
$bouncer = new Bouncer($configs);
272272
if ($bouncer->hasBaasUri()) {
273-
return '<p><input id="crowdsec_reset_usage_metrics" style="margin-right:10px" type="button" value="Reset usage metrics now" class="button button-secondary button-small" onclick="document.getElementById(\'crowdsec_action_reset_usage_metrics\').submit();"></p>';
273+
return '<p><input id="crowdsec_reset_usage_metrics" style="margin-right:10px" type="button" value="Reset remediation metrics now" class="button button-secondary button-small" onclick="document.getElementById(\'crowdsec_action_reset_usage_metrics\').submit();"></p>';
274274
}
275275

276276
return '';
@@ -301,9 +301,9 @@ function displayPushMetricsInAdminPage($isPushEnabled = false)
301301
return '';
302302
}
303303
if( $isPushEnabled) {
304-
return '<p><input id="crowdsec_push_usage_metrics" style="margin-right:10px" type="button" value="Push usage metrics now" class="button button-secondary button-small" onclick="document.getElementById(\'crowdsec_action_push_usage_metrics\').submit();"></p>';
304+
return '<p><input id="crowdsec_push_usage_metrics" style="margin-right:10px" type="button" value="Push remediation metrics now" class="button button-secondary button-small" onclick="document.getElementById(\'crowdsec_action_push_usage_metrics\').submit();"></p>';
305305
}
306-
return '<p><input id="crowdsec_push_usage_metrics" style="margin-right:10px" type="button" disabled="disabled" value="Push usage metrics now" class="button button-secondary button-small"></p>';
306+
return '<p><input id="crowdsec_push_usage_metrics" style="margin-right:10px" type="button" disabled="disabled" value="Push remediation metrics now" class="button button-secondary button-small"></p>';
307307

308308
}
309309
catch (Exception $e) {

inc/Admin/settings.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,22 @@ function crowdsec_multi_save_settings()
5959
** Section "Connection details" **
6060
*********************************/
6161

62+
function getIntro()
63+
{
64+
65+
$intro ='<p>The <b>Instant WordPress Blocklist</b> is an exclusive feature available through the CrowdSec plugin. <br>
66+
<p class="submit blaas-button"><a class="button button-primary crowdsec-button" href="https://buy.stripe.com/00g3cIcu59JVfewaES"
67+
target="_blank">Subscribe now</a></p>for only $5/month, proactively block thousands of attackers\' IPs currently targeting WordPress sites.
68+
</p>'
69+
. '<p><i>Instructions are available in the <a target="_blank" href="https://doc.crowdsec.net/u/bouncers/wordpress#instant-wordpress-blocklist">public documentation</a></i></p>'
70+
;
71+
72+
return $intro;
73+
}
74+
6275
add_settings_section('crowdsec_admin_connection', 'Connection details', function () {
6376
echo 'Connect WordPress to your CrowdSec Local API.';
64-
}, 'crowdsec_settings', ['after_section' => '<hr>']);
77+
}, 'crowdsec_settings', ['after_section' => '<hr>', 'before_section' => getIntro()]);
6578

6679
// Field "crowdsec_api_url"
6780
addFieldString('crowdsec_api_url', 'Local API URL', 'crowdsec_plugin_settings', 'crowdsec_settings', 'crowdsec_admin_connection', function ($input, $default ='') {

inc/Constants.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use CrowdSecBouncer\Constants as LibConstants;
88

99
/**
10-
* Every constant of the plugin are set here.
10+
* All plugin constants are defined here.
1111
*
1212
* @author CrowdSec team
1313
*
@@ -21,5 +21,5 @@ class Constants extends LibConstants
2121
public const BOUNCER_NAME = 'wordpress-bouncer';
2222
public const DEFAULT_BASE_FILE_PATH = __DIR__ . '/../../../../wp-content/uploads/crowdsec/';
2323
public const STANDALONE_CONFIG_PATH = __DIR__ . '/standalone-settings.php';
24-
public const VERSION = 'v2.10.0';
24+
public const VERSION = 'v2.11.0';
2525
}

0 commit comments

Comments
 (0)