Scripts Directory Reorganization - Complete: ✅ FUNCTIONAL ORGANIZATION: Scripts sorted into 8 logical categories - github/: GitHub and Git operations (6 files) - sync/: Synchronization and data replication (4 files) - security/: Security and audit operations (2 files) - monitoring/: System and service monitoring (6 files) - maintenance/: System maintenance and cleanup (4 files) - deployment/: Deployment and provisioning (11 files) - testing/: Testing and quality assurance (13 files) - utils/: Utility scripts and helpers (47 files) ✅ ROOT DIRECTORY CLEANED: Only README.md remains in scripts root - scripts/README.md: Main documentation - scripts/SCRIPTS_ORGANIZATION.md: Complete organization guide - All functional scripts moved to appropriate subdirectories ✅ SCRIPTS CATEGORIZATION: 📁 GitHub Operations: PR resolution, repository management, Git workflows 📁 Synchronization: Bulk sync, fast sync, sync detection, SystemD sync 📁 Security: Security audits, monitoring, vulnerability scanning 📁 Monitoring: Health checks, log monitoring, network monitoring, production monitoring 📁 Maintenance: Cleanup operations, performance tuning, weekly maintenance 📁 Deployment: Release building, node provisioning, DAO deployment, production deployment 📁 Testing: E2E testing, workflow testing, QA cycles, service testing 📁 Utilities: System management, setup scripts, helpers, tools ✅ ORGANIZATION BENEFITS: - Better Navigation: Scripts grouped by functionality - Easier Maintenance: Related scripts grouped together - Scalable Structure: Easy to add new scripts to appropriate categories - Clear Documentation: Comprehensive organization guide with descriptions - Improved Workflow: Quick access to relevant scripts by category ✅ DOCUMENTATION ENHANCED: - SCRIPTS_ORGANIZATION.md: Complete directory structure and usage guide - Quick Reference: Common script usage examples - Script Descriptions: Purpose and functionality for each script - Maintenance Guidelines: How to keep organization current DIRECTORY STRUCTURE: 📁 scripts/ ├── README.md (Main documentation) ├── SCRIPTS_ORGANIZATION.md (Organization guide) ├── github/ (6 files - GitHub operations) ├── sync/ (4 files - Synchronization) ├── security/ (2 files - Security) ├── monitoring/ (6 files - Monitoring) ├── maintenance/ (4 files - Maintenance) ├── deployment/ (11 files - Deployment) ├── testing/ (13 files - Testing) ├── utils/ (47 files - Utilities) ├── ci/ (existing - CI/CD) ├── deployment/ (existing - legacy deployment) ├── development/ (existing - Development tools) ├── monitoring/ (existing - Legacy monitoring) ├── services/ (existing - Service management) ├── testing/ (existing - Legacy testing) ├── utils/ (existing - Legacy utilities) ├── workflow/ (existing - Workflow automation) └── workflow-openclaw/ (existing - OpenClaw workflows) RESULT: Successfully reorganized 27 unorganized scripts into 8 functional categories, creating a clean, maintainable, and well-documented scripts directory structure with comprehensive organization guide.
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# AITBC Security Monitoring Script
|
|
|
|
SECURITY_LOG="/var/log/aitbc/security.log"
|
|
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
|
|
|
# Create log directory
|
|
mkdir -p /var/log/aitbc
|
|
|
|
# Function to log security events
|
|
log_security() {
|
|
echo "[$TIMESTAMP] SECURITY: $1" >> $SECURITY_LOG
|
|
}
|
|
|
|
# Check for failed SSH attempts
|
|
FAILED_SSH=$(grep "authentication failure" /var/log/auth.log | grep "$(date '+%b %d')" | wc -l)
|
|
if [ "$FAILED_SSH" -gt 10 ]; then
|
|
log_security "High number of failed SSH attempts: $FAILED_SSH"
|
|
fi
|
|
|
|
# Check for unusual login activity
|
|
UNUSUAL_LOGINS=$(last -n 20 | grep -v "reboot" | grep -v "shutdown" | wc -l)
|
|
if [ "$UNUSUAL_LOGINS" -gt 0 ]; then
|
|
log_security "Recent login activity detected: $UNUSUAL_LOGINS logins"
|
|
fi
|
|
|
|
# Check service status
|
|
SERVICES_DOWN=$(systemctl list-units --state=failed | grep aitbc | wc -l)
|
|
if [ "$SERVICES_DOWN" -gt 0 ]; then
|
|
log_security "Failed AITBC services detected: $SERVICES_DOWN"
|
|
fi
|
|
|
|
# Check disk space
|
|
DISK_USAGE=$(df / | awk 'NR==2 {print $5}' | sed 's/%//')
|
|
if [ "$DISK_USAGE" -gt 80 ]; then
|
|
log_security "High disk usage: $DISK_USAGE%"
|
|
fi
|
|
|
|
echo "Security monitoring completed"
|