secubox-deb/scripts/install-audit.sh
CyberMind-FR d7c8cc19e9 Add secubox-repo and secubox-hardening modules, CI/CD workflows
New modules (35 total):
- secubox-repo v1.0.0: APT repository management
  - repoctl CLI for package management
  - GPG key generation and signing
  - Multi-distribution support (bookworm, trixie)
  - Web dashboard for repository status

- secubox-hardening v1.0.0: Kernel and system hardening
  - hardeningctl CLI for security management
  - Sysctl hardening (ASLR, kptr_restrict, SYN cookies)
  - Module blacklist (uncommon protocols, filesystems)
  - Security benchmark with 100% score on VM

CI/CD workflows:
- build-packages.yml: Dynamic matrix for all packages
- build-image.yml: 5 board images with compression
- publish-packages.yml: APT repo publishing
- release.yml: Unified release orchestration

APT repository scripts:
- export-secrets.sh: Export GPG/SSH keys for GitHub Actions
- local-publish.sh: Local test server
- install.sh: User installation script

Security (Phase 5):
- AppArmor profiles for all services
- Audit rules for SecuBox services
- build-all.sh for local builds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-22 22:15:01 +01:00

53 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Install SecuBox audit rules
# Run as root
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
AUDIT_RULES="$SCRIPT_DIR/../common/audit/50-secubox.rules"
# Check root
[ "$(id -u)" -eq 0 ] || { echo "Run as root"; exit 1; }
# Install auditd if not present
if ! command -v auditctl &>/dev/null; then
echo "Installing auditd..."
apt-get update
apt-get install -y auditd audispd-plugins
fi
# Copy rules
echo "Installing SecuBox audit rules..."
cp "$AUDIT_RULES" /etc/audit/rules.d/50-secubox.rules
# Configure auditd for security
cat > /etc/audit/auditd.conf.d/secubox.conf 2>/dev/null || true << 'EOF'
# SecuBox auditd configuration
log_file = /var/log/audit/audit.log
log_format = ENRICHED
max_log_file = 50
num_logs = 10
max_log_file_action = ROTATE
space_left = 75
space_left_action = SYSLOG
admin_space_left = 50
admin_space_left_action = SUSPEND
disk_full_action = SUSPEND
disk_error_action = SUSPEND
EOF
# Reload audit rules
echo "Reloading audit rules..."
augenrules --load 2>/dev/null || auditctl -R /etc/audit/rules.d/50-secubox.rules
# Enable and start auditd
systemctl enable auditd
systemctl restart auditd
echo ""
echo "Audit rules installed. View logs with:"
echo " ausearch -k secubox_config"
echo " ausearch -k wireguard_config"
echo " aureport --summary"