diff --git a/.github/workflows/safety.yml b/.github/workflows/safety.yml new file mode 100644 index 0000000..f7e3a29 --- /dev/null +++ b/.github/workflows/safety.yml @@ -0,0 +1,12 @@ +name: Isolated script safety +on: [push, pull_request] +permissions: + contents: read +jobs: + fixtures: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - name: Bash syntax and local fixture regressions + run: python3 -m unittest discover -s tests -v diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..41c33c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +__pycache__/ +*.pyc diff --git a/README.md b/README.md index be1981c..344735c 100644 --- a/README.md +++ b/README.md @@ -1,187 +1,68 @@ -# ๐Ÿง Linux Admin Scripts +# Linux Admin Scripts -A production-ready collection of Bash scripts for Linux system administration monitoring, alerting, backup, maintenance, and security auditing. +11 October reconciliation: the existing safety fixes are reconciled with current main, preserving all four scripts added since September. `backup_verify.sh`, `healthcare_check.sh`, and `log_summary.sh` now distinguish unavailable evidence from successful checks. The suite contains 28 isolated tests. See [REVIEW-2026-10-11.md](REVIEW-2026-10-11.md) for this run's scope and migration notes. -> All scripts include centralized Slack/Teams/Email alerting, lock files, log rotation, and proper error handling. +9 September continuation: shared backup publication now refuses existing checksum files, symlinks and directories. Both daily and weekly paths publish checksums with no-clobber hard links; a checksum-generation failure cannot report a verified backup. Interrupted publication may still leave an archive without its final checksum, so require a valid checksum pair and investigate retained partial artifacts. This adds two isolated regression tests (12 total); application-consistent restoration remains a lab gate. ---- +Bash administration utilities. Validate each script in a disposable lab before production deployment. Syntax checks and fixture tests do not certify an environment or an application backup. -## ๐Ÿ“ Repository Structure +## Entry points -``` -linux-admin-scripts/ -โ””โ”€โ”€ scripts/ - โ”œโ”€โ”€ core/ โ† Shared alert engine (load this first) - โ”œโ”€โ”€ audit/ โ† Security & system auditing - โ”œโ”€โ”€ monitoring/ โ† Resource & service monitoring - โ”œโ”€โ”€ backup/ โ† Backup & rotation scripts - โ””โ”€โ”€ maintenance/ โ† Cleanup & housekeeping -``` +Use `bash `; several maintained entry points intentionally have no `.sh` extension. ---- +| Path | Behavior and scope | +| --- | --- | +| `scripts/monitoring/server-stats.sh` | Local statistics snapshot; unchanged in the September remediation. | +| `scripts/monitoring/cpu_memory_monitor` | CPU/memory observations; local log and stderr alerts. | +| `scripts/monitoring/disk_alert` | One GNU df collection; warning/critical or unavailable collection returns nonzero. | +| `scripts/monitoring/service_uptime ...` | Explicit service scope, alert-only; never restarts a service. | +| `scripts/backup/backup_script ` | Verified, versioned file archive; retention inventory only. | +| `scripts/backup/backup_rotation.sh` | Versioned daily/weekly archives; requires SRC_DIR, BACKUP_DIR and EXPECTED_BACKUP_SOURCE. | +| `scripts/backup/backup_verify.sh -d ` | Read-only freshness/size check, exact age in seconds; optional `--verify-archive` fails when integrity cannot be verified. | +| `scripts/monitoring/healthcare_check.sh` | CPU, memory, swap and disk checks; failed, empty or malformed collections return UNKNOWN. | +| `scripts/monitoring/log_summary.sh -f ` | Read-only log summary; numeric rotations optional; failed reads/decompression/timeouts return UNKNOWN. | +| `scripts/audit/security-audit.sh` | Preserved current-main security audit; not remediated or runtime-validated in this run. | +| `scripts/Nginx_create.sh