os-tailscale: pre-auth key is not used when tailscaled.state is missing or holds a stale profile

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
shell
領域
backend, devops

調査の方向性

Start by reading the rc.conf.d/tailscaled logic described in the issue and compare its state-file check with the proposed tailscale status --json check after the daemon starts. Trace how service startup builds the tailscale up arguments for missing state and a logged-out profile. Done means a configured pre-auth key is used in both cases, while an already logged-in node does not reuse it.

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

説明

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

Since #5047, rc.conf.d/tailscaled passes --auth-key only when tailscaled.state exists and has no "_current-profile":

if [ -f /var/db/tailscale/tailscaled.state ]; then
	if ! grep -q '"_current-profile"' /var/db/tailscale/tailscaled.state; then
		tailscaled_up_args_ext="--auth-key=..."
	fi
fi

That fixed the key being reused at boot (#4661), but leaves two cases where a valid, unused pre-auth key is never passed to tailscale up:

  1. No state file yet. The rc script reads its config before tailscaled creates tailscaled.state, so the first start runs tailscale up without --auth-key. It prints a login URL and times out ("timeout waiting for Tailscale service to enter a Running state"). A second start then passes the key and joins.
  2. Stale profile. Removing the plugin leaves /var/db/tailscale in place. If the node was then deleted from the tailnet, the old profile is still in tailscaled.state. After reinstalling the plugin and setting a new pre-auth key, the key is never passed; tailscale status shows Logged out., and Services start/restart returns Error (1). Recovery needs a shell: stop tailscaled, move tailscaled.state and profile-data aside, then start twice (case 1).

To Reproduce

Case 2:

  1. Install os-tailscale, set a pre-auth key, enable, and let the node join.
  2. Delete the node from the tailnet in the admin console.
  3. Remove the os-tailscale plugin, then install it again.
  4. Generate a new, unused pre-auth key, set it under VPN › Tailscale › Authentication, enable and apply.
  5. tailscale status shows Logged out.; the node never joins.

Case 1:

  1. With tailscaled stopped, move /var/db/tailscale/tailscaled.state aside.
  2. Start the service: tailscale up runs without --auth-key and prints a login URL.
  3. Start it again: it joins with the configured key.

Expected behavior

When a pre-auth key is configured and tailscaled is not logged in, tailscale up uses the key. That includes a missing state file, and a profile that is logged out or whose node no longer exists. For example, decide on tailscale status --json (BackendState = NeedsLogin) after tailscaled starts, instead of grepping the state file before it starts.

Describe alternatives you considered

  • Keep the grep, but also pass the key when the state file does not exist (fixes case 1 only).
  • Remove /var/db/tailscale when the plugin is removed, or offer a "reset node state" action (helps case 2).

Environment

OPNsense 26.1.11_10 (amd64)
os-tailscale 1.4
tailscale 1.98.5_1

主要言語
PHP
スター
1.2k
フォーク
932
平均マージ
1日 11時間
マージ済み PR(30日)
22

環境構築

はじめの一歩

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

opnsense/plugins のほかの issue

opnsense/plugins の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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