v2.7.0
Added
New Plugin Configuration Format (#48)
Introduced a new canonical plugins: array format as the preferred way to configure firewall plugins. This format provides explicit control over plugin behavior and supports multiple instances of the same plugin class.
New Format:
plugins:
- plugin: "Kanopi\\Firewall\\Plugins\\IpAddress"
response: allow # 'allow' (bypass) or 'block'
weight: -200 # Execution order (lower runs first)
enable: true
config:
- 127.0.0.1
- plugin: "Kanopi\\Firewall\\Plugins\\IpAddress"
response: block
weight: -100
enable: true
config:
- 192.168.1.100Key Features:
- Same plugin class can be used multiple times with different configurations
- Explicit
responsefield (alloworblock) indicates plugin behavior weightfield controls execution order (replacespriorityin legacy format)plugins:arrays from multiple config files are appended (not replaced) during merging- Full backward compatibility with legacy
bypass:/block:format
New Components:
PluginConfigNormalizer- Converts legacy format to canonical formatPluginManager::createFromPluginsArray()- Factory method for new format
Field Mapping (Legacy → New):
| Legacy | New Format |
|---|---|
bypass: section |
response: allow |
block: section |
response: block |
priority |
weight |
Firewall Mode Configuration (#43)
Added a new mode setting in global configuration to control firewall behavior:
global:
mode: block # Options: block, log, exception, disabled| Mode | Evaluates? | Writes Storage? | Terminates? |
|---|---|---|---|
block |
Yes | Yes | Yes (sends HTTP response) |
log |
Yes | No | No (logs warning only) |
exception |
Yes | Yes | No (throws FirewallBlockedException) |
disabled |
No | No | No (skips all evaluation) |
block- Default production behaviorlog- Dry-run/audit mode for testing rules without blockingexception- Throws catchable exception for framework integrationdisabled- Completely bypasses firewall evaluation
Extended Logging (#42)
Enhanced logging throughout the firewall with more detailed context:
- Plugin evaluation results with timing information
- Storage operations (block, unblock, offense tracking)
- Configuration loading and merging details
- Request evaluation flow with decision points
- Debug-level logs for troubleshooting
PHP 8.5 Testing Support (#47)
Added PHP 8.5 to the CI test matrix to ensure forward compatibility.
Changed
Exception Handling Updates (#46)
Updated exception handling to work with new GeoIP2 library exceptions:
- Properly catches and handles
AddressNotFoundException - Improved error messages for GeoIP lookup failures
- Better fallback behavior when IP cannot be geolocated
Fixed
- Fixed exception types for GeoIP2 library compatibility
- Improved error handling in GeoLocation and ASN plugins
Documentation
- Comprehensive README updates documenting new
plugins:format - Updated CLAUDE.md with new architecture details
- New examples in
example/config.ymlshowing both formats - Updated
example/README.mdwith new format examples
[2.6.0] - 2024-12-XX
Added
- New
{presets_dir}token for referencing built-in preset configurations Path::getPresetsDirectory()method for centralized preset path access- Centralized token normalization in
TokenSubstitute::normalizeInclude()
Changed
- Consolidated token substitution logic for better maintainability
- Removed duplicate normalization code from ConfigLoader
[2.5.0] - 2024-XX-XX
Added
- Remote configuration file support with local caching
KANOPI_FIREWALL_CACHE_DIR,KANOPI_FIREWALL_CACHE_TTL,KANOPI_FIREWALL_CACHE_TIMEOUTconstants$_SERVERfallback for environment variable resolution
Changed
- Environment variables now check both
getenv()and$_SERVER
Upgrade Guide: 2.6.x → 2.7.0
Plugin Configuration
The new plugins: array format is optional but recommended. Your existing bypass: and block: configurations will continue to work without modification.
To migrate to the new format:
- Replace
bypass:section entries withresponse: allowplugins - Replace
block:section entries withresponse: blockplugins - Rename
prioritytoweight - Add explicit
plugin:key with the class name
Before (Legacy):
bypass:
"Kanopi\\Firewall\\Plugins\\IpAddress":
priority: -200
enable: true
config:
- 127.0.0.1
block:
"Kanopi\\Firewall\\Plugins\\IpAddress":
priority: -100
enable: true
config:
- 192.168.1.100After (New):
plugins:
- plugin: "Kanopi\\Firewall\\Plugins\\IpAddress"
response: allow
weight: -200
enable: true
config:
- 127.0.0.1
- plugin: "Kanopi\\Firewall\\Plugins\\IpAddress"
response: block
weight: -100
enable: true
config:
- 192.168.1.100Firewall Mode
If you were using custom logic to control firewall behavior, consider using the new mode setting:
global:
mode: log # For dry-run testingBreaking Changes
None. This release maintains full backward compatibility.
Full Changelog: v2.6.0...v2.7.0