OpenVPN Access Server

Safe, scriptable backups for Access Server.

Timestamped archives, named restore points, and version-aware rollback — all from a single portable shell script. No daemon, no agent.

$bash <(curl -fsS https://as-backup.devopenvpn.net/install.sh)
SHA-256 checksums
install.sh af0ed243183da25c27561c5e7c162a8dba9c9bb519e62b07f702a84cd5598f4c
as-backup.sh 8300d528da0c961f5993d21e909b1241db816cd9c39e794b901eebc24565967e

root@openvpnas2: ~

root@openvpnas2:~# 
Demo
What it does

Predictable backups, audit-ready restores.

Built for production Access Server hosts. Adds no service to maintain — just a script, optionally wired into systemd or cron.

Version-aware restore points

Every archive carries the Access Server version, a Unix timestamp, and an optional comment — surfaced in --list and matched on restore.

v1-1779873532-v3-1-0-cHJlLXVwZ3JhZGU.tar.gz
schema backup ID AS version comment (base64)

Single POSIX shell script

Drops into /usr/local/bin. Runs with the shell and utilities already on the host.

Database-aware

Reads as.conf and exports SQLite or MySQL with the matching toolchain.

Scheduled by default

Installer detects systemd timers first; falls back to cron when systemd is absent.

Safe by design

Takes a backup before every restore, warns on version mismatch, and only prunes scheduled backups beyond the number you choose to keep.

Command reference

Three verbs. That's it.

Create backups with optional comments, list archives for audits, and restore by the timestamp ID printed in --list.

All output is parseable. Pass --no-header to --list for scripts.

backup Create an archive

No arguments runs a standard backup. Add a comment with -c.

$ as-backup.sh -c "pre-upgrade"
Backup created: /usr/local/openvpn_as/etc/backup/2026/v1-1779873532-v3-1-0-cHJlLXVwZ3JhZGU.tar.gz Backup ID: 1779873532

list Inspect existing archives

Print all backups, suppress headers for scripts, or filter to one AS version.

$ as-backup.sh --list
ID DATE (UTC) AS VERSION COMMENT 1779873513 2026-05-27 09:18:33 3.1.0 - 1779873515 2026-05-27 09:18:35 3.1.0 - 1779873532 2026-05-27 09:18:52 3.1.0 pre-upgrade

restore Roll back by ID

Pass the timestamp ID from the first column. The script stops Access Server, restores, and starts it back up.

$ as-backup.sh --restore 1779873532
Restore complete from backup ID: 1779873532

Environment variables

Override defaults when running the script or via systemd unit / cron environment.

Variable Default Required Purpose
BACKUP_ROOT /usr/local/openvpn_as/etc/backup no Archive destination root.
AS_CONF /usr/local/openvpn_as/etc/as.conf no Access Server configuration file.
DB_DIR /usr/local/openvpn_as/etc/db no Local SQLite database directory.
Installation

One command. Daily backups from then on.

The installer drops the script into /usr/local/bin, picks systemd or cron based on what's available, and asks how often to back up (hourly, daily or weekly) and how many scheduled backups to keep.

1
Run the installer as root
$bash <(curl -fsS https://as-backup.devopenvpn.net/install.sh)
2
Verify the timer is active
$systemctl list-timers as-backup.timer
3
Take a baseline snapshot
$as-backup.sh -c "baseline"
Host requirements

Standard administrative tooling.

Expects normal Access Server host conditions. Everything except mysqldump and mysql ships on a default AS install.

root
Backup and restore privileges
sacli
Available on PATH
tar · gzip
Archive creation
sqlite3
Local database dumps
mysqldump
If any DB uses MySQL
mysql
For restoring MySQL archives
Theme