duplicate-cn ineffective when combined with override-username in SSO/OAuth2 scenarios
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 14.6k
- Forks
- 3.4k
- PR merge metrics
- No merged PRs in 30d
Description
Problem
When OpenVPN is used with OAuth2/SSO authentication (e.g., via openvpn-auth-oauth2), the duplicate-cn option becomes ineffective. Here's why:
The .ovpn config is shared across all users and contains an inline auth-user-pass block with a placeholder username — this is the recommended approach per OpenVPN documentation for SSO scenarios (see --auth-user-pass in client-options.rst):
<auth-user-pass>
username
no_password
</auth-user-pass>
Since all users share the same placeholder credentials:
- Every client connects with
CN=username(the placeholder) duplicate-cncheck runs at connect time — seesCN=username, allows the connection (it's the same CN after all)- The plugin then sends
client-authwithoverride-username: true, changing CN to the real user (e.g.alice) - But by now
duplicate-cnhas already done its check and has no effect
Result: the same user can have multiple active OpenVPN sessions simultaneously (from different devices), with no built-in mechanism to prevent it.
Why this matters
- Orphaned sessions accumulate, consuming server resources
- No security enforcement of "one session per user"
- The workaround (
duplicate-cn) exists in OpenVPN but is broken in SSO flows by design, since the real identity is only known after authentication completes
Suggested options for OpenVPN core
- Deferred duplicate check — run
duplicate-cncheck afterclient-auth/override-usernamehas set the final CN, not at connect time client-killon duplicate CN — when a new connection completes with a real CN that already has an active session, automaticallyclient-killthe old oneduplicate-cnre-evaluation — when CN changes via management interface (client-authwith override), re-evaluate the duplicate-cn constraint
Related
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the duplicate-cn check and the client-auth path where override-username changes the CN, including the management-interface handling mentioned in the issue. First determine which deferred check, re-evaluation, or client-kill behavior fits OpenVPN core; done means duplicate-cn reliably enforces one active session after the final username is known.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100