OpenVPN Access ServerをRaspberry Pi 4Bに構築してみました。
今回はPortainerのGUI画面を使ってOpenVPN Access ServerのDockerコンテナを生成しました。
2コネクションまでは無償利用可能なようです。

Self-Hosted VPN: Access Server | OpenVPN
Self-Hosted VPN: Access Server | OpenVPN
Secure your private business network with a self-hosted VPN, Access Server, ideal for cloud or on-premise setups. Free with 2 simultaneous VPN connections.

https://openvpn.net/access-server/
https://hub.docker.com/r/openvpn/openvpn-as

2025-11-15

https://docs.portainer.io/faqs/known-issues/known-compatibility-issues-with-docker-engine-29.0.0
PortainerはDocker 29と互換性がないという情報があったので試してみました。確かにDocker 29にバージョンアップしたところ動作しなくなりましたが以下のワークアラウンドで動作するようになりました。
https://github.com/portainer/portainer/issues/12925#issuecomment-3516549977

sudo systemctl edit docker.service
# sudo EDITOR=vim systemctl edit docker.service
[Service]
Environment=DOCKER_MIN_API_VERSION=1.24
sudo systemctl restart docker.service

環境

  • Raspbeyy Pi 4B
    • Ubuntu 24.04 LTS (Arm64)
      • Docker 28.5.2
        • Portainer-CE 2.33.3
        • OpenVPN Access Server 3.0.1

構築

Docker

  • 構築済のものを使用

Portainer

  • 構築済のものを使用

OpenVPN関連パラメタの整理

  • 指定するパラメタ

    項目 値(例)
    外部公開IPアドレス xxx.xxx.xxx.xxx
    外部公開ポート番号(TCP) 60000
    外部からアクセスしたいLANサブネット 192.168.1.0/24

PortainerでDockerコンテナを作成

  1. Portainerにログイン
    https://192.168.11.24:9443

  2. ContainersメニューでAdd Container

  3. 以下のパラメタを指定してDeploy the container

    分類 項目
      Name openvpn-as
    Image Configuration Image openvpn/openvpn-as:latest
    Network ports configuration Port mapping 943, 943, tcp
        <外部公開ポート番号>, <外部公開ポート番号>, tcp
    Advanced container settings Restart Policy Unless stopped
      Capabilities NET_ADMIN
  4. Cotainers > openvpn-asを選択

  5. Container details > Container status > Logs を選択

  6. Container logsでopenvpnアカウントのパスワードを確認

    • 検索条件

      検索条件 指定値
      Search pass
      Lines 1000
    • 検索結果(例)

      Auto-generated pass = "i2vTb42zklZu". Setting in db...

OpenVPN Access Serverの設定

  1. OpenVPN Access Serverにユーザ名openvpnでログイン
    https://192.168.11.2:943/admin

    ログから検索したパスワードを指定します。

  2. アカウントopenvpnのパスワードを更新
    Users > openvpn > User Settings > Authentication > New password

  3. VPNサーバのパラメタ設定
    VPN Server > Network Settings で以下を設定

    項目
    Server Address / Hostname (or IP address) <外部公開IPアドレス>
    OpenVPN daemons / Protocol TCP
    TCP Port <外部公開ポート番号>
  4. ユーザを作成
    UsersメニューでAdd New User
    User01を追加

  5. ユーザのパスワードを設定
    Users > User01 > User Settings > Authentication > New password

  6. ユーザのプロファイルを作成
    Certificate Management > VPN Client Certificates > New Connection Profile > Username > User01
    Download

  7. ファイル名変更
    profile-userlocked.ovpnprofile-User01.opvn

  8. LANへの接続を許可
    Access Controls > Global Access Rules > NAT > Subnet で+ Add new subnet
    192.168.11.0/24を追加

  9. Restartで再起動

Status画面のwarningについて

  • CPU AES acceleration not available

    OpenVPN Access Server was not able to detect AES acceleration instruction on the CPU (AES-NI on x86_64/ARMv8 AES extensions). This often caused by virtualization not passing through the CPU features.

    Raspberry Pi 4Bに搭載されているBroadcom BCM2711プロセッサは、AESハードウェアアクセラレーション命令をサポートしていません。 一方で、ASIMD (Advanced SIMD、またはNEON) 命令はサポートしています。
    そのままにします。カスタマイズしたい場合は以下を操作すればよいかもしれません。

    VPN Server > Security / Encryption > Data-channel ciphers

  • OpenVPN data-channel offloading was requested but failed to activate

    OpenVPN data-channel offloading was requested but failed to activate. This typically happens if there is a configuration option that is incompatible with DCO or if the DCO kernel module could not be loaded.

    以下で抑止できます。
    VPN Server > Data Channel Offload > Use DCO if possible
    Off

クライアントの設定

  1. OpenVPN Connectアプリをインストール
  2. OpenVPN Connectアプリでprofile-User01.opvn をインポート

ルータの設定

  • ポート変換
    インターネットからの<外部公開ポート番号>宛ての通信をRaspberry Pi 4BのIPアドレスの<外部公開ポート番号>宛てに変換

Ubuntuのファイアウォール設定

  • 受信設定
    <外部公開ポート番号>/tcp、943/tcpへの受信許可を追加

コンテナの自動アップデート設定

  1. Portainerでwatchtowerコンテナを作成

    項目
    Name watchtower
    Image containrrr/watchtower:latest
    Volume(Bind) /var/run/docker.sock:/var/run/docker.sock
    Restart policies Unless Stopped

    デフォルト設定では全てのコンテナを対象とした初回のチェックが24時間後にスケジュールされました。

    VPNは狙われやすいので最新バージョンを保つようにしよう。

利用

Arch Linuxクライアントからの接続

Arch LinuxにOpenVPN接続プロファイルをインポートしてインターネット経由で接続し、LAN内のOpenVPNの管理者画面を表示

スマートフォンからの接続

OpenVPN接続プロファイルをインポートしてインターネット経由で接続
外出中にEPGStationの表示や予約ができて便利