hestiacp-toolkit
Health Uyari
- No license — Repository has no license file
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 17 GitHub stars
Code Basarisiz
- rm -rf — Recursive force deletion command in scripts/backup-core-patches/install.sh
- exec() — Shell command execution in scripts/backup-core-patches/lib/hestia.sh
- rm -rf — Recursive force deletion command in scripts/backup-core-patches/lib/hestia.sh
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Production hardening, 70-check security auditing, and backup automation toolkit for HestiaCP servers
HestiaCP Toolkit
Formerly
hestiacp-useful-tools. Existing server clones and GitHub links resolve automatically, and on-host state paths (/var/backups/hestiacp-useful-tools,/etc/hestiacp-useful-tools.conf) remain unchanged for backwards compatibility.
Production-grade hardening, 70-check security auditing, hybrid backup automation, mail guardrails, optimization guides, and platform-agnostic AI prompt blueprints for HestiaCP on Debian and Ubuntu servers.
Built and battle-tested for real production environments. A contribution to the HestiaCP community.
Companion AI Control Plane (hestiacp-mcp)
Want AI assistants (Claude, Cursor, VS Code, Codex, Antigravity) to inspect and safely operate these tools over SSH?
webxtekstudio/hestiacp-mcp is our official fail-closed TypeScript Model Context Protocol (MCP) server engineered specifically for HestiaCP 1.10.10 hosts:
- Auto-detects this toolkit over SSH (
toolkit&upgradetoolsets): Exposes structured read-only inspection (hestia_useful_tools_status,hestia_verify_backups,hestia_security_audit,hestia_system_report,hestia_mail_forward_audit,hestia_fail2ban_status,hestia_restic_status,hestia_harden_status) plus opt-indryRun-first operational wrappers. - Syncs
AI/knowledge/directly: Bundles the 16 curated manuals inAI/knowledgeas verified MCP guides (hestia_get_guideandhestia://knowledge/{topic}). - Install or pull anywhere: npm (
@webxtekstudio/hestiacp-mcp) |ghcr.io/webxtekstudio/hestiacp-mcp:1.0.0| Official MCP Registry (io.github.webxtekstudio/hestiacp-mcp).
Architecture & Operational Flows
Toolkit Architecture & MCP Ecosystem
Automated Defense, Hybrid Backup & Weekly Audit Lifecycle
Repository Structure
1. Guides & Optimizations
Step-by-step guides to optimize your server infrastructure:
- PHP-FPM Optimization Guide: Calculate RAM limits and choose between
ondemand,dynamic, andstaticPHP modes based on server size and traffic. - MariaDB Optimization Guide: Configure
innodb_buffer_pool_size,innodb_log_file_size, andtable_open_cachefor MariaDB 10.11 / 11.8 LTS to improve database performance and reduce CPU load. - SWAP Setup Guide: 1-click script to configure SWAP memory and
vm.swappiness=10, essential for low-RAM environments (1GB/2GB VPS).
2. AI Integration Blueprints (/AI)
Platform-agnostic system prompt blueprints and knowledge bases to integrate LLMs with your HestiaCP server. No dependency on Dify, n8n, or any specific platform - inject these prompts directly into any LLM provider (OpenAI, Anthropic, Google, OpenRouter, etc.) via systemPrompt, or load the bundled guides automatically via webxtekstudio/hestiacp-mcp.
Cognitive Architecture
The AI prompts in this repository follow a 3-module Cognitive OS structure inspired by the Nuwa.skill methodology and the Agent Skills standard:
<decision_heuristics> - Operational reasoning rules
<expression_dna> - Tone, syntax, and output format
<internal_tensions> - Ethical and technical constraints to force critical thinking
This structure shifts LLM agents from generic "helpful assistants" to specialized cognitive profiles with deterministic, institutional-grade behavior.
Available Prompts (/AI/DevOps-AI-Prompts)
- DevOps Agent: A senior DevOps engineer persona with SSH root access. Enforces "look before you leap" heuristics, mandatory pre-flight checks (
nginx -tbefore restart), and balances root power against operational safety. Responds in the user's language. - System Monitor: A cold, clinical health-check agent. Runs scheduled server audits, grades severity objectively (HEALTHY / DEGRADED / CRITICAL), and suppresses alerts when no human action is required.
Knowledge Base (/AI/knowledge)
Curated Markdown files covering HestiaCP CLI commands, PHP-FPM tuning, Exim troubleshooting, Nginx configuration, backups, and security tooling. Designed as both a standalone RAG knowledge base and the canonical source synced into hestiacp-mcp.
3. Custom Scripts (/scripts)
Automation and maintenance scripts to enhance HestiaCP's default capabilities.
| Module & Dedicated Guide | CLI Command | Default Cron Schedule | Primary Purpose |
|---|---|---|---|
| System Cleanup Guide | v-clean-garbage |
30 4 * * 0 (Sun 04:30) |
Cleans journald, rotated logs, PHP sessions, temp files, mail queue & spam |
| Backup Core Patches Guide | v-backup-users / v-restic-manager / v-prune-backups / v-verify-backups |
10 5 * * * (Hestia native) + 30 2 * * * (Restic) |
YYYY/MM_MONTH/user layout, DB auto-repair, Dark-Mode HTML emails, Restic Master Key & daily runner, B2 retry, retention & verification |
| GitHub Mirror Guide | v-github-mirror |
0 */12 * * * (every 12h + Sun 06:00) |
Zero-trust pull-only mirror of private/public Git repos into /home/<user>/git/<repo> (or private/) |
| Exim Limit & Anti-Spoof Guide | v-add-exim-limit / monitor_large_emails.py |
0 * * * * (hourly monitor) |
Enforces 25MB attachment limit + blocks external From: spoofing on +local_domains & IP-literal HELOs |
| System Health Report Guide | v-system-report |
0 8 * * 0 (Sun 08:00) |
HTML health digest (CPU, RAM, Disk, Services, SSL expiry, RBL blacklists) |
| Web Permissions Fixer Guide | v-fix-web-permissions |
On-demand rescue | Fixes public_html ownerships, hardens CMS configs (640), flags exposed .git |
| Security Audit Guide | v-security-audit |
0 7 * * 0 (Sun 07:00) |
4-layer A-F security scanner (System, YARA Backend, TLS/Headers, OWASP Pentest) |
| Server Hardening & CrowdSec Guide | v-harden-server |
50 4 * * * (daily 04:50 healer) |
6-pillar hardening: sysctl, APT, SSH, IPv6 nftables mirror, Nginx edge + Fail2Ban .local, CrowdSec IPS |
| Logrotate Optimizer Guide | v-optimize-logrotate |
Event-driven (logrotate.d) |
Upgrades Nginx & Apache rotation from weekly rotate 4 to daily rotate 14 |
| Fail2Ban Email Optimizer Guide | v-optimize-fail2ban |
Daemon (jail.d/*.local) |
Relaxes Dovecot/Exim bans (5 retries / 2h ban) so typos don't cause 7-day lockouts |
Nginx .txt Cache Hardener Guide |
v-patch-nginx-txt-nocache |
Auto-healed daily (04:50) |
Removes .txt from static expires max rules so robots.txt/llms.txt/ads.txt stay fresh |
| Mail Forward Policy Guide | v-mail-forward-policy |
Web panel / API / --audit |
Restricts non-admin external forwards and external Catch-Alls while allowing admin/impersonation exceptions |
System Cleanup (v-clean-garbage)
- Cleans old system logs (Journalctl), rotated logs, and temp files.
- Manages mail queue and spam retention.
- Configuration-driven toggles per task.
Native Backup Core Patches
- Native hooks and optional helpers: Integrates with Hestia core scripts and provides separate helpers for Restic orchestration, verification and export.
- Pillar 1: Data Organization: Automatically organizes local files and B2 Cloud files into
YYYY/MM_MONTH/username/while keeping Symlinks in root for Hestia Web Panel UI compatibility. - Pillar 2: Database Auto-Repair: Injects pre-flight
mysqlrepair --check --auto-repairto fix corrupted indexes beforemysqldump, eliminating the #1 cause of silent backup failures. - Pillar 3: Interactive TTY Shell: Automatically detects manual terminal sessions and streams live console logs via
tee, while remaining silent for nocturnal cron jobs. - Pillar 4: Enterprise HTML Notifications: Replaces basic TXT messages with Dark Mode Multipart HTML reports (inclusive of physical
.logfile attachments and Global Administration Batch summaries). - Native Optional Smart Retention: Patches
v-backup-userswith a disabled-by-default retention hook powered byv-prune-backups, giving classic.tarbackups dry-run-first daily/weekly/monthly thinning across local, B2, or rclone storage. Hestia's nativeBACKUPScount and Restic pruning remain available. - Remote & Local Backup Verification (
v-verify-backups): Cross-checks every non-suspended HestiaCP user's latestbackup.confentry against the live remote bucket (b2 ls --long/rclone lsl) or local.tararchive (tar -tf), reconciling expired cloud/local entries inbackup.conf(U_BACKUPS), verifying existence, byte-size tolerance, and freshness (<= 8days for weekly or<= 35days for monthly.tarschedules), plus every active user's Restic snapshot metadata (<= 36h) into/var/log/hestia/backup-verify.status. This metadata check does not read all backup data or prove a working restore. - Restic Incremental, Secondary Recovery Password & TAR Export (
v-restic-manager): Enrolls a secondary recovery password in each user repository, keeps its server copy at/etc/hestiacp-restic-master.key(0400 root:root), and requires an independently protected offline copy for disaster recovery. It also hardens per-user credentials, removes staging dumps, sends failure alerts and reconstructs the Hestia archive layout for export. Per-user locks and atomic publication prevent concurrent downloads from receiving an unfinished TAR. Validate full recovery on an isolated Hestia installation before relying on it for migration.
GitHub Mirror (v-github-mirror)
- A cron-based zero-trust auto-pull script that mirrors private/public GitHub or GitLab repositories into a user's isolated
/home/<user>/git/<repo>directory (orweb/<domain>/private/), safely outside public web access and automatically included in HestiaCP user backups (User Directory: git). - Automatically pre-creates top-level
git/directories (0700 <user>:<user>) on SFTP-chrooted HestiaCP homes and strips remote URLs/credentials from tenant.git/config.
Exim Limit & Anti-Spoof Monitor (v-add-exim-limit)
- Blocks outgoing emails larger than 25MB to protect IP reputation, with user-friendly rejection messages and admin alerts.
- Dynamically blocks unauthenticated external senders forging any local HestiaCP domain (
+local_domains) in the visualFrom:header (closing theReturn-Path: <>null-sender spoofing loophole across all current and future domains).
System Health Report (v-system-report)
- Checks CPU, RAM, Disk, and Load averages.
- Monitors all HestiaCP services (Nginx, Apache, PHP-FPM, MySQL, Exim, etc.).
- Checks SSL expiry, email blacklists, and database errors.
- Sends a detailed HTML report to the admin.
Web Permissions Fixer (v-fix-web-permissions)
- A rescue tool that goes beyond the native
v-rebuild-web-domain. It safely descends intopublic_html/and aligns broken file ownerships (user:user) caused by root SFTP uploads or botched CMS auto-updates. - Smart Exclusions: Applies strict
644/755base permissions with CMS autodetection. Framework secrets (e.g. Laravel.env, WordPresswp-config.php, Magentoenv.php) are hardened to640. - Safety First: Runs read-only security scans (warning of exposed
.gitfolders in production) and respects a.no-fix-permissionssentinel file to skip domains with custom CGI configurations.
Security Audit (v-security-audit)
- A modular, zero-dependency auditing tool inspired by Lynis, built natively for HestiaCP's architecture. Grades the server from A to F and exports JSON/HTML reports across 4 distinct layers:
- System Layer: Validates kernel CVEs, SSH hardening, Fail2Ban bounds, and WordPress Fail2Ban filter coverage (
xmlrpc.phpandwp-login.php). - Backend Layer: Scans
public_html/via YARA rules for deep PHP Malware heuristics, base64 WebShells, and Auto-Symlink Escapes. - Frontend Layer: Checks TLS ciphers, HSTS, and Security Headers.
- Pentest Layer: Simulates real-world OWASP Top 10 attacks (SQLi, XSS, Brute-Force floods) against your own domains to test firewall resiliency.
Server Hardening & CrowdSec IPS (v-harden-server)
- Automates 6 upgrade-safe security layers engineered specifically for HestiaCP on Debian and Ubuntu:
- Kernel & APT Hardening: Applies SYN flood cookies,
rp_filter, redirect/source-route blocks, SUID core-dump protection, and99-keep-custom-configs(--force-confdef --force-confold) soapt upgradenever overwrites custom/etcconfigs. - Lockout-Safe SSH Hardening: Enforces
MaxAuthTries 3, keepalives, and disablesPasswordAuthenticationonly after verifying at least one valid SSH public key exists inauthorized_keys(withsshd -tpre-flight validation). - Dual-Stack IPv6 Firewall Mirror (
hestia-ipv6-guard): Closes HestiaCP's IPv6INPUT ACCEPTblind spot on dual-stack cloud servers by dynamically mirroring HestiaCP's open ports into an isolatednftablestable ip6 hestia_ipv6_guardwhile preserving ICMPv6 Neighbor Discovery. - Upgrade-Proof Web/Webmail Filters & Desync Healer: Deploys
.localFail2Ban overrides (wordpress-xmlrpc.localforxmlrpc.php+wp-login.php, plusroundcube-auth.localfixing Roundcube behind Nginx proxy, validated viafail2ban-client -t) and automatically heals post-update Fail2Ban <->iptablesdesyncs (50 4 * * *cron right after HestiaCP's04:41auto-update). - CrowdSec Collaborative IPS (
--crowdsec): Isolates CrowdSec LAPI on127.0.0.1:8099(zero port conflict with Apache:8080), dynamically detects the activehestia.confstack (Nginx-onlyvsNginx+Apache2,VSFTPD/ProFTPD,Exim4/Postfix/Dovecot,MariaDB/PgSQL,Roundcube), protects HestiaCP:8083+ Multi-CMS logins (Drupal, Nextcloud, Laravel, PrestaShop, OpenCart, DokuWiki, MediaWiki, WordPress) + Nextcloud WebDAV sync whitelist (validated viacrowdsec -t), runscrowdsec-firewall-bouncer-nftablesimmune tov-update-firewall, and exempts the active SSH port from external blocklists so admins on shared VPNs are never locked out of SSH.
Logrotate Optimizer (v-optimize-logrotate)
- Upgrades Apache & Nginx log rotation from the HestiaCP default (
weekly rotate 4) todaily rotate 14, preventing domain logs from growing to 100MB+ during ad campaigns or sustained brute-force attacks. - Safe and persistent across HestiaCP updates. Backs up original configs and validates before applying.
Fail2Ban Email Optimizer (v-optimize-fail2ban)
- Balances email jail thresholds (
dovecot-iptablesandexim-iptables) from HestiaCP's strict defaults (7-day ban on 3 attempts) to balanced production values:maxretry = 5,findtime = 600s,bantime = 7200s(2 hours). - Solves the common issue where legitimate clients or shared webmail fetchers (Gmail POP3 Mail Fetcher, Outlook mobile) get locked out for an entire week due to accidental credential typos or background retries.
- Deploys to
/etc/fail2ban/jail.d/99-hestiacp-email-hardening.localto ensure precedence over/etc/fail2ban/jail.local, surviving all HestiaCP package upgrades without modifying core files. - Provides CLI diagnostic tools:
v-optimize-fail2ban --status,--dry-run, and--unban <IP>, plus 1-command standalone installation viabash install.sh --fail2ban.
Nginx .txt Cache Hardener (v-patch-nginx-txt-nocache)
- Removes
txtfrom Nginx staticexpires maxlocation blocks across PHP-FPM templates, active domain configs, and reverse-proxyPROXY_EXTdefinitions (web.confand HestiaCP proxy defaults) so.txtfiles (robots.txt,llms.txt,ads.txt,security.txt) are not cached indefinitely and remain clean across domain rebuilds.
Mail Forward Policy (v-mail-forward-policy)
- Prevents non-admin HestiaCP users (and non-admin API keys) from adding external mail forwards or external Catch-All redirects, protecting shared server IP reputation while allowing administrators (including during user impersonation) to add exceptions.
- Supports
SCOPE="user"(own mail domains only, preventing cross-tenant domain discovery) orSCOPE="server"(any mail domain hosted on the server), plus optionalALLOWLIST_DOMAINS, UI panel guidance, andv-mail-forward-policy --audit/v-security-audit(S67) scanning.
Installation (Step by Step)
Prerequisites
- A server running HestiaCP (core file patches are verified & pinned to 1.10.10; standalone scripts work across recent versions)
- Root access via SSH
gitinstalled (apt install gitif needed)
Step 1: Clone the repository
git clone https://github.com/webxtekstudio/hestiacp-toolkit.git /root/hestiacp-toolkit
cd /root/hestiacp-toolkit
(If your server already has an older clone at /root/hestiacp-useful-tools, GitHub redirects git pull automatically; you do not need to rename existing server directories.)
Step 2: Run the installer
# Interactive mode (recommended - lets you choose standard vs full install with CrowdSec + Crons):
bash install.sh
# - OR Non-Interactive CLI Flags -
bash install.sh --all # Install all modules + CrowdSec IPS + Automated Cron Jobs
bash install.sh --setup-crons # Configure recommended cron schedules only
bash install.sh --harden # Run only the 5-pillar Server Hardening module
bash install.sh --crowdsec # Run Server Hardening + CrowdSec Collaborative IPS (6 pillars)
bash install.sh --fail2ban # Run only the Fail2Ban Email Optimizer
bash install.sh --mail-forward-policy # Run only the Mail Forward Policy module
bash install.sh --allow-untested-hestia # Override the HestiaCP 1.10.10 core-patch version pin (manual runs)
This installs the selected tools to /usr/local/hestia/bin/ and creates default configs in /etc/ (existing configs are never overwritten on re-runs; original backups go to /var/backups/hestiacp-useful-tools/).
Step 3: Set up a schedule (if not already enabled in Step 2)
bash install.sh --setup-crons
Step 4: Test it
# Test backup for a single user via the Hestia panel, or run natively:
# (The 'yes' forces the Instant HTML Notification to trigger even on success)
v-backup-user admin yes
# Check it worked
ls -la /backup/
Optional: Add Remote Backups (B2, FTP, SFTP)
Want your backups also sent to the cloud? HestiaCP handles this natively - just run one command:
# Backblaze B2 (cost-effective cloud storage)
# 1. Create account at https://www.backblaze.com
# 2. Create a bucket (B2 Cloud Storage -> Create a Bucket)
# 3. Create an Application Key (App Keys -> Add a New Application Key)
# 4. Run:
v-add-backup-host b2 YOUR_BUCKET_NAME YOUR_KEY_ID YOUR_APP_KEY
# - OR -
# SFTP (any server with SSH access)
v-add-backup-host sftp backup.example.com username password
# - OR -
# FTP
v-add-backup-host ftp ftp.example.com username password
Verify it worked:
grep BACKUP_SYSTEM /usr/local/hestia/conf/hestia.conf
# Should show: BACKUP_SYSTEM='local,b2' (or local,sftp etc.)
After this, every backup created by our tool is automatically uploaded to your cloud destination by HestiaCP. Downloads, restores, and deletes from the panel all work natively.
Updating
cd /root/hestiacp-toolkit # or /root/hestiacp-useful-tools on existing installs
git pull
bash install.sh # safe to re-run - existing configs are never overwritten
Installing a single tool
Each tool can be installed standalone:
bash scripts/backup-core-patches/install.sh
bash scripts/mail-forward-policy/install.sh
bash scripts/system-report/install.sh
Disclaimer
These scripts are provided "as is". While used in production, review and test in your environment before deployment.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi