Securely pass a Coder session token to the (System) Network Extension
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- リファクタリング
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- macos, swift
調査の方向性
まず、issue に記載された NETunnelProviderProtocol.providerConfiguration の経路と NEPacketTunnelProvider.startTunnel のエントリポイントを追跡します。Keychain と XPC の代替案を確認し、その後、providerConfiguration に保存せずにセッショントークンを安全に引き渡すことを完了条件として定義します。
索引モデルが issue の本文から書いたものです。
説明
The Network Extension requires a session token for a Coder deployment in order to function. This is (and should be) stored in the macOS Keychain.
When registering the network extension as a system VPN, a NETunnelProviderProtocol can be configured and passed to the network extension when it's started (via NEPacketTunnelProvider.startTunnel). NETunnelProviderProtocol.serverAddress allows us to pass the access URL of the deployment.
NETunnelProviderProtocol.passwordReference is described as:
a persistent reference to a keychain item with the kSecClassGenericPassword class.
This field doesn't take into account the fact that the Network Extension might be a System Extension (as opposed to an app extension, used when submitting the application to the macOS/iOS App Store).
For reference, the WireGuard macOS app uses an app extension, running as the user, not root. It's able to pass a keychain reference to that app extension after modifying the item's keychain ACL.
In our case, there's a few problems:
- Whilst Keychain Access Groups exist to share keychain items between multiple sandboxed applications, they require all apps use the data protection keychain (as opposed to the file-based keychain).
Programs that run outside of the user context (such as our NE, running as root), cannot use the data protection keychain. [1] [2] - File-based keychains are accessible from both users and the network-extensions. However, the sandboxed application is only capable of writing to the user keychain, and the network extension is only capable of reading from the system keychain. The application would need elevated permissions to write to the system keychain, and use
passwordReferenceto pass a keychainpersistentRef. [3] [4]
The dev forum solution appears to be to send the credentials over some IPC, which would definitely be XPC in our case ([3], [4]). However, sending the session token over XPC in our case might lead to an annoying implementation: when the VPN is started it first must wait for yet another message containing the session token.
Instead, the current (hacked) solution involves just storing the session token within the NETunnelProviderProtocol.providerConfiguration dictionary. I believe the only difference between this and XPC is that this configuration is written to disk. We currently store Coder CLI tokens on disk too right now, though it'd be good to improve both situations in the future.
- 主要言語
- Swift
- スター
- 29
- フォーク
- 9
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/coder-desktop-macos のほかの issue
-
Authentication fails with invalid TLS certificate error on self-hosted Coder deployment (macOS)オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
coder/coder-desktop-macos#285 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
coder/coder-desktop-macos#230 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
coder/coder-desktop-macos#221 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 半日 初心者へのやさしさ 48/100
coder/coder-desktop-macos#220 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
coder/coder-desktop-macos#212 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
coder/coder-desktop-macos の issue をすべて見る
似ている issue
-
area:shell order:5 status:ready type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
krystianslowik/arkt#899 ·
メンテナーはふだん 1 日以内に返信
-
help wanted roadmap tests
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
🐞 bug 💠 component 🔍 triage v4 🧰 library
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
Orange-OpenSource/ouds-ios#1875 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
521xueweihan/HelloGitHub#4295 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100