Skip to content

cliproto: keep auth-token on RESTART without [P], like OpenVPN 2.x - #451

Draft
spryzz3n wants to merge 1 commit into
OpenVPN:masterfrom
spryzz3n:restart-keep-auth-token
Draft

spryzz3n wants to merge 1 commit into
OpenVPN:masterfrom
spryzz3n:restart-keep-auth-token

Conversation

@spryzz3n

Copy link
Copy Markdown

Fixes the OpenVPN 3 side of OpenVPN/openvpn#1099, where it was agreed that the client difference should be fixed in OpenVPN 3 rather than worked around in the 2.x server.

Problem
On a bare RESTART (without [P]), recv_halt_restart() purges the session ID (auth-token) and keeps the cached username/password. The OpenVPN 2.x client does the opposite: it purges the username/password and keeps the auth-token. As a result, OpenVPN 3 clients connected to a 2.x server with --explicit-exit-notify + --auth-gen-token have to re-authenticate interactively (e.g. SSO) after a server SIGUSR1, while 2.x clients reconnect with their token.

Change
On RESTART without [P], purge the username/password and keep the session ID, matching 2.x. HALT is unchanged. If the token is no longer valid, the existing AUTH_FAILED handling purges it (tested: full server restart without auth-gen-token-secret ends in SESSION_EXPIRED, so the user is asked to log in again).

Testing
ovpncli against an unmodified 2.x server (explicit-exit-notify 1 + auth-gen-token, SIGUSR1):

Before:

Clearing session-id
Client halt/restart: RESTART psid=0 reason=''
Creds: Username/Password              -> full re-authentication

After:

Clearing credentials
Client halt/restart: RESTART psid=0 reason=''
Creds: UsernameSessionId/SessionID    -> server: "Username/auth-token authentication succeeded"

ctest: 36/36 passed (6 DCO tests skipped, no ovpn-dco module in WSL). git clang-format: no changes.

Open questions (draft until answered)

  1. Do OpenVPN 3 based servers rely on a bare RESTART making the client drop its session ID (as opposed to RESTART,[P]:)? If so, this change would affect them.
  2. recv_halt_restart() is also called internally when the client rejects a pushed option ("RESTART,rejected pushed option: ..."). With this change the token is kept in that case too. Is that acceptable?

Once these are settled I'll send the patch to openvpn-devel as [PATCH OpenVPN3].

When the server sends a bare RESTART (without the [P] flag), the
OpenVPN 3 client currently purges its session ID (auth-token) while
retaining the cached username and password. OpenVPN 2.x handles this
differently: it clears the cached username and password but keeps the
auth-token.

This difference causes OpenVPN 3 clients connected to an OpenVPN 2.x
server using --explicit-exit-notify and --auth-gen-token to require
interactive authentication (for example, SSO) after a server restart
triggered by SIGUSR1, while OpenVPN 2.x clients reconnect using their
existing auth-token.

Align OpenVPN 3 with the OpenVPN 2.x behaviour: on RESTART without [P],
clear the cached username and password while preserving the session ID.
HALT handling remains unchanged. If the token is no longer valid, it is
cleared through the existing AUTH_FAILED handling.

Reported-at: OpenVPN/openvpn#1099

Signed-off-by: Kirthik Aditya <kirthikaditya@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant