Commit Graph

2 Commits

Author SHA1 Message Date
cschantz 8a4d70c37c Standardize bot-blocker.sh menu validation, colors, and yes/no prompts
IMPROVEMENTS:
- Added input validation for menu choice (0-5) with retry loop
- Added color codes to menu options (${CYAN}1)${NC} and ${RED}0)${NC})
- Removed wildcard case that accepted invalid input silently
- Standardized yes/no prompts to use confirm() library function
- Improved user prompt to show valid range (0-5)

VALIDATION DETAILS:
- Menu choice: Only accepts 0-5, rejects invalid with clear error message
- Retry loop: User stays in menu until valid choice is entered
- Yes/no prompts: Now use confirm() function for consistency
  - Line 45: "Create directory?"
  - Line 146: "Re-apply configuration?"

MENU STANDARDS COMPLIANCE:
✓ Input validation (CRITICAL)
✓ Color codes (IMPORTANT - standardized to CYAN/RED)
✓ Error messages on invalid input (IMPORTANT)
✓ Retry logic for failed validation (IMPORTANT)
✓ Standardized yes/no prompts (IMPORTANT)

Lines modified: ~30 (validation, colors, confirm() function)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-17 18:42:04 -05:00
cschantz dd585493b8 Add Bot Blocker - Apache User-Agent blocking manager
Features:
- Enable/disable bot blocking with one click
- Blocks security scanners (nikto, sqlmap, nmap, etc.)
- Blocks aggressive SEO bots (AhrefsBot, SemrushBot, etc.)
- Blocks AI crawlers (GPTBot, Claude-Web, ChatGPT-User, etc.)
- Blocks generic scrapers (Go-http-client, etc.)
- Automatic backups before changes
- Apache syntax validation before applying
- Safe restart with rollback on failure
- View current configuration
- Manage backups and restore

Configuration:
- File: /etc/apache2/conf.d/includes/pre_main_global.conf
- Blocks 24+ malicious bot user-agents
- Returns HTTP 403 Forbidden to blocked bots
- Zero impact on legitimate traffic

Integrated into Security Menu (option 16)
2026-01-22 19:24:02 -05:00