-
Notifications
You must be signed in to change notification settings - Fork 2
Fix #565: Tailscale — passwordless sudo, persistent auth, no more tower visits #631
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -504,8 +504,22 @@ install_tailscale() { | |||||||||||||||||||||||||
| ;; | ||||||||||||||||||||||||||
| esac | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Linux/WSL: ensure daemon is running | ||||||||||||||||||||||||||
| # Linux/WSL: set up passwordless sudo for tailscale so it auto-starts on boot | ||||||||||||||||||||||||||
| # without prompting. This is critical for grid resilience — nodes must reconnect | ||||||||||||||||||||||||||
| # to the mesh automatically after reboots. | ||||||||||||||||||||||||||
| if [ "$PLATFORM" = "linux" ] || [ "$PLATFORM" = "wsl" ]; then | ||||||||||||||||||||||||||
| if [ ! -f /etc/sudoers.d/tailscale ]; then | ||||||||||||||||||||||||||
| echo -e " Setting up passwordless sudo for tailscale (grid auto-reconnect)..." | ||||||||||||||||||||||||||
| echo "$USER ALL=(ALL) NOPASSWD: /usr/bin/tailscale, /usr/bin/tailscaled, /usr/sbin/tailscaled" | sudo tee /etc/sudoers.d/tailscale > /dev/null | ||||||||||||||||||||||||||
| sudo chmod 440 /etc/sudoers.d/tailscale | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| sudo chmod 440 /etc/sudoers.d/tailscale | |
| sudo chmod 440 /etc/sudoers.d/tailscale | |
| # Validate the new sudoers drop-in to avoid breaking sudo if there's a syntax error | |
| if ! sudo visudo -cf /etc/sudoers.d/tailscale; then | |
| echo -e " ${RED}❌ Failed to validate /etc/sudoers.d/tailscale with visudo${NC}" | |
| echo -e " ${YELLOW}Removing invalid sudoers file and leaving sudo configuration unchanged.${NC}" | |
| sudo rm -f /etc/sudoers.d/tailscale | |
| return 1 | |
| fi |
Copilot
AI
Mar 30, 2026
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.
Creating /etc/sudoers.d/tailscale with NOPASSWD for the full tailscale client effectively grants passwordless root for a very powerful admin surface (e.g., changing routing/DNS, bringing interfaces up/down). Consider making this opt-in (env flag / prompt), and/or narrowing the sudoers rule to the minimal commands/args actually required for boot/reconnect, or prefer the systemd service path instead of sudoers escalation.
Copilot
AI
Mar 30, 2026
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.
The previous implementation only attempted interactive auth when stdin was a TTY. The new flow always runs tailscale up and intentionally blocks, which will hang non-interactive runs (e.g., automation/DEPS_ONLY usage) and may cause CI timeouts. Please restore a non-interactive path (print instructions and return non-zero / skip) when [ -t 0 ] is false.
Copilot
AI
Mar 30, 2026
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.
Passing --accept-routes changes network behavior by automatically accepting subnet routes advertised by the tailnet. This can unexpectedly route traffic and is a security-sensitive default; consider making it opt-in/configurable rather than enabling unconditionally during install.
| sudo tailscale up --ssh --accept-routes 2>&1 | |
| # By default we do NOT auto-accept subnet routes; this is security-sensitive. | |
| # To enable route acceptance, set CONTINUUM_TAILSCALE_ACCEPT_ROUTES=true (or 1). | |
| local tailscale_args="--ssh" | |
| if [ "${CONTINUUM_TAILSCALE_ACCEPT_ROUTES:-}" = "1" ] || [ "${CONTINUUM_TAILSCALE_ACCEPT_ROUTES:-}" = "true" ]; then | |
| echo -e " ${YELLOW} Note: --accept-routes enabled via CONTINUUM_TAILSCALE_ACCEPT_ROUTES${NC}" | |
| tailscale_args="$tailscale_args --accept-routes" | |
| else | |
| echo -e " ${YELLOW} Note: subnet routes will NOT be auto-accepted.${NC}" | |
| echo -e " ${YELLOW} To enable, set CONTINUUM_TAILSCALE_ACCEPT_ROUTES=true before running install.${NC}" | |
| fi | |
| sudo tailscale up $tailscale_args 2>&1 |
Copilot
AI
Mar 30, 2026
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.
sudo tailscale up ... is run under set -e; if it exits non-zero (user aborts, auth fails, already up with conflicting prefs), the whole install script will terminate before reaching the follow-up status/error messaging. Wrap it in an explicit error-handling block (capture exit code) so the script can print a clear next-step message instead of exiting abruptly.
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.
The sudoers entry uses
$USER, which can beroot(e.g., if someone runs the script from a root shell whereSUDO_USERis empty). That would create a rule for the wrong principal. Use a derived non-root target user (e.g.,${SUDO_USER:-$(logname)}) and/or explicitly refuse to proceed if the target resolves to root.