Add cleanup script for IP reputation and toolkit data

Created comprehensive cleanup tool to remove all server-specific data
before transferring toolkit to another server.

NEW FILE:
- modules/maintenance/cleanup-toolkit-data.sh
  * Removes IP reputation database (/var/lib/server-toolkit/)
  * Cleans all temporary analysis files (/tmp/*bot*, *500-tracker*, etc.)
  * Removes generated reports
  * Clears cache and session data
  * Optional log file removal
  * Shows summary of items removed and space freed
  * Safety confirmation required before cleanup

UPDATED:
- launcher.sh
  * Added cleanup script to Backup & Recovery menu (option 9)
  * Placed in "Data Management" section
  * Clearly marked with trash icon to indicate destructive operation

PURPOSE:
This ensures the IP reputation database and other server-specific data
are not transferred when moving the toolkit between servers. Each server
should build its own IP reputation database based on its own traffic and
attack patterns.

USE CASES:
✓ Moving toolkit to different server
✓ Starting fresh analysis
✓ Removing server-specific data before sharing toolkit
✓ Regular maintenance/cleanup

WHAT GETS CLEANED:
- /var/lib/server-toolkit/ip-reputation/ (IP reputation database)
- /tmp/bot_analysis_* (bot analyzer temp files)
- /tmp/500-tracker-* (error tracker temp files)
- /tmp/live-monitor-* (live monitoring temp files)
- /tmp/*_report_*.txt (generated reports)
- /var/cache/server-toolkit/ (cached data)
- Session/lock files
- Optional: execution logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cschantz
2025-11-05 18:48:23 -05:00
parent 9cc203a87e
commit 9ff7308de0
2 changed files with 248 additions and 0 deletions
+5
View File
@@ -559,6 +559,10 @@ show_backup_menu() {
echo -e " ${YELLOW}7)${NC} Backup Verification - Test backup integrity"
echo -e " ${YELLOW}8)${NC} Off-site Sync - Sync to remote storage"
echo ""
echo -e "${BOLD}Data Management:${NC}"
echo ""
echo -e " ${RED}9)${NC} 🗑️ Cleanup Toolkit Data - Remove IP reputation & temp files"
echo ""
echo -e " ${RED}0)${NC} Back to Main Menu"
echo ""
echo -e "${CYAN}──────────────────────────────────────────────────────────────${NC}"
@@ -1320,6 +1324,7 @@ handle_backup_menu() {
6) run_module "backup" "log-archive.sh" ;;
7) run_module "backup" "backup-verification.sh" ;;
8) run_module "backup" "offsite-sync.sh" ;;
9) run_module "maintenance" "cleanup-toolkit-data.sh" ;;
0) return ;;
*) echo -e "${RED}Invalid option${NC}"; sleep 1 ;;
esac