-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add option to allow TPM encryption #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Derek Kaser <[email protected]>
WalkthroughAdds TPM support controls and wiring: UI selection and warnings, new locale strings, a Config property, conditional startup parameter generation based on UseTPM, and removal of hardcoded TPM-related flags from the startup script. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI as Settings UI
participant Config as Config Handler
participant System as Startup Params
participant Tailscaled
User->>UI: Toggle "Allow TPM to Encrypt Node Key"
UI->>UI: Display/Update TPM warning & docs link
UI->>Config: Save `USE_TPM` value
Config->>System: Load `UseTPM`
System->>System: Build tailscaled params
alt UseTPM = true
System->>Tailscaled: Start tailscaled (default, TPM allowed)
else UseTPM = false
System->>Tailscaled: Start tailscaled with -encrypt-state=false -hardware-attestation=false
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-10-25T02:28:03.838ZApplied to files:
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/usr/local/emhttp/plugins/tailscale/include/Pages/Settings.php(2 hunks)src/usr/local/emhttp/plugins/tailscale/locales/en_US.json(2 hunks)src/usr/local/emhttp/plugins/tailscale/rc.tailscale(1 hunks)src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/Config.php(2 hunks)src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: dkaser
Repo: unraid/unraid-tailscale PR: 51
File: src/usr/local/emhttp/plugins/tailscale/rc.tailscale:14-14
Timestamp: 2025-10-25T02:28:03.838Z
Learning: In Tailscale 1.90.2+, the `-hardware-attestation` and `-encrypt-state` flags are valid command-line options for tailscaled, even though they may not be fully documented in public knowledge base articles yet. The `-hardware-attestation` flag uses hardware-backed keys (TPM 2.0) to bind node identity, and `-encrypt-state` encrypts the state file on disk.
📚 Learning: 2025-10-25T02:28:03.838Z
Learnt from: dkaser
Repo: unraid/unraid-tailscale PR: 51
File: src/usr/local/emhttp/plugins/tailscale/rc.tailscale:14-14
Timestamp: 2025-10-25T02:28:03.838Z
Learning: In Tailscale 1.90.2+, the `-hardware-attestation` and `-encrypt-state` flags are valid command-line options for tailscaled, even though they may not be fully documented in public knowledge base articles yet. The `-hardware-attestation` flag uses hardware-backed keys (TPM 2.0) to bind node identity, and `-encrypt-state` encrypts the state file on disk.
Applied to files:
src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.phpsrc/usr/local/emhttp/plugins/tailscale/locales/en_US.jsonsrc/usr/local/emhttp/plugins/tailscale/rc.tailscale
📚 Learning: 2025-11-15T03:15:08.212Z
Learnt from: dkaser
Repo: unraid/unraid-tailscale PR: 68
File: src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php:371-373
Timestamp: 2025-11-15T03:15:08.212Z
Learning: In the unraid-tailscale project, tailscaled accepts both single-dash and double-dash formats for command-line flags (e.g., both `-port` and `--port` are valid). The project uses single-dash format for consistency across daemon parameters in the System.php file.
Applied to files:
src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.phpsrc/usr/local/emhttp/plugins/tailscale/rc.tailscale
🧬 Code graph analysis (1)
src/usr/local/emhttp/plugins/tailscale/include/Pages/Settings.php (1)
src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/Info.php (1)
tr(66-69)
🔇 Additional comments (6)
src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/Config.php (1)
34-34: LGTM! TPM configuration property properly implemented.The
UseTPMproperty follows the established pattern for boolean configuration values, with a safe default offalsethat maintains backward compatibility.Also applies to: 60-60
src/usr/local/emhttp/plugins/tailscale/rc.tailscale (1)
14-14: LGTM! Startup command now uses dynamic parameters.Removing the hardcoded TPM-related flags in favor of
$TAILSCALE_CUSTOM_PARAMSallows the TPM feature to be controlled through the configuration system, as intended.src/usr/local/emhttp/plugins/tailscale/include/Pages/Settings.php (2)
105-116: LGTM! TPM UI control properly integrated.The TPM setting is appropriately placed in the advanced section with a warning handler that displays information before enabling. The default option is "No" (safe default), consistent with other security-sensitive settings.
303-311: LGTM! Warning system properly extended for TPM.The JavaScript warning logic correctly includes TPM messages and documentation link. The trailing comma added to the 'dns' entry improves maintainability.
src/usr/local/emhttp/plugins/tailscale/locales/en_US.json (1)
114-114: LGTM! TPM warning appropriately communicates risks.The warning clearly explains the implications of enabling TPM, including the hardware lock-in and potential need for reauthentication if TPM is disabled or locks out.
src/usr/local/php/unraid-tailscale-utils/unraid-tailscale-utils/System.php (1)
375-377: Ensure UseTPM configuration is validated against actual TPM 2.0 hardware availability.The code logic is correct—when
UseTPMis false, it explicitly disables the flags; when true, it omits them to use defaults. However, Tailscale will fail to start if-encrypt-stateor-hardware-attestationare enabled but the system lacks a functioning TPM 2.0 module. This is not a graceful degradation.The developer must ensure that the configuration system validates TPM 2.0 hardware availability before setting
UseTPMto true, otherwise the daemon will fail to start rather than handling the mismatch gracefully.
Signed-off-by: Derek Kaser <[email protected]>
Summary by CodeRabbit
New Features
User Interface
Documentation