Skip to content
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

Should "Run exit node" GUI checkboxes also prevent computer from sleeping? #3574

Open
bradfitz opened this issue Dec 15, 2021 · 11 comments
Open
Labels
enhancement New feature or request exit-node Exit node related OS-macos OS-windows

Comments

@bradfitz
Copy link
Member

Tailscale 1.20 on both Windows and Mac will support a "Run exit node" checkbox.

I bet the first support requests we get will be people losing access to them when their desktops at home go to sleep.

Should running an exit node (or subnet router) prevent the computer from sleeping?

Should that be a separate checkbox?

Should we just warn people about them and have them use a separate app (like Caffeine etc)?

/cc @crawshaw @DentonGentry @mayakacz @tailscale/frontend

@bradfitz bradfitz added enhancement New feature or request exit-node Exit node related labels Dec 15, 2021
@crawshaw
Copy link
Member

I don't think it should be a separate checkbox. If you run as an exit node, sleep should be disabled. But I would be fine with shipping the first version without that, just with a warning.

@sonovawolf
Copy link
Contributor

Yeah, having an app that prevents your computer from sleeping but is not purpose-built for that effect is really unexpected, despite making total sense for this one feature. I would definitely give a warning, whether we are preventing sleep or not.

@bradfitz
Copy link
Member Author

Then next questions:

@crawshaw
Copy link
Member

On macOS, I/O kit can do it but I have no idea if we can use it from inside the sandbox. https://developer.apple.com/library/archive/qa/qa1340/_index.html

@nickoneill
Copy link
Contributor

Definitely possible from the sandbox, there are a few Mac App Store apps that provide this functionality. I'll have to take a look at various approaches to see if it is something that can be shared between all variants. My gut says tailscaled may need to take a different approach.

@gabefair
Copy link

gabefair commented Jan 8, 2022

And is there a way to listen for sleep requests from the OS?

This way a notification from tailscale could say tailscale is preventing this machine from sleeping while in use as an exit node

But also, I can think of times where I have tailscale in use as an exit node on my field laptop (for my home network to see what my laptop sees) but I still want my laptop to sleep when I close the lid.

@gabefair
Copy link

gabefair commented Jan 8, 2022

Or there should just be a small note under the use as exit-node checkbox reminding the user to disable sleep on host OS.

This way tailscale doesn't have to police the OS. Leaving tailscale to worry about tailscale

@d1vanloon
Copy link

PowerToys Awake may be a helpful reference for Windows: https://github.com/microsoft/PowerToys/tree/main/src/modules/awake

@dblohm7
Copy link
Member

dblohm7 commented Aug 31, 2022

https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate

@vwkd
Copy link

vwkd commented Jun 21, 2024

It'd be great if Tailscale could prevent a machine from sleeping more generally if there is any meaningful incoming traffic (other than keep-alive pings), not necessarily only when used as exit node. This is useful when one wants to connect through Tailnet to the machine, e.g. SSH, SMB, etc.

At least on macOS, currently incoming Tailscale traffic doesn't seem to prevent macOS from sleeping and cutting of any incoming SSH or SMB connections through Tailscale. This is different if the incoming connections come from the LAN which aren't cut off.

Currently, one workaround is having at least one other always-on machine in the LAN that proxies the traffic. This could be done either through Tailscale like on a Raspberry Pi or going back to a traditional Wireguard VPN like on the router itself.

Though maybe SSH or SMB connections create traffic too intermittently before the machine goes to sleep again, so the issue I'm seeing may actually be waking up on incoming Tailscale traffic as discussed in #306.

But it still feels like a sleep problem and a "prevent sleep" checkbox would mostly alleviate it, apart from the initial wake up which would still need the workaround and the chore to keep toggling a checkbox.

@gabefair
Copy link

Unlike startup apps, most OSs don't have a GUI method to view apps that are setup to block sleeping/shutdown. This is why if this feature is to be implemented, the OS would need to tell the user which app (tailscale) is blocking it from doing its job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request exit-node Exit node related OS-macos OS-windows
Projects
None yet
Development

No branches or pull requests

8 participants