Download the PHP package tourze/symfony-scan-detect-bundle without Composer
On this page you can find all versions of the php package tourze/symfony-scan-detect-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tourze/symfony-scan-detect-bundle
More information about tourze/symfony-scan-detect-bundle
Files in tourze/symfony-scan-detect-bundle
Package symfony-scan-detect-bundle
Short Description Symfony bundle for detecting and preventing malicious scan attempts and 404 attacks using PSR-16 SimpleCache
License MIT
Informations about the package symfony-scan-detect-bundle
Symfony Scan Detect Bundle
中文
A Symfony bundle that provides protection against malicious scanning and brute force attacks by detecting and blocking IPs that generate excessive 404 errors.
Features
- Automated IP blocking: Automatically blocks IPs that generate excessive 404 errors
- Configurable thresholds: Set custom limits for error count and block duration
- Safe IP whitelist: Protects local IPs (127.0.0.1, ::1) from being blocked
- Cache-based storage: Uses PSR-16 SimpleCache for efficient tracking
- Event-driven architecture: Integrates seamlessly with Symfony's event system
Installation
Quick Start
-
Add the bundle to your
config/bundles.php: -
Configure the bundle by setting environment variables:
- The bundle will automatically start protecting your application from scanning attacks.
Configuration
The bundle uses environment variables for configuration:
SCAN_DETECT_404_FOUND_TIME: Maximum number of 404 errors allowed per IP within 1 minute (default: 20)
How it works
- Request Monitoring: The bundle monitors all incoming requests
- 404 Error Tracking: When a 404 error occurs, it's recorded for the client IP
- Threshold Detection: If an IP exceeds the configured error threshold within 1 minute, it's marked as suspicious
- Automatic Blocking: Suspicious IPs are blocked for 5 minutes with a 403 response
- Safe IP Protection: Local IPs (127.0.0.1, ::1) are never blocked
Example Usage
Console Commands
scan-detect:cleanup
Provides cache management functionality for scan detection. In the Cache-based architecture, blocking and counting data automatically expire (blocking for 5 minutes, counting for 1 minute), so manual cleanup is usually not required.
Command Features:
- Shows current cache architecture status
- Provides manual cache cleanup options (though usually unnecessary)
- Displays optimization benefits of the cache-based approach
Example Output:
Testing
Run the test suite:
License
This bundle is released under the MIT license. See the LICENSE file for details.
All versions of symfony-scan-detect-bundle with dependencies
symfony/cache Version ^7.3
symfony/config Version ^7.3
symfony/console Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/framework-bundle Version ^7.4
symfony/http-foundation Version ^7.4
symfony/http-kernel Version ^7.3
symfony/property-access Version ^7.3
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*