Markus Michalski FAQ

Server Tools: Usage

Operating Server Tools: invocation, global flags and the effect of --yes, argument handling, output and exit codes, the interactive menu and what is only available in the menu or only via CLI.

Deutsche Version

Back to overview


Usage

Invocation

server-tools [--yes|-y] [--quiet|-q] <command> <action> [options]
server-tools                    # interactive menu
server-tools --version | -v
server-tools --config  | -c
server-tools --help    | -h
server-tools install | uninstall

The command names and their short forms:

Command Short form
db database
vhost
user
ssl
cron
firewall fw
fail2ban f2b
logs log
status

After installation the program is also available as st and servertools. All commands require root, except --version, --help and --config. The options of each command are listed in the CLI reference.

Global flags

Flag Effect
--yes, -y Answers every confirmation prompt with "yes"
--quiet, -q Accepted, but currently has no effect on the output

The flags are recognized and removed anywhere in the argument list before the command is evaluated. An option value that is exactly -y or -q is therefore also read as a flag.

What --yes confirms

--yes replaces every prompt with "yes", including the destructive ones:

Command Prompt that is skipped
db delete, db restore Deleting the database, overwriting on restore
vhost create Overwriting an existing VHost
vhost delete Deleting the VHost and, for VHosts with a DocumentRoot, deleting the entire directory /var/www/<domain>. Proxy VHosts have no DocumentRoot prompt, nothing under /var/www is deleted for them
user create Continuing without an existing Apache VHost
user delete Deleting the user
ssl delete Deleting the certificate
cron add Overwriting a cron file of the same name
cron remove Deleting every file in /etc/cron.d that contains the search pattern
fail2ban unban Unbanning from all jails
db delete, vhost delete "Continue without backup?" after a failed backup

Without --yes the answer to every prompt defaults to "no". A single y, Y, j or J is accepted.

Arguments

Output and exit codes

If you pass a password via --password, every local user can see it in the process list during the call, and it ends up in the shell history.

Interactive menu

sudo server-tools

The main menu shows the title line Server Tools v<version> and these entries:

No. Entry
1 Database Management ([mysql not installed] if the client or dump tool is missing)
2 Virtual Host Management
3 SSH User Management
4 SSL Certificate Management
5 Cron Job Management
6 Firewall Management
7 Fail2Ban
8 Log Viewer
9 System Status
10 Exit

Each submenu asks for the values one by one. An error in an action returns to the menu, not out of the program.

Action Menu
Assign a database to a different user (reassign) Database Management
Add a www redirect to an existing VHost Virtual Host Management
Add an HTTPS redirect to an existing VHost Virtual Host Management
Recreate all certificates SSL Certificate Management
Delete a firewall rule Firewall Management
Enable or disable the firewall Firewall Management

CLI only

Action Command
Check VHosts against the template vhost audit
Set ProxyPreserveHost per VHost vhost create --preserve-host

Example: set up a new site

server-tools vhost create --domain shop.example.com --php 8.3
server-tools ssl create --domain shop.example.com
server-tools db create --name shop_db --user shop_user
server-tools user create --domain shop.example.com --username shopdev
server-tools user add-key --username shopdev --key "ssh-ed25519 AAAA... dev@laptop"
server-tools firewall allow --port 443 --proto tcp

Next