Backup & restore
OkYouIn backs up its configuration into encrypted archives — on a schedule and on demand. An archive is everything you would need to rebuild the server as it was configured: users, factors, applications, policies, settings, keys and certificates. Restoring is done from the server’s command line, on the same server (to undo a change) or on a new one (when the old one is gone).
The master key
Section titled “The master key”Every archive is encrypted with the installation’s master key,
secrets/master_key in the installation directory, and does not contain it.
Never edit or replace the master key of a running installation: a new key cannot open the secrets already in the database.
What an archive contains
Section titled “What an archive contains”| In the archive (configuration) | Not in the archive (history and runtime data) |
|---|---|
| users, groups, administrator roles | the Access log, audit log and every sign-in journal |
| MFA enrolments (TOTP, Web Push devices, Telegram) | RADIUS sessions, alerts |
| applications, their rules, RADIUS secrets, custom dictionaries | console and SSO sessions, pending challenges |
| Windows agent hosts and their break-glass codes | GeoIP databases (downloaded and uploaded) |
| policies, network objects, time ranges, country lists | IP blocks, manual ones included |
| syslog destinations, e-mail templates | the AD machine account (domain join) |
| the console’s HTTPS certificate, OIDC signing keys, SAML certificates | |
| every setting: SMTP, LDAP, Telegram, GeoIP source, backup schedule… | |
| the license, installation ID and trial dates |
Scheduled backups
Section titled “Scheduled backups”Scheduled backups are on by default: every 24 hours, the last 5 kept. Change the interval and the number kept on Settings ▸ System ▸ Backup & Recovery under Schedule & Retention. The same page lists the archives, can Create backup now, and Download any archive. Each archive shows whether the running master key opens it (current key).
Archives are stored in a Docker volume on the server itself. Copy them off the host regularly — a backup that lives only on the server it protects is lost with it.
Backups from the command line
Section titled “Backups from the command line”From the installation directory:
./okyouin backup # create one archive now./okyouin backup list # archives, newest first; "current key" = this key opens it./okyouin backup export okyouin-backup-<UTC>.tar /some/dir # copy one out of the volumebackup export writes the archive with mode 600. A script that runs
./okyouin backup and then backup export to a mounted share is a simple way to
keep copies off the host.
Restore on the same server
Section titled “Restore on the same server”Use this to undo a bad change. From the installation directory:
./okyouin restore okyouin-backup-<UTC>.tarThe argument is a name from backup list, or a file on the server. The restore:
- checks that this installation’s master key opens the archive — before any downtime;
- stops the application, shows the archive’s version and asks you to type
yes; - writes a safety backup of the current state (restoring that one undoes the restore);
- loads the archive, starts the application and restarts the RADIUS and domain services.
| Option | Effect |
|---|---|
--yes | no question; required when there is no terminal |
--no-backup | no safety backup of the current state |
--force | restore an archive from another version — dangerous, avoid it |
The load is a single database transaction: if anything fails, nothing changes. Exit codes 2 (another key), 3 (another version or schema) and 4 (not confirmed) also mean nothing was changed.
What happens to the rest:
- The configuration is replaced: anything configured after the archive was made is gone.
- History stays: the audit log, Access log and journals on this server are kept.
- Live state ends: every console session, pending MFA challenges, unused enrolment links and SSO sessions. Users sign in again; a VPN user passes MFA again on the next connection.
Restore on a new server
Section titled “Restore on a new server”When the old server is gone:
-
Install the same version. The archive’s version and database schema must match. Install OkYouIn of the archive’s version, with the saved master key:
Terminal window OKYOUIN_MASTER_KEY_FILE=/path/to/master_key ./install.sh --images <image archive> -
Restore the archive. There is nothing on the new server to keep:
Terminal window ./okyouin restore /path/to/okyouin-backup-<UTC>.tar --no-backup -
Sign in with an account from the archive.
-
Redo what is not in the archive:
- join the AD domain again if you use MS-CHAPv2 (the LDAP configuration’s Domain tab);
- GeoIP databases come back with their daily download, or at once with
Update now on Settings ▸ Integrations ▸ GeoIP; uploaded
.mmdbfiles must be uploaded again; - IP blocks start empty: re-enter manual blocks under Logging ▸ Blocked IPs.
Keep the same public URL as before: Web Push devices and passkeys are bound to it, and the OIDC and SAML applications know the server by it. With another address users must enroll their Web Push device again.
The license, installation ID and trial dates are in the archive, so the license stays valid on the new server — see Licensing & trial.
Backups on a cluster
Section titled “Backups on a cluster”On a high-availability cluster:
- The scheduled backup runs on the current leader and lands in that node’s volume; after a failover archives are spread across nodes. A manual backup runs on any node that reaches the primary. Copy archives off every node.
- A node cut off from the primary takes no backup and no restore.
- A restore runs on the leader only, and only while every database node
streams from it. Find the leader with
./okyouin cluster status, copy the archive there (./okyouin backup exporton the node that holds it), and run./okyouin restoreon the leader. Before anything stops it checks the cluster and refuses with the reason: exit 6 (not the leader — it names the leader), 5 (no writable primary) or 7 (a node not streaming;--allow-degradedgoes on knowingly). The other nodes take the restored data by replication. - Each archive made on a cluster node also carries the cluster’s certificate
authority, sealed under the master key. If the alert Backup without the etcd
CA appears, run
./okyouin seal-etcd-caand then./okyouin backupon that node.