feat: v2.5.0 - Complete Technology & Security Update
Features: - PHP 8.4 support (from 8.3) - WordPress 7.0 (auto-update via WP-CLI) - Modern TLS 1.3 cipher suites (2026 best practices) - Fail2Ban security integration (5 jails: SSH, Nginx, WordPress, recidive) - Auto-update cron job for WordPress (weekly Minor updates) - Debian 14 Forky support (testing) - Ubuntu 25.04 support - Python 3.12 in GitHub Actions Security: - Fail2Ban with SSH brute force protection (24h ban) - WordPress wp-login.php protection (2h ban) - Nginx bot scanner protection - Recidive jail for repeat offenders (1 week ban) - Modern TLS ciphers (AEAD only) - HSTS 2 years for preload Documentation: - docs/autoupdate.md - WordPress auto-update guide - docs/fail2ban.md - Fail2Ban configuration guide - docs/troubleshooting.md - Updated with php_version variable Breaking changes: - PHP 8.4 is now the default (requires Ubuntu 20.04+ or Debian 11+)
This commit is contained in:
72
scripts/update-docs.py
Executable file
72
scripts/update-docs.py
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Documentation Variable Processor
|
||||
Replaces {{ variable }} placeholders in documentation files with values from vars/debian-family.yml
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT_DIR = os.path.dirname(SCRIPT_DIR)
|
||||
VARS_FILE = os.path.join(ROOT_DIR, 'vars', 'debian-family.yml')
|
||||
DOCS_DIR = os.path.join(ROOT_DIR, 'docs')
|
||||
|
||||
def load_variables():
|
||||
"""Load variables from debian-family.yml"""
|
||||
with open(VARS_FILE, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
php_version = None
|
||||
for line in content.split('\n'):
|
||||
if 'php_version:' in line:
|
||||
php_version = line.split(':')[-1].strip().strip('"')
|
||||
break
|
||||
|
||||
return {
|
||||
'php_version': php_version or '8.4',
|
||||
}
|
||||
|
||||
def process_file(filepath, variables):
|
||||
"""Replace {{ variable }} patterns in a file"""
|
||||
with open(filepath, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
original = content
|
||||
|
||||
pattern = r'\{\{\s*php_version\s*\}\}'
|
||||
|
||||
content = content.replace('{{ php_version }}', variables['php_version'])
|
||||
|
||||
if content != original:
|
||||
with open(filepath, 'w') as f:
|
||||
f.write(content)
|
||||
return True
|
||||
return False
|
||||
|
||||
def main():
|
||||
variables = load_variables()
|
||||
|
||||
print(f"Using PHP version: {variables['php_version']}")
|
||||
|
||||
changed = 0
|
||||
for filename in os.listdir(DOCS_DIR):
|
||||
if filename.endswith('.md'):
|
||||
filepath = os.path.join(DOCS_DIR, filename)
|
||||
if process_file(filepath, variables):
|
||||
print(f" Updated: {filename}")
|
||||
changed += 1
|
||||
|
||||
for root, dirs, files in os.walk(ROOT_DIR):
|
||||
for f in files:
|
||||
if f == 'troubleshooting.md' or f == 'production-deployment.md':
|
||||
filepath = os.path.join(root, f)
|
||||
if process_file(filepath, variables):
|
||||
print(f" Updated: {f}")
|
||||
changed += 1
|
||||
|
||||
print(f"\nDone. {changed} file(s) updated.")
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
116
scripts/wp-update.sh
Executable file
116
scripts/wp-update.sh
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# WordPress Auto-Update Script
|
||||
# Usage: ./wp-update.sh [--minor|--major|--force] [--backup]
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
WORDPRESS_PATH="${WORDPRESS_PATH:-/var/www/html}"
|
||||
BACKUP_PATH="${BACKUP_PATH:-/var/backups/wordpress}"
|
||||
LOG_FILE="${LOG_FILE:-/var/log/wp-update.log}"
|
||||
|
||||
MODE="minor"
|
||||
DO_BACKUP=true
|
||||
|
||||
log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
error_exit() {
|
||||
log "ERROR: $1"
|
||||
wp maintenance-mode deactivate 2>/dev/null || true
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--minor)
|
||||
MODE="minor"
|
||||
shift
|
||||
;;
|
||||
--major)
|
||||
MODE="major"
|
||||
shift
|
||||
;;
|
||||
--force)
|
||||
MODE="force"
|
||||
shift
|
||||
;;
|
||||
--no-backup)
|
||||
DO_BACKUP=false
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [--minor|--major|--force] [--no-backup]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
log "========================================"
|
||||
log "WordPress Update Started (Mode: $MODE)"
|
||||
log "========================================"
|
||||
|
||||
cd "$WORDPRESS_PATH"
|
||||
|
||||
if [ ! -f "wp-config.php" ]; then
|
||||
error_exit "WordPress not found at $WORDPRESS_PATH"
|
||||
fi
|
||||
|
||||
if $DO_BACKUP; then
|
||||
log "Creating database backup..."
|
||||
|
||||
BACKUP_DIR="$BACKUP_PATH/$(date +%Y%m%d-%H%M%S)"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
if wp db export "$BACKUP_DIR/wp-db.sql"; then
|
||||
log "Database backup saved to $BACKUP_DIR/wp-db.sql"
|
||||
else
|
||||
error_exit "Database backup failed"
|
||||
fi
|
||||
|
||||
log "Creating file backup..."
|
||||
tar -czf "$BACKUP_DIR/wp-files.tar.gz" -C "$(dirname "$WORDPRESS_PATH")" "$(basename "$WORDPRESS_PATH")" 2>/dev/null || true
|
||||
log "File backup saved to $BACKUP_DIR/wp-files.tar.gz"
|
||||
fi
|
||||
|
||||
log "Activating maintenance mode..."
|
||||
wp maintenance-mode activate || error_exit "Failed to activate maintenance mode"
|
||||
|
||||
log "Checking for WordPress updates..."
|
||||
if [ "$MODE" = "major" ]; then
|
||||
wp core update || log "No major update available or update failed"
|
||||
elif [ "$MODE" = "force" ]; then
|
||||
wp core update --force || log "Update failed"
|
||||
else
|
||||
wp core update --minor || log "No minor update available"
|
||||
fi
|
||||
|
||||
log "Running database updates..."
|
||||
wp core update-db || log "No database update needed"
|
||||
|
||||
log "Updating plugins..."
|
||||
wp plugin update --all || log "Plugin update completed with warnings"
|
||||
|
||||
log "Updating themes..."
|
||||
wp theme update --all || log "Theme update completed with warnings"
|
||||
|
||||
log "Verifying WordPress installation..."
|
||||
wp core verify-checksums || log "Checksum verification completed with warnings"
|
||||
|
||||
log "Deactivating maintenance mode..."
|
||||
wp maintenance-mode deactivate || true
|
||||
|
||||
log "========================================"
|
||||
log "WordPress Update Completed Successfully"
|
||||
log "========================================"
|
||||
|
||||
wp plugin list --status=active --format=table 2>/dev/null | tee -a "$LOG_FILE"
|
||||
|
||||
echo ""
|
||||
log "Updated WordPress version:"
|
||||
wp core version
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user