Skip to content

Commit 5184aec

Browse files
Merge pull request #109 from julienloizelet/fix/default-settings
Fix/default settings
2 parents fe04118 + 77e7717 commit 5184aec

File tree

6 files changed

+15
-10
lines changed

6 files changed

+15
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77

8+
## [1.8.1] - 2022-08-18
9+
10+
### Fixed
11+
- Set missing default values in settings
12+
813
## [1.8.0] - 2022-08-04
914

1015
### Added

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: crowdsec-bouncer, wordpress, security, firewall, captcha, ip-scanner, ip-blocker, ip-blocking, ip-address, ip-database, ip-range-check, crowdsec, ban-hosts, ban-management, anti-hacking, hacker-protection, captcha-image, captcha-generator, captcha-generation, captcha-service
7-
* Version: 1.8.0
7+
* Version: 1.8.1
88
* Author: CrowdSec
99
* Author URI: https://www.crowdsec.net/
1010
* Github: https://github.com/crowdsecurity/cs-wordpress-blocker
@@ -13,7 +13,7 @@
1313
* Requires PHP: 7.2
1414
* Requires at least: 4.9
1515
* Tested up to: 6.0
16-
* Stable tag: 1.8.0
16+
* Stable tag: 1.8.1
1717
* Text Domain: crowdsec-wp
1818
* First release: 2021.
1919
*/

inc/Bounce.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public function getBouncerInstance(array $settings): Bouncer
5656
'forced_test_forwarded_ip' => $this->getStringSettings('crowdsec_forced_test_forwarded_ip'),
5757
'display_errors' => $this->getBoolSettings('crowdsec_display_errors'),
5858
// Bouncer
59-
'bouncing_level' => $this->getStringSettings('crowdsec_bouncing_level'),
59+
'bouncing_level' => $this->getStringSettings('crowdsec_bouncing_level')?:Constants::BOUNCING_LEVEL_DISABLED,
6060
'trust_ip_forward_array' => $this->getArraySettings('crowdsec_trust_ip_forward_array'),
6161
'fallback_remediation' => $this->getStringSettings('crowdsec_fallback_remediation'),
6262
// Cache settings
6363
'stream_mode' => $this->getBoolSettings('crowdsec_stream_mode'),
64-
'cache_system' => $this->escape($this->getStringSettings('crowdsec_cache_system')),
64+
'cache_system' => $this->escape($this->getStringSettings('crowdsec_cache_system'))?:Constants::CACHE_SYSTEM_PHPFS,
6565
'fs_cache_path' => Constants::CROWDSEC_CACHE_PATH,
6666
'redis_dsn' => $this->escape($this->getStringSettings('crowdsec_redis_dsn')),
6767
'memcached_dsn' => $this->escape($this->getStringSettings('crowdsec_memcached_dsn')),

inc/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Constants extends LibConstants
2222
public const CROWDSEC_DEBUG_LOG_PATH = __DIR__ . '/../logs/debug.log';
2323
public const CROWDSEC_CACHE_PATH = __DIR__ . '/../.cache';
2424
public const CROWDSEC_CONFIG_PATH = __DIR__ . '/standalone-settings.php';
25-
public const CROWDSEC_BOUNCER_USER_AGENT = 'WordPress CrowdSec Bouncer/v1.8.0';
25+
public const CROWDSEC_BOUNCER_USER_AGENT = 'WordPress CrowdSec Bouncer/v1.8.1';
2626
public const CROWDSEC_BOUNCER_GEOLOCATION_DIR = __DIR__ . '/../geolocation';
2727

2828
}

inc/bouncer-instance.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ function getDatabaseSettings(): array
3333
'forced_test_forwarded_ip' => esc_attr(get_option('crowdsec_forced_test_forwarded_ip')),
3434
'display_errors' => !empty(get_option('crowdsec_display_errors')),
3535
// Bouncer
36-
'bouncing_level' => esc_attr(get_option('crowdsec_bouncing_level')),
36+
'bouncing_level' => esc_attr(get_option('crowdsec_bouncing_level'))?:Constants::BOUNCING_LEVEL_DISABLED,
3737
'trust_ip_forward_array' => get_option('crowdsec_trust_ip_forward_array'),
3838
'fallback_remediation' => esc_attr(get_option('crowdsec_fallback_remediation')),
3939
// Cache settings
4040
'stream_mode' => !empty(get_option('crowdsec_stream_mode')),
41-
'cache_system' => esc_attr(get_option('crowdsec_cache_system')),
41+
'cache_system' => esc_attr(get_option('crowdsec_cache_system'))?:Constants::CACHE_SYSTEM_PHPFS,
4242
'fs_cache_path' => Constants::CROWDSEC_CACHE_PATH,
4343
'redis_dsn' => esc_attr(get_option('crowdsec_redis_dsn')),
4444
'memcached_dsn' => esc_attr(get_option('crowdsec_memcached_dsn')),
@@ -53,10 +53,10 @@ function getDatabaseSettings(): array
5353
// Geolocation
5454
'geolocation' => [
5555
'enabled' => !empty(get_option('crowdsec_geolocation_enabled')),
56-
'type' => esc_attr(get_option('crowdsec_geolocation_type')),
56+
'type' => esc_attr(get_option('crowdsec_geolocation_type')) ?: Constants::GEOLOCATION_TYPE_MAXMIND,
5757
'save_result' => !empty(get_option('crowdsec_geolocation_save_result')),
5858
'maxmind' => [
59-
'database_type' => esc_attr(get_option('crowdsec_geolocation_maxmind_database_type')),
59+
'database_type' => esc_attr(get_option('crowdsec_geolocation_maxmind_database_type')) ?: Constants::MAXMIND_COUNTRY,
6060
'database_path' => Constants::CROWDSEC_BOUNCER_GEOLOCATION_DIR. '/'.ltrim(esc_attr(get_option('crowdsec_geolocation_maxmind_database_path')), '/'),
6161
]
6262
]

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://crowdsec.net/
44
Tags: crowdsec-bouncer, wordpress, security, firewall, captcha, ip-scanner, ip-blocker, ip-blocking, ip-address, ip-database, ip-range-check, crowdsec, ban-hosts, ban-management, anti-hacking, hacker-protection, captcha-image, captcha-generator, captcha-generation, captcha-service
55
Requires at least: 4.9
66
Tested up to: 6.0
7-
Stable tag: 1.8.0
7+
Stable tag: 1.8.1
88
Requires PHP: 7.2
99
License: MIT
1010
License URI: https://opensource.org/licenses/MIT

0 commit comments

Comments
 (0)