ModSecurity Configuration for Tiki | |
|
1. Introduction | |
ModSecurity is a powerful, open-source web application firewall (WAF) module that enhances security by protecting web applications, including Tiki sites, from a wide range of threats such as SQL injection, cross-site scripting (XSS), and malicious bots attempting to scrape content or exploit vulnerabilities. It operates based on predefined rules to filter and block potentially harmful requests. This guide provides a comprehensive walkthrough for setting up and configuring ModSecurity, ensuring optimal security while preserving Tiki's usability and functionality.
|
2. Installation | |
Step 1: Install ModSecurity | |
For Apache (Debian/Ubuntu) Copy to clipboard
|
Step 2: Enable ModSecurity | |
Enable ModSecurity by copying the recommended configuration file: Copy to clipboard
Then, edit the file: Copy to clipboard
Find: apache Copy to clipboard
Change it to: apache Copy to clipboard
Save and close the file. |
Step 3: Verify Installation | |
Check if ModSecurity is enabled: Copy to clipboard
Expected output: Copy to clipboard
If the module is not loaded, restart Apache: Copy to clipboard
|
3. Basic Configuration | |
Enable the OWASP Core Rule Set (CRS) | |
Copy to clipboard
Ensure this line is included: apache Copy to clipboard
|
Enable DoS Protection (Optional) | |
ModSecurity includes optional anti-automation and DoS (Denial of Service) protection. You can enable it by uncommenting and customizing a rule found in: Copy to clipboard
Copy to clipboard
Copy to clipboard
|
4. Tiki-Specific Configuration | |
Without proper adjustments, users may experience unexplained 403 or 500 errors during normal site usage. Below are specific steps to tailor ModSecurity to better support Tiki’s functionality while maintaining security. |
Handling False Positives | |
Copy to clipboard
Common Example: File Upload BlockedTo fix file upload issues on Tiki, add the below rule in /etc/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf Copy to clipboard
|
Language-Specific False Positives | |
Review the ModSecurity audit log: Copy to clipboard
Copy to clipboard
This ensures ModSecurity does not incorrectly block legitimate content written in different languages. |
5. Blocking Bots with ModSecurity | |
Identifying Bots in Logs
Copy to clipboard
Adding Rules to Block Bots
Create /etc/modsecurity/bad_bots.txt: Add: Copy to clipboard
Add the rule:
Copy to clipboard
Copy to clipboard
Blocking Bots by IP Address
Copy to clipboard
|
6. Testing & Troubleshooting | |
|
Testing with CURL | |
Copy to clipboard
|
Reviewing Logs | |
Copy to clipboard
|
7. Final Checks & Maintenance | |
|
Conclusion | |
This guide helps secure Tiki with ModSecurity, prevent false positives, and block malicious bots. Regularly monitor logs and adjust exclusion rules for usability.
related pages
Security Admin
external links
aliases for this page
|