Skip to content

Commit

Permalink
Merge pull request #109 from julienloizelet/fix/default-settings
Browse files Browse the repository at this point in the history
Fix/default settings
  • Loading branch information
julienloizelet authored Aug 18, 2022
2 parents fe04118 + 77e7717 commit 5184aec
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [1.8.1] - 2022-08-18

### Fixed
- Set missing default values in settings

## [1.8.0] - 2022-08-04

### Added
Expand Down
4 changes: 2 additions & 2 deletions crowdsec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/crowdsecurity/cs-wordpress-bouncer
* Description: Safer Together. Protect your WordPress application with CrowdSec.
* 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
* Version: 1.8.0
* Version: 1.8.1
* Author: CrowdSec
* Author URI: https://www.crowdsec.net/
* Github: https://github.com/crowdsecurity/cs-wordpress-blocker
Expand All @@ -13,7 +13,7 @@
* Requires PHP: 7.2
* Requires at least: 4.9
* Tested up to: 6.0
* Stable tag: 1.8.0
* Stable tag: 1.8.1
* Text Domain: crowdsec-wp
* First release: 2021.
*/
Expand Down
4 changes: 2 additions & 2 deletions inc/Bounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public function getBouncerInstance(array $settings): Bouncer
'forced_test_forwarded_ip' => $this->getStringSettings('crowdsec_forced_test_forwarded_ip'),
'display_errors' => $this->getBoolSettings('crowdsec_display_errors'),
// Bouncer
'bouncing_level' => $this->getStringSettings('crowdsec_bouncing_level'),
'bouncing_level' => $this->getStringSettings('crowdsec_bouncing_level')?:Constants::BOUNCING_LEVEL_DISABLED,
'trust_ip_forward_array' => $this->getArraySettings('crowdsec_trust_ip_forward_array'),
'fallback_remediation' => $this->getStringSettings('crowdsec_fallback_remediation'),
// Cache settings
'stream_mode' => $this->getBoolSettings('crowdsec_stream_mode'),
'cache_system' => $this->escape($this->getStringSettings('crowdsec_cache_system')),
'cache_system' => $this->escape($this->getStringSettings('crowdsec_cache_system'))?:Constants::CACHE_SYSTEM_PHPFS,
'fs_cache_path' => Constants::CROWDSEC_CACHE_PATH,
'redis_dsn' => $this->escape($this->getStringSettings('crowdsec_redis_dsn')),
'memcached_dsn' => $this->escape($this->getStringSettings('crowdsec_memcached_dsn')),
Expand Down
2 changes: 1 addition & 1 deletion inc/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Constants extends LibConstants
public const CROWDSEC_DEBUG_LOG_PATH = __DIR__ . '/../logs/debug.log';
public const CROWDSEC_CACHE_PATH = __DIR__ . '/../.cache';
public const CROWDSEC_CONFIG_PATH = __DIR__ . '/standalone-settings.php';
public const CROWDSEC_BOUNCER_USER_AGENT = 'WordPress CrowdSec Bouncer/v1.8.0';
public const CROWDSEC_BOUNCER_USER_AGENT = 'WordPress CrowdSec Bouncer/v1.8.1';
public const CROWDSEC_BOUNCER_GEOLOCATION_DIR = __DIR__ . '/../geolocation';

}
8 changes: 4 additions & 4 deletions inc/bouncer-instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ function getDatabaseSettings(): array
'forced_test_forwarded_ip' => esc_attr(get_option('crowdsec_forced_test_forwarded_ip')),
'display_errors' => !empty(get_option('crowdsec_display_errors')),
// Bouncer
'bouncing_level' => esc_attr(get_option('crowdsec_bouncing_level')),
'bouncing_level' => esc_attr(get_option('crowdsec_bouncing_level'))?:Constants::BOUNCING_LEVEL_DISABLED,
'trust_ip_forward_array' => get_option('crowdsec_trust_ip_forward_array'),
'fallback_remediation' => esc_attr(get_option('crowdsec_fallback_remediation')),
// Cache settings
'stream_mode' => !empty(get_option('crowdsec_stream_mode')),
'cache_system' => esc_attr(get_option('crowdsec_cache_system')),
'cache_system' => esc_attr(get_option('crowdsec_cache_system'))?:Constants::CACHE_SYSTEM_PHPFS,
'fs_cache_path' => Constants::CROWDSEC_CACHE_PATH,
'redis_dsn' => esc_attr(get_option('crowdsec_redis_dsn')),
'memcached_dsn' => esc_attr(get_option('crowdsec_memcached_dsn')),
Expand All @@ -53,10 +53,10 @@ function getDatabaseSettings(): array
// Geolocation
'geolocation' => [
'enabled' => !empty(get_option('crowdsec_geolocation_enabled')),
'type' => esc_attr(get_option('crowdsec_geolocation_type')),
'type' => esc_attr(get_option('crowdsec_geolocation_type')) ?: Constants::GEOLOCATION_TYPE_MAXMIND,
'save_result' => !empty(get_option('crowdsec_geolocation_save_result')),
'maxmind' => [
'database_type' => esc_attr(get_option('crowdsec_geolocation_maxmind_database_type')),
'database_type' => esc_attr(get_option('crowdsec_geolocation_maxmind_database_type')) ?: Constants::MAXMIND_COUNTRY,
'database_path' => Constants::CROWDSEC_BOUNCER_GEOLOCATION_DIR. '/'.ltrim(esc_attr(get_option('crowdsec_geolocation_maxmind_database_path')), '/'),
]
]
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://crowdsec.net/
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
Requires at least: 4.9
Tested up to: 6.0
Stable tag: 1.8.0
Stable tag: 1.8.1
Requires PHP: 7.2
License: MIT
License URI: https://opensource.org/licenses/MIT
Expand Down

0 comments on commit 5184aec

Please sign in to comment.