| 1 |
# OpenVPN Management Interface Pass-through in openvpn-auth-oauth2 |
| 2 |
|
| 3 |
The OpenVPN management interface pass-through feature in openvpn-auth-oauth2 is designed to allow existing OpenVPN frontends to continue functioning while openvpn-auth-oauth2 is running. This feature is particularly useful because the OpenVPN daemon can support at most a single management client at any one time, and this feature has the same limitation. |
| 4 |
|
| 5 |
## How it Works |
| 6 |
|
| 7 |
openvpn-auth-oauth2 acts as a middleman, forwarding commands and responses between the frontend and the OpenVPN management interface. This allows the frontend to control and monitor the OpenVPN server as if it were directly connected to the management interface. |
| 8 |
|
| 9 |
## Configuration |
| 10 |
|
| 11 |
You can configure the pass-through feature using the following options: |
| 12 |
|
| 13 |
<table> |
| 14 |
<thead><tr><td>CLI configuration</td></tr></thead> |
| 15 |
<tbody><tr><td> |
| 16 |
|
| 17 |
```bash |
| 18 |
openvpn-auth-oauth2 \ |
| 19 |
--openvpn.pass-through.enabled=true \ |
| 20 |
--openvpn.pass-through.address=unix:///run/openvpn/pass-through.sock \ |
| 21 |
# --openvpn.pass-through.password=secret # optional |
| 22 |
# --openvpn.pass-through.socket-group=openvpn-auth-oauth2 # optional |
| 23 |
# --openvpn.pass-through.socket-mode=0660 # optional |
| 24 |
``` |
| 25 |
</td></tr></tbody> |
| 26 |
<thead><tr><td>env/sysconfig configuration</td></tr></thead> |
| 27 |
<tbody><tr><td> |
| 28 |
|
| 29 |
```ini |
| 30 |
OPENVPN_AUTH_OAUTH2_OPENVPN_PASS_THROUGH_ENABLED=true |
| 31 |
OPENVPN_AUTH_OAUTH2_OPENVPN_PASS_THROUGH_ADDRESS=unix:///run/openvpn/pass-through.sock |
| 32 |
# OPENVPN_AUTH_OAUTH2_OPENVPN_PASS_THROUGH_PASSWORD=secret # optional |
| 33 |
# OPENVPN_AUTH_OAUTH2_OPENVPN_PASS_THROUGH_SOCKET_GROUP=openvpn-auth-oauth2 # optional |
| 34 |
# OPENVPN_AUTH_OAUTH2_OPENVPN_PASS_THROUGH_SOCKET_MODE=0660 # optional |
| 35 |
``` |
| 36 |
</td></tr></tbody> |
| 37 |
<thead><tr><td>yaml configuration</td></tr></thead> |
| 38 |
<tbody><tr><td> |
| 39 |
|
| 40 |
```yaml |
| 41 |
openvpn: |
| 42 |
pass-through: |
| 43 |
enabled: true |
| 44 |
address: "unix:///run/openvpn/pass-through.sock" |
| 45 |
#password: "secret" # optional |
| 46 |
#socket-group: "openvpn-auth-oauth2" # optional |
| 47 |
#socket-mode: "0660" # optional |
| 48 |
``` |
| 49 |
</td></tr></tbody> |
| 50 |
</table> |
| 51 |
|
| 52 |
## Command Forwarding |
| 53 |
|
| 54 |
openvpn-auth-oauth2 forwards OpenVPN management commands through the pass-through socket. If `openvpn.pass-through.password` is configured, the client must authenticate with that password before commands are accepted. If it is not configured, commands are accepted immediately after connecting. Treat this socket as an administrator interface: a client with access can run powerful OpenVPN management commands such as disconnecting clients, changing daemon state, and entering dynamic credentials. |
| 55 |
|
| 56 |
The local session commands `hold`, `exit`, and `quit` are handled by openvpn-auth-oauth2 itself and are not forwarded to OpenVPN. |
| 57 |
|
| 58 |
Authentication decision commands are reserved for openvpn-auth-oauth2 because they are part of its own webauth flow: |
| 59 |
|
| 60 |
- `client-auth` |
| 61 |
- `client-auth-nt` |
| 62 |
- `client-deny` |
| 63 |
- `client-pending-auth` |
| 64 |
|
| 65 |
If a client sends a reserved command, openvpn-auth-oauth2 will respond with "ERROR: command not allowed" and log a warning message. Use a Unix socket with restrictive filesystem permissions, or otherwise restrict the listener to trusted administrator clients only. This is especially important when no pass-through password is configured. |