Download the PHP package justinholtweb/craft-garrison without Composer
On this page you can find all versions of the php package justinholtweb/craft-garrison. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download justinholtweb/craft-garrison
More information about justinholtweb/craft-garrison
Files in justinholtweb/craft-garrison
Package craft-garrison
Short Description Comprehensive security suite for Craft CMS — scanning, active protection, audit logging, and notifications.
License proprietary
Informations about the package craft-garrison
Garrison — Security Suite for Craft CMS
Comprehensive security plugin for Craft CMS 5. Vulnerability scanning, active request protection, audit logging, file integrity monitoring, and multi-channel notifications in a single install.
Editions
| Feature | Free | Pro |
|---|---|---|
| Security scanner (14 checks) | ✓ | ✓ |
| Remediation guidance per check | ✓ | ✓ |
| Login brute-force protection & lockout | ✓ | ✓ |
| Audit logging | 30 days | 365 days |
| Console commands | ✓ | ✓ |
| Scan history | Last 10 | Unlimited |
| Multi-site scans | ✓ | ✓ |
| Scheduled scans (queue-based) | — | ✓ |
| Email / Slack / Discord / webhook alerts | — | ✓ |
| IP allow/block rules (CP + frontend, CIDR) | — | ✓ |
| Rate limiting | — | ✓ |
| File integrity monitoring | — | ✓ |
| REST API (authenticated) | — | ✓ |
| WAF / request filtering | — | ✓ |
| Geo-blocking | — | ✓ |
| Dashboard threat analytics | — | ✓ |
Requirements
- Craft CMS 5.0.0 or later
- PHP 8.2 or later
Installation
Open your terminal and run:
Or install from the Craft Plugin Store in your control panel.
Configuration
Copy the default config to your project:
Multi-environment config is supported. Key settings:
Modules
Scanner
Runs 14 security checks against your site and produces a risk score (0–100). Every check returns plain-language remediation guidance:
- CMS Configuration — dev mode, admin changes, test email, elevated session duration, wildcard GraphQL origins
- HTTPS — verifies the site is served over TLS
- CSRF Protection — confirms CSRF tokens are enabled
- File Permissions — checks
.env,config/,web/index.phpfor unsafe permissions - PHP Version — flags EOL or soon-to-expire PHP versions
- Application Security Key — confirms a strong
securityKeyis set - Cookie Security —
useSecureCookiesandsameSiteCookieValuepolicy - Upload Sanitization —
sanitizeSvgUploadsandsanitizeCpImageUploads - Web Root Exposure — sensitive files (
.env, composer manifests,.git) under the public root - Software Updates — pending Craft / plugin updates (uses cached update info)
- GraphQL Introspection — flags introspection left on in production
- X-Powered-By Header — flags the
sendPoweredByHeaderinformation disclosure - Session Duration — flags unusually long authenticated sessions
- Admin Usernames — flags predictable admin usernames (
admin,root, …)
Risk score weights: Critical (+25), High (+15), Medium (+8), Low (+3).
To disable specific checks, set the enabledChecks array in config/garrison.php.
Shield
Active request-level protection, evaluated on Application::EVENT_BEFORE_REQUEST. Checks run cheapest first; control-panel traffic is exempt from rate limiting, geo-blocking, and the WAF to avoid locking out administrators:
- IP allow/block rules — exact, CIDR, or wildcard patterns, scoped to CP / frontend / everywhere → 403
- Login lockout — failed-attempt threshold enforced before the password is checked → 403 / 429
- Geo-blocking (Pro) — block or allowlist by country, resolved from an upstream country header (Cloudflare
CF-IPCountryby default) → 403 - Rate limiting (Pro) — fixed-window per-IP counter backed by Craft's cache → 429
- WAF rules (Pro) — regex signatures for SQL injection, XSS, path traversal, and malicious user agents → 403
Every block is recorded in the database and fires a ThreatDetectedEvent.
Sentinel
Monitoring and audit trail:
- Audit log — records logins, failed logins, logouts, element creation/deletion, plugin install/uninstall/enable/disable, and user suspend/activate events, with the acting user, IP, and user agent
- File integrity (Pro) — SHA-256 baselines stored in the database; detects modified, deleted, and added files across the monitored paths
Default monitored paths: vendor/craftcms/cms/src/, config/, .env, web/index.php.
Beacon
Multi-channel notifications (Pro), delivered via a queue job so a slow webhook never blocks a request:
- Email — via Craft's built-in mailer
- Slack — incoming webhook URL
- Discord — webhook URL
- Webhook — generic POST with a JSON payload
Triggers: scan failure, threat detection, login lockout, and file integrity changes. Threat notifications are de-duplicated per IP so floods don't spam your channels.
Console Commands
REST API (Pro)
The API is authenticated through Craft's session and permission system — callers must be signed-in control-panel users with the relevant Garrison permissions. All endpoints return JSON and live under the control-panel trigger (e.g. /admin).
Scheduled Scans (Pro)
Set scanSchedule to hourly, daily, weekly, or monthly. Garrison enqueues a RunScanJob once the interval has elapsed since the last scan; the check is throttled to run at most once a minute and only on web requests. For deterministic timing you can instead drive php craft garrison/scan/run from system cron.
Permissions
| Permission | Description |
|---|---|
| Access Garrison | View the Garrison CP section |
| Run security scans | Execute manual scans |
| View audit log | Access the Sentinel audit log |
| Manage shield rules | Add/remove IP rules, manage file baselines |
| Manage Garrison settings | Access plugin settings |
Events
| Event | Class | When |
|---|---|---|
EVENT_AFTER_SCAN |
services\Scanner (ScanEvent) |
After a scan completes |
EVENT_THREAT_DETECTED |
services\Shield (ThreatDetectedEvent) |
When Shield blocks a request |
Widgets
- Security Score — current risk score on the Craft dashboard
- Recent Threats — recently blocked requests
Development
License
This is a commercial plugin licensed through the Craft Plugin Store. The Free edition is free. See LICENSE.md.