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+)
72 lines
2.0 KiB
Python
Executable File
72 lines
2.0 KiB
Python
Executable File
#!/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()) |