Server Tools
Modular Bash toolkit for Debian/Ubuntu servers: MySQL/MariaDB databases, Apache and Nginx virtual hosts, Let's Encrypt certificates, per-domain SSH users, cron jobs, UFW, Fail2Ban, logs and system status via CLI or text menu.
Server Tools
Server Tools is a modular Bash toolkit for managing Debian and Ubuntu servers. It takes over recurring administration tasks: MySQL/MariaDB databases, Apache or Nginx virtual hosts, Let's Encrypt certificates, per-domain SSH users, cron jobs, firewall, Fail2Ban, logs and system status.
The tool changes configurations, creates system users and deletes data. With
--yesall confirmation prompts are skipped, including the ones for deleting a DocumentRoot and for overwriting existing VHosts. Before using it in scripts, read the pages Usage and Security and safeguards.
There are two ways to operate it:
- CLI for scripts and automation, for example
server-tools db create --name mydb --user myuser. - Interactive text menu for manual administration:
server-toolswithout arguments.
All output, messages and menu texts are in English.
graph TD
A["server-tools (CLI or menu)"] --> B["Databases: MySQL/MariaDB"]
A --> C["VHosts: Apache or Nginx"]
A --> D["SSL: certbot, wildcard also with Nginx"]
A --> E["Per-domain SSH users: useradd and ACLs"]
A --> F["Cron jobs: /etc/cron.d"]
A --> G["Firewall: UFW"]
A --> H["Fail2Ban"]
A --> I["Logs and status"]
Documentation
| Page | Content |
|---|---|
| Installation | Installer, update, uninstall, MySQL access |
| Configuration | Config file, ST_* variables with defaults, validation rules |
| Usage | Invocation, global flags, --yes, menu, exit codes |
| CLI reference | All commands and options at a glance |
| Databases | Creating, privileges, backup, restore, import, export |
| Virtual hosts | PHP and proxy VHosts, redirects, audit |
| SSL certificates | Let's Encrypt, wildcard, renewal |
| SSH users | One user per domain, keys, ACL permissions |
| Cron jobs | Add, list, remove |
| Firewall, Fail2Ban, logs, status | System-level commands |
| Security and safeguards | Validation, backups, audit log, rollbacks |
| Troubleshooting | Messages, causes, known limitations |
| FAQ | Frequently asked questions |
| Technical details | Structure, flow, generated configurations, tests |
Features
| Feature | Description |
|---|---|
| Databases | Create database and user, privilege levels All, ReadOnly and ReadWrite, dumps as .sql.gz, export as .sql or .sql.gz, restore and import of .sql, .sql.gz or .sql.zip |
| Credential files | Credentials per database with PDO DSN and Symfony DATABASE_URL |
| VHosts | PHP-FPM VHosts and reverse proxy VHosts (optional WebSocket), aliases, redirects, security headers, logrotate |
| Webserver backend | Apache (default) or Nginx, globally via ST_WEBSERVER |
| VHost audit | Checks Apache VHosts for missing forwarded headers and deviating log paths |
| SSL | Certificates via certbot, wildcard via DNS challenge, daily renewal cron job. Create, delete and renewal only run with Apache, wildcard runs with both backends |
| SSH users | One user per domain, ACL-based permissions instead of chroot, key and password management |
| Cron jobs | Files in /etc/cron.d with schedule validation |
| Firewall | UFW: status, allow and deny ports; in the menu delete rules and enable or disable the firewall |
| Fail2Ban | Jail status, banned IPs, unban an IP |
| Logs | Show and search webserver, MySQL and audit logs |
| Status | Services, resources, software versions, configuration, backups |
| Safeguards | Input validation, configuration backup before deletion, rollback on errors, audit log |
Requirements
| Requirement | Note |
|---|---|
| Debian or Ubuntu | The scripts call apt-get and use Debian paths such as /etc/apache2 and /etc/nginx |
| Bash 4.4 or newer | |
| root | All commands except --version, --help and --config abort without root |
Apache (apache2ctl) or Nginx (nginx) |
Depending on ST_WEBSERVER, checked by almost all commands |
openssl, gzip, systemctl, realpath |
If one is missing, the tool aborts before the command |
mysql/mariadb and mysqldump/mariadb-dump |
Only for the database commands |
unzip |
Only for restore and import of .sql.zip |
| certbot | Only for SSL, installed via apt-get when needed |
ufw, fail2ban-client, setfacl/getfacl |
Only for firewall, Fail2Ban and SSH users |
| PHP-FPM | Sockets at /run/php/php<version>-fpm.sock for PHP VHosts |
License
MIT. Source code and issues: GitHub