GoAdmio

save

Upload this server's GoAdmio settings (alert contacts, API keys, the root crontab, backup and rclone configuration) to go.blackhost.com under the server's hostname and a password, so they can be loaded again later

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/save keeps a copy of the server's configuration outside the server. If the server is rebuilt or replaced, the settings can be brought back with load instead of being typed in again.

The command reads the settings from GoAdmio's database and a few configuration files, and sends each item to https://go.blackhost.com/file.php. Every item is sent with:

It saves settings only. It doesn't copy hosted sites, mail, or databases. For those, see backup, snapshot, or serversync.

[!WARNING] save sends secrets in plain text to an external server. These include the Cloudflare API token, the ResellerClub API key, the WhatsApp API key, the root crontab, and the backup and rclone configuration files, which can contain storage credentials. Several security weaknesses in the command are listed in Security. Read that section before you use it.


Quick start

# Save the settings under this server's hostname, protected by a password
/go/save 'my-passphrase'

Syntax

/go/save [<password>] [<hostname>]
Form Behavior
/go/save <password> Saves under the hostname from /etc/hostname.
/go/save <password> <hostname> Saves under the hostname you give.
/go/save Uses the value stored in /etc/config as the password. Without that file, it prints Please enter password. and exits with status 1.

The arguments are positional and have no flags. To give a hostname, you must give the password first. The hostname must contain at least two dots, for example server1.example.com. Otherwise nothing is saved, with no message. Run the command as root.


Options

Argument Required Default Notes
<password> Yes, unless /etc/config exists The contents of /etc/config Hashed with MD5 as [<password>] before it is sent. A value read from /etc/config is sent as it is.
<hostname> No The contents of /etc/hostname The name the settings are saved under. It needs at least two dots.

Output

Outcome What you get
No password and no /etc/config Please enter password. and exit status 1.
Hostname has fewer than two dots Nothing at all, and nothing is saved.
Settings sent Nothing for most items. For the crontab and the configuration files, the remote server's reply is printed as it arrives.

Notes on the output:


Examples

# Save under the server's own hostname
/go/save 'my-passphrase'
# Save under a different hostname
/go/save 'my-passphrase' server1.example.com
# Use the password stored in /etc/config
/go/save
# Afterwards, remove the passphrase from your own shell's history
history -c
history -w

Troubleshooting

Symptom Likely cause Fix
Please enter password. No argument, and /etc/config doesn't exist. Pass a password.
Nothing happens, and nothing is printed The hostname has fewer than two dots, for example server or example.com. Pass a full host name as the second argument.
You can't tell whether it worked save doesn't report success. Check with load on a test server, using the same hostname and password.
Files named file.php?Hostname=... are in the folder you ran it from wget saves each response in the current directory, and the file names contain the settings and the password hash. Delete them (rm -f ./file.php\?*), and run save from an empty folder.
A restored value is cut off or wrong Most values are sent in the URL without URL-encoding, so characters such as &, +, #, and spaces are cut or changed. Check the restored value, and re-enter it if needed.
Some items are missing from the saved set The conditions in What is saved weren't met, for example Cloudflare needs both the account ID and the token. Set the missing values in GoAdmio, then save again.
Your password is in /var/log/go/save.log The log contains every argument. Remove the lines from the log and choose a new password.
The root crontab is left in /usr/local/goadmio/tmp/crontab.db The command writes it there and doesn't delete it. Delete the file if the crontab contains secrets.
It's slow Every item is a separate request, with a 5 second timeout and one try. Wait for it to finish.

Details

What happens on each run

flowchart TD
    A["save password hostname"] --> B["Log the call"]
    B --> C{"Password given, or /etc/config exists?"}
    C -- "No" --> X["Print: Please enter password, exit 1"]
    C -- "Yes" --> D["Hash the password, pick the hostname"]
    D --> E{"Hostname has two dots or more?"}
    E -- "No" --> Y["Do nothing, no message"]
    E -- "Yes" --> F["Read settings from the Config table"]
    F --> G["Send each setting to go.blackhost.com"]
    G --> H["Send crontab, timeout, uptime"]
    H --> I["Send the five configuration files"]

What is saved

Item Source Sent when
AdminEmail, CronEmail Config table The value contains @.
AdminMobile, WAInstanceID, WAAPIKey, SSHAlert, IMAPAlert Config table The value is not empty.
QueueNo Config table The value is 100 or more.
CloudflareAccountID, CloudflareAPIToken Config table Both are set.
ResellerclubIP, ResellerclubUserID, ResellerclubAPIKey Config table All three are set.
disable_functions disablefunctions The value contains a comma.
Crontab The root crontab It has at least one line.
Timeout /etc/timeout The value is 30 or more.
Uptime /var/go/etc/uptime The file is not empty.
backup.conf, secondary.conf, tertiary.conf, snapshot.conf /var/go/etc/ The file exists and is not empty.
rclone.conf /root/.config/rclone/ The file exists and is not empty.

How the password is used

When you pass a password, the command computes the MD5 hash of [<password>] (with the square brackets) and sends that hash with every request. The password itself is not sent, but the hash is the credential for the saved set, and it is not salted. Without an argument, the contents of /etc/config are used as the hash.

Security

Weakness Detail
Values are sent unencrypted by the script Only the transport (HTTPS) protects them. How the remote server stores them is not visible from this command.
Certificate not checked for most items The wget requests use --no-check-certificate, so an attacker between the server and go.blackhost.com could read or change them. The curl requests (crontab and files) do check it.
Secrets in the URL The wget requests put the values and the password hash in the URL's query string, where web servers and proxies often log them.
Secrets in the process list Every value is on a command line while the request runs, so other local users could see it with ps.
Passphrase in the log /var/log/go/save.log stores your password in plain text.
Leftover files wget saves each response in the current directory, with the secrets in the file name.
Weak hash An unsalted MD5 of a short passphrase can be guessed. Use a long, random passphrase.

See also

Command Description
load Load the server configuration
backup Back up one or all GoAdmio accounts
snapshot Back up, list, check, restore, and delete restic snapshots of hosting accounts
serversync Copy a whole GoAdmio server to another server over SSH
cloudflare Configure Cloudflare DNS records, SSL, caching, and security settings
disablefunctions Show, set, or clear PHP's disable_functions setting