System guide

Backups and recovery

Keeping the business’s phones recoverable after a failed server, a mistake or a break-in.

What to plan for

SlowPBX is one server. Mirrored disks protect against a failed disk; they don’t protect against a deleted file, a damaged database, a stolen server or a fire. For those you need a copy somewhere else, and the certainty that you can turn it back into a working phone system.

How much could be lostBackups are nightly, so at worst a day: the voicemail messages, call log entries and setting changes since the last one.
How long recovery takesAs long as it takes you to have a server ready; the restore itself is quick. Decide in advance where a replacement server would come from.
What survives a break-inThe copies at your office. The phone server can write backups but can’t read, change or delete the ones your office has already collected.

How it works

  1. Each night (02:30 office time, unless you change it) the server writes a backup into an outbox directory: its two databases whole, and every data file not already there.
  2. It is encrypted for a key that exists only on a machine at your office. The phone server holds the public half: it can lock backups and can’t open them.
  3. Your office’s machine collects it, signing in to the phone server with a key that can read the outbox and do nothing else. The phone server has no way to sign in to the office.
  4. The office keeps 30 nights. Nothing it has collected is ever overwritten, so a file damaged or deleted on the phone server later is still in the office’s copy.
  5. The office’s machine proves the backup, every morning, by restoring it into a scratch copy and checking it. Then it tells the phone server how that went.

A backup holds the settings and accounts, the call log, voicemail messages and greetings, the desk phones’ firmware and the spoken prompts. It does not hold the server’s configuration file, slowpbx.env.

Three things, three places

A restore needs all three of these. Keep them apart, so that no single loss or theft takes everything, and no single theft gives anyone a readable copy.

WhatWhere to keep it
The backupsThe office’s machine, collected nightly.
The backup keyThe office’s machine, with a copy somewhere safe and offline.
The master key, in slowpbx.envAway from both machines: a password manager, or printed and locked up.

Lose the backup key and no backup can be opened. Lose the master key and a restored system can’t open its voicemail, its stored passwords for outside services, or anyone’s two-factor sign-in. Neither can be recreated.

Setting it up

You need an always-on machine at the office that only trusted people can reach: a Mac or a Linux machine. The bundle includes the SlowPBX program for both, and a ready-made scheduled job for a Mac. The bundle’s README has the commands; in outline:

  1. At the office, make the backup key. The command prints its public half.
  2. On the phone server, put that public half in slowpbx.env and reload the service. The first backup is made a few minutes later.
  3. On the phone server, allow the office’s collecting key to read the outbox and nothing else.
  4. At the office, run the morning job once by hand (backup pull), and see it appear under Settings, then Backups. Then schedule it for each morning, an hour or so after the backup. A Mac that was asleep at that time runs it when it wakes.

The office’s machine needs no password for its report. The phone server sends it a question that only the backup key can open, so only the machine that can read the backups can report on them.

Where you can, let the office reach the phone server’s SSH only through a private link such as a VPN between the two, not across the open internet. Calls never use that link, so if it is down only the backup waits.

Watching it

Settings, then Backups, shows both halves: the last backup the phone server made, and each morning’s report from the office’s machine, with the backup it collected and whether it restored.

The phone server alerts owners and administrators in their apps when:

The alerts begin with the first report. Until the office’s machine has reported once, the phone server doesn’t expect it to.

Checking a backup

A backup nobody has restored is a hope. So the office’s morning job restores the newest backup into a scratch directory every day, and checks that:

Then it removes the scratch copy. One check is left for you, because the office’s machine doesn’t hold the master key: that every voicemail file can be opened with it. Run the backup verify command with the master key supplied once after setting up, and every three months. Use the same occasion to check that the backup key’s offline copy and the master key’s copy are where you think they are.

Rebuilding the server

  1. Prepare a new server as for a first install and unpack the bundle, but don’t run setup yet.
  2. Put back slowpbx.env, with the same master key.
  3. Bring the office’s copy and the backup key to the new server, and run backup restore. It refuses to write over existing data and stops at the first file that doesn’t match.
  4. Run setup.sh. It finds the restored data and starts the service. Then remove the backup key from the phone server.
  5. If the server’s address changed, point the host name at it, and update the office’s firewall and the webhook address at Telnyx if you named the server by address.
  6. Check it: sign in, play a voicemail message, look at the call log, place a call and take one.

A restore doesn’t bring back anything since the last backup, or calls that were in progress. Desk phones and apps that were linked when the backup was made stay linked.

To go back to an earlier night, for example after a mistaken deletion, name that night’s backup in the command.

While the server is down

Write the plan down, with where each of the three things is kept and who can get at them, and keep a printed copy. The day you need it, the server that held your notes may be the one that failed.

← The call logRoles →