features.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. package envknob
  4. import (
  5. "errors"
  6. "runtime"
  7. "tailscale.com/version"
  8. "tailscale.com/version/distro"
  9. )
  10. // CanRunTailscaleSSH reports whether serving a Tailscale SSH server is
  11. // supported for the current os/distro.
  12. func CanRunTailscaleSSH() error {
  13. switch runtime.GOOS {
  14. case "linux":
  15. if distro.Get() == distro.Synology && !UseWIPCode() {
  16. return errors.New("The Tailscale SSH server does not run on Synology.")
  17. }
  18. if distro.Get() == distro.QNAP && !UseWIPCode() {
  19. return errors.New("The Tailscale SSH server does not run on QNAP.")
  20. }
  21. // otherwise okay
  22. case "darwin":
  23. // okay only in tailscaled mode for now.
  24. if version.IsSandboxedMacOS() {
  25. return errors.New("The Tailscale SSH server does not run in sandboxed Tailscale GUI builds.")
  26. }
  27. case "freebsd", "openbsd":
  28. default:
  29. return errors.New("The Tailscale SSH server is not supported on " + runtime.GOOS)
  30. }
  31. if !CanSSHD() {
  32. return errors.New("The Tailscale SSH server has been administratively disabled.")
  33. }
  34. return nil
  35. }