Skip to main content

Tutorial: How to Restore Access Server Configuration on Docker

Abstract

How to recover your Docker container running Access Server using SQLite3 dump backup files.

Overview

Use this tutorial to restore or load an Access Server configuration on a Docker container using backup files. You can do this to recover an Access Server or move to a new Access Server installation on Docker.

If you're not running Access Server on Docker, refer to Tutorial: How to Recover a Server with SQLite3 Dump Backup Files.

  • Backup configuration files.

  • An installed Access Server where you'll restore the backup configuration.

    Caution

    If you follow these steps, the current configuration of Access Server is wiped out entirely and replaced with the contents of the backup files. You can't combine a backup set of information from one server with another production server.

  • Docker Linux host console access and the ability to get root access.

While creating backups can be done with Access Server up and running, restoring a backup to a new installation of Access Server on Docker must be done with the Access Server container instance turned off. We assume you have an Access Server installation to which you wish to restore a backup set. Our instructions on restoring a backup include steps to stop the Access Server container instance, restore the backup set, and start the Access Server container instance again.

Tip

For these commands, we assume that the backup files are located in the <data_folder> directory. Adjust the commands as necessary for your files' location.

Important

Replace <data_folder> with the location for storing Access Server configuration files when you install the Access Server Docker image.

If you don't know the data folder used by the Access Server container, run this command:

docker inspect -f '{{ .HostConfig.Binds }}' openvpn-as

For example:

root@openvpnas:~# docker inspect -f '{{ .HostConfig.Binds }}' openvpn-as
[/openvpnas:/openvpn]

In the above output, the data folder is openvpnas, so this is the folder you need to use in the backup commands like this:

cd /openvpnas/etc/db
  1. Sign in to the Docker Linux host console and get root privileges.

  2. Run these commands to stop the Access Server container image, restore the backup, and then start the Access Server container image:

    docker stop openvpn-as
    which apt > /dev/null 2>&1 && apt -y install sqlite3
    which yum > /dev/null 2>&1 && yum -y install sqlite
    cd /<data_folder>/etc/db
    [ -e ../../config.db.bak ]&&(rm -f config.db;sqlite3<../../config.db.bak config.db)
    [ -e ../../certs.db.bak ]&&(rm -f certs.db;sqlite3 <../../certs.db.bak certs.db)
    [ -e ../../userprop.db.bak ]&&(rm -f userprop.db;sqlite3 <../../userprop.db.bak userprop.db)
    [ -e ../../log.db.bak ]&&(rm -f log.db;sqlite3 <../../log.db.bak log.db)
    [ -e ../../config_local.db.bak ]&&(rm -f config_local.db;sqlite3 <../../config_local.db.bak config_local.db)
    [ -e ../../cluster.db.bak ]&&(rm -f cluster.db;sqlite3 <../../cluster.db.bak cluster.db)
    [ -e ../../notification.db.bak ]&&(rm -f notification.db;sqlite3 <../../notification.db.bak notification.db)
    [ -e ../../as.conf.bak ]&&cp ../../as.conf.bak ../as.conf
    chmod 0600 /<data_folder>/etc/db/*.db
    chmod 0600 /<data_folder>/etc/as.conf
    docker start openvpn-as
    • These commands restore the configuration backup on your new Access Server running in Docker.

  1. If you use PAM authentication, the passwords are stored in the operating system. They will not be backed up in the configuration files from step one.

  2. If you encounter errors when attempting to transfer the files using WinSCP, it may be due to insufficient privileges. Connect using SCP and choose “sudo su -” from the Shell field.

  3. If you use Access Server's clustering function, your data is stored separately in a MySQL-type database. Rather than following the above steps for backing up and restoring database configurations, you will simply set up a new server, add it to the cluster, and then remove the old node from the cluster.