# WireWall Installation Guide Complete installation instructions for WireWall security module. --- ## ๐Ÿ“‹ Prerequisites ### Required - ProcessWire 3.0.200 or higher - PHP 7.4+ (8.0+ recommended) - Write permissions on `/site/modules/` directory - Write permissions on `/site/assets/cache/` directory ### Optional (for MaxMind) - Composer (for GeoIP2 library) - MaxMind account (free) - ~82MB disk space for all databases --- ## ๐Ÿš€ Method 1: Standard Installation ### Step 1: Download Module ```bash cd /path/to/processwire/site/modules/ git clone https://github.com/mxmsmnv/WireWall.git ``` Or download ZIP: ```bash wget https://github.com/mxmsmnv/WireWall/archive/master.zip unzip master.zip mv WireWall-master WireWall ``` ### Step 2: Set Permissions ```bash chmod 755 WireWall chmod 644 WireWall/WireWall.module.php ``` ### Step 3: Install in ProcessWire 1. Login to ProcessWire admin 2. Navigate to: `Modules โ†’ Site` 3. Click "Refresh" to detect new module 4. Find "WireWall" in the list 5. Click "Install" ### Step 4: Initial Configuration 1. Navigate to: `Modules โ†’ Configure โ†’ WireWall` 2. Enable module: โ˜‘ **Enable WireWall** 3. Set basic options: - Rate Limiting: `10 requests / 60 minutes` - Block Action: `Beautiful Block Page` - Enable Stats Logging: โ˜‘ 4. Click "Save" --- ## ๐ŸŒ Method 2: Installation with MaxMind (Recommended) MaxMind provides fast, accurate geolocation without external API calls. ### Step 1: Register for MaxMind (Free) 1. Go to: https://www.maxmind.com/en/geolite2/signup 2. Create free account 3. Verify email 4. Login to account ### Step 2: Download Databases 1. Go to: https://www.maxmind.com/en/accounts/current/geoip/downloads 2. Download these databases: - **GeoLite2-Country.mmdb** (~7 MB) - Required - **GeoLite2-ASN.mmdb** (~5 MB) - Required - **GeoLite2-City.mmdb** (~70 MB) - Optional ### Step 3: Create geoip Directory ```bash cd /path/to/processwire/site/modules/WireWall/ mkdir geoip chmod 755 geoip ``` ### Step 4: Place Databases ```bash # Extract downloaded GZ files gunzip GeoLite2-Country.tar.gz gunzip GeoLite2-ASN.tar.gz gunzip GeoLite2-City.tar.gz # if using # Extract tar archives tar -xvf GeoLite2-Country.tar tar -xvf GeoLite2-ASN.tar tar -xvf GeoLite2-City.tar # if using # Copy .mmdb files to module cd /path/to/processwire/site/modules/WireWall/geoip/ cp /path/to/downloads/GeoLite2-Country_*/GeoLite2-Country.mmdb . cp /path/to/downloads/GeoLite2-ASN_*/GeoLite2-ASN.mmdb . cp /path/to/downloads/GeoLite2-City_*/GeoLite2-City.mmdb . # if using ``` ### Step 5: Install PHP Library ```bash cd /path/to/processwire/site/modules/WireWall/ composer require geoip2/geoip2 ``` If composer not installed: ```bash # Install composer curl -sS https://getcomposer.org/installer | php php composer.phar require geoip2/geoip2 ``` ### Step 6: Verify Installation 1. Go to: `Admin โ†’ Modules โ†’ WireWall โ†’ Configure` 2. Look for "MaxMind GeoLite2 Status" section 3. Should show: ``` โœ… MaxMind GeoLite2 databases are installed and active Country Database: GeoLite2-Country.mmdb (6.84 MB) โœ… ASN Database: GeoLite2-ASN.mmdb (5.21 MB) โœ… City Database: GeoLite2-City.mmdb (70.5 MB) โœ… Status: Active - Using MaxMind for all GeoIP lookups ``` --- ## ๐Ÿ”ง Directory Structure After installation, your directory should look like: ``` /site/modules/WireWall/ โ”œโ”€โ”€ WireWall.module.php (Main module file) โ”œโ”€โ”€ README.md (Documentation) โ”œโ”€โ”€ INSTALL.md (This file) โ”œโ”€โ”€ CONFIGURATIONS.md (Configuration examples) โ”œโ”€โ”€ geoip/ (MaxMind databases) โ”‚ โ”œโ”€โ”€ GeoLite2-Country.mmdb โ”‚ โ”œโ”€โ”€ GeoLite2-ASN.mmdb โ”‚ โ””โ”€โ”€ GeoLite2-City.mmdb (optional) โ””โ”€โ”€ vendor/ (Composer dependencies) โ””โ”€โ”€ geoip2/ (MaxMind library) ``` --- ## ๐Ÿ“Š Cache Directory WireWall will automatically create cache directory: ``` /site/assets/cache/WireWall/ โ”œโ”€โ”€ ratelimit_IP.cache (Rate limit counters) โ”œโ”€โ”€ ban_IP.cache (Banned IPs) โ”œโ”€โ”€ proxy_IP.cache (VPN/Proxy detection results) โ””โ”€โ”€ geo_IP.cache (GeoIP lookup results) ``` Permissions: `755` (directory), `644` (files) --- ## โœ… Verification Checklist After installation, verify: - [ ] Module appears in `Modules โ†’ Site` - [ ] Module can be installed without errors - [ ] Configuration page loads - [ ] Cache directory created: `/site/assets/cache/WireWall/` - [ ] MaxMind status shows (if installed) - [ ] Test blocking works (temporarily block your IP) - [ ] Logs appear in `/site/assets/logs/wirewall.txt` --- ## ๐Ÿงช Testing Installation ### Test 1: Basic Functionality 1. Enable WireWall 2. Add your IP to blacklist temporarily 3. Open site in incognito/private window 4. Should see block page 5. Remove your IP from blacklist ### Test 2: Rate Limiting 1. Set rate limit: `5 requests / 1 minute` 2. Refresh page 6 times quickly 3. Should see block page on 6th request 4. Wait 1 minute, access restored 5. Reset rate limit to normal ### Test 3: MaxMind (if installed) 1. Check logs: `/site/assets/logs/wirewall.txt` 2. Should see country codes: `ALLOWED | US | ...` 3. If City DB installed, should see: `ALLOWED | US (Philadelphia, Pennsylvania) | ...` --- ## ๐Ÿ”„ Updating ### Update Module Files ```bash cd /path/to/processwire/site/modules/WireWall/ git pull origin main ``` Or download new version and replace files. ### Update MaxMind Databases (Monthly) MaxMind updates databases monthly. To update: ```bash # 1. Download new databases from MaxMind # 2. Replace old files cd /path/to/processwire/site/modules/WireWall/geoip/ rm -f *.mmdb cp /path/to/new/GeoLite2-Country.mmdb . cp /path/to/new/GeoLite2-ASN.mmdb . cp /path/to/new/GeoLite2-City.mmdb . # if using # 3. Verify in admin Admin โ†’ Modules โ†’ WireWall โ†’ Configure # Check "Last Updated" dates ``` --- ## ๐Ÿ› Troubleshooting ### Problem: Module doesn't appear in Modules list **Solution:** ```bash # Check file permissions chmod 755 /path/to/site/modules/WireWall chmod 644 /path/to/site/modules/WireWall/WireWall.module.php # Refresh modules Admin โ†’ Modules โ†’ Refresh ``` ### Problem: MaxMind shows "Not Installed" **Solution:** ```bash # Check databases exist ls -lh /path/to/site/modules/WireWall/geoip/ # Should show: GeoLite2-Country.mmdb, GeoLite2-ASN.mmdb # Check composer dependencies ls -lh /path/to/site/modules/WireWall/vendor/ # Should show: geoip2/ # If missing, install: cd /path/to/site/modules/WireWall/ composer require geoip2/geoip2 ``` ### Problem: Cache directory errors **Solution:** ```bash # Create cache directory manually mkdir -p /path/to/site/assets/cache/WireWall chmod 755 /path/to/site/assets/cache/WireWall # Check ProcessWire can write touch /path/to/site/assets/cache/WireWall/test.txt # If error, fix permissions on parent directory chmod 755 /path/to/site/assets/cache ``` ### Problem: Rate limiting not working **Solution:** 1. Check cache directory is writable 2. Test with low limit (e.g., 3 req/min) 3. Use incognito/private window (avoid cookie caching) 4. Check logs for rate-limit blocks ### Problem: Country blocking not working **Solution:** 1. Verify MaxMind installed (or HTTP fallback working) 2. Check country codes are correct (US, AU, GB) 3. Verify blocking mode (blacklist vs whitelist) 4. Check logs show correct country detection --- ## ๐Ÿ” Security Recommendations After installation: 1. **Test thoroughly** - Use incognito mode for testing 2. **Whitelist your IP** - Prevent self-blocking 3. **Monitor logs** - Watch for false positives 4. **Start conservative** - Enable features gradually 5. **Backup configuration** - Export settings regularly --- ## ๐Ÿ“š Next Steps After installation: 1. Read [CONFIGURATIONS.md](CONFIGURATIONS.md) for configuration examples 2. Configure country blocking (if needed) 3. Set up rate limiting 4. Enable VPN/Proxy detection 5. Test with different scenarios 6. Monitor logs for first 24 hours --- **Installation complete! ๐ŸŽ‰** Proceed to [CONFIGURATIONS.md](CONFIGURATIONS.md) for configuration examples.