duplicate-cn ineffective when combined with override-username in SSO/OAuth2 scenarios

オープン
#1,078 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
c

調査の方向性

duplicate-cn チェックと、override-username によって CN が変更されるクライアント認証パスを追跡し、issue で言及されている management-interface の処理も含めます。まず、どの遅延チェック、再評価、または client-kill の動作が OpenVPN core に適合するかを判断します。完了の条件は、最終的なユーザー名が判明した後に duplicate-cn がアクティブなセッションを 1 つに確実に制限することです。

索引モデルが issue の本文から書いたものです。

説明

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-cn check runs at connect time — sees CN=username, allows the connection (it's the same CN after all)
  • The plugin then sends client-auth with override-username: true, changing CN to the real user (e.g. alice)
  • But by now duplicate-cn has 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

  1. Deferred duplicate check — run duplicate-cn check after client-auth / override-username has set the final CN, not at connect time
  2. client-kill on duplicate CN — when a new connection completes with a real CN that already has an active session, automatically client-kill the old one
  3. duplicate-cn re-evaluation — when CN changes via management interface (client-auth with override), re-evaluate the duplicate-cn constraint

Related

  • openvpn-auth-oauth2 issue #992 — same problem from auth-plugin perspective
  • PR #993 — proposed kill-duplicate-username feature
  • OpenVPN docs --auth-user-pass: the username-only flag and inline dummy password approach are both documented as valid SSO patterns
主要言語
C
スター
14.8k
フォーク
3.4k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenVPN/openvpn のほかの issue

OpenVPN/openvpn の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。