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 c4f40196429a1daf120423308e2f6793a564894c7be85430e7bba5008694d5f6
as-backup.sh f3ed2d326fbf218218bad5d439359a4cba4df36fc357319170fc0120c43c0dbc

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 BASH 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

Stops openvpnas before restoring, warns on version mismatch, and never deletes archives.

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 schedules nightly backups at 03:00 local time.

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