OpenVPN Access Server
OpenVPN Access ServerをRaspberry Pi 4Bに構築してみました。
今回はPortainerのGUI画面からOpenVPN Access ServerのDockerコンテナを生成しました。2コネクションまでは無償利用可能なようです。
環境
- Raspbeyy Pi 4B
- Ubuntu 24.04 LTS (Arm64)
- Docker 28.5.2
- Portainer-CE 2.33.3
- OpenVPN Access Server 3.0.1
- Docker 28.5.2
- Ubuntu 24.04 LTS (Arm64)
構築
Docker
- 構築済のものを使用
Portainer
- 構築済のものを使用
OpenVPN関連パラメタの整理
指定するパラメタ
項目 値(例) 外部公開IPアドレス xxx.xxx.xxx.xxx 外部公開ポート番号 60000 外部からアクセスしたいLANサブネット 192.168.1.0/24
PortainerでDockerコンテナを作成
Portainerにログイン
https://192.168.11.24:9443ContainersメニューでAdd Container
以下のパラメタを指定して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 Cotainers >
openvpn-asを選択Container details > Container status > Logs を選択
Container logsで
openvpnアカウントのパスワードを確認する。検索条件
検索条件 指定値 Search pass Lines 1000 検索結果
Auto-generated pass = "i2vTb42zklZu". Setting in db...
OpenVPN Access Serverの設定
OpenVPN Access Serverにユーザ名
openvpnでログイン
https://192.168.11.2:943/adminログから検索したパスワードを指定する。
アカウント
openvpnのパスワードを更新
Users >openvpn> User Settings > Authentication > New passwordVPNサーバのパラメタ設定
VPN Server > Network Settings で以下を設定項目 値 Server Address / Hostname (or IP address) <外部公開IPアドレス> OpenVPN daemons / Protocol TCP TCP Port <外部公開ポート番号> ユーザを作成
UsersメニューでAdd New User
User01を追加ユーザのパスワードを設定
Users /User01/ User Settings / Authentication / New passwordユーザのプロファイルを作成
Certificate Management > VPN Client Certificates > New Connection Profile > Username >User01
Downloadファイル名変更
profile-userlocked.ovpn→profile-User01.opvnLANへの接続を許可
Access Controls > Global Access Rules > NAT > Subnet
+ Add new subnet
192.168.11.0/24
SaveRestart
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には、専用のAESハードウェアアクセラレーション機能は搭載されていません。しかし、CPUの命令セットの一部である「ARMv8」にはAESをサポートする拡張命令(NEON)が含まれており、これを利用することでソフトウェア的に高速なAES暗号化が可能です。
なのでそのままにする。
カスタマイズしたい場合は以下を操作すればよいかもしれない。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
クライアントの設定
- OpenVPN Connectアプリをインストール
- OpenVPN Connectアプリでprofile-User01.opvn をインポート
ルータの設定
- ポート変換
インターネットからの<外部公開ポート番号>宛ての通信をRaspberry Pi 4BのIPアドレスの<外部公開ポート番号>宛てに変換
Ubuntuのファイアウォール設定
- 受信設定
<外部公開ポート番号>/tcp、943/tcpへの受信許可を追加
docker composeでコンテナを生成するとしたら
- おそらくこんな感じ
docker-compose.yaml services:
openvpn-as:
image: openvpn/openvpn-as
container_name: openvpn-as
devices:
- /dev/net/tun:/dev/net/tun
cap_add:
- NET_ADMIN
- MKNOD
ports:
- 943:943
- <公開ポート番号>:<公開ポート番号>
volumes:
- <path to data>:/openvpn
restart: unless-stopped


