mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 03:25:35 +00:00
5611f290eb
This partially revertsd6e9fb1df0
, which modified the permissions on the tailscaled Unix socket and thus required "sudo tailscale" even for "tailscale status". Instead, open the permissions back up (on Linux only) but have the server look at the peer creds and only permit read-only actions unless you're root. In the future we'll also have a group that can do mutable actions. On OpenBSD and FreeBSD, the permissions on the socket remain locked down to 0600 fromd6e9fb1df0
. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
28 lines
763 B
Go
28 lines
763 B
Go
// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build !linux
|
|
|
|
package ipnserver
|
|
|
|
import (
|
|
"net"
|
|
|
|
"tailscale.com/types/logger"
|
|
)
|
|
|
|
func isReadonlyConn(c net.Conn, logf logger.Logf) bool {
|
|
// Windows doesn't need/use this mechanism, at least yet. It
|
|
// has a different last-user-wins auth model.
|
|
|
|
// And on Darwin, we're not using it yet, as the Darwin
|
|
// tailscaled port isn't yet done, and unix.Ucred and
|
|
// unix.GetsockoptUcred aren't in x/sys/unix.
|
|
|
|
// TODO(bradfitz): OpenBSD and FreeBSD should implement this too.
|
|
// But their x/sys/unix package is different than Linux, so
|
|
// I didn't include it for now.
|
|
return false
|
|
}
|