Documentation ¶
Overview ¶
Package ipnauth controls access to the LocalAPI.
Index ¶
- func LookupUserFromID(logf logger.Logf, uid string) (*user.User, error)
- type ConnIdentity
- func (ci *ConnIdentity) Creds() *peercred.Creds
- func (ci *ConnIdentity) IsReadonlyConn(operatorUID string, logf logger.Logf) bool
- func (ci *ConnIdentity) IsUnixSock() bool
- func (ci *ConnIdentity) Pid() int
- func (ci *ConnIdentity) User() *user.User
- func (ci *ConnIdentity) WindowsUserID() ipn.WindowsUserID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnIdentity ¶
type ConnIdentity struct {
// contains filtered or unexported fields
}
ConnIdentity represents the owner of a localhost TCP or unix socket connection connecting to the LocalAPI.
func GetConnIdentity ¶
GetConnIdentity extracts the identity information from the connection based on the user who owns the other end of the connection. and couldn't. The returned connIdentity has NotWindows set to true.
func (*ConnIdentity) Creds ¶
func (ci *ConnIdentity) Creds() *peercred.Creds
func (*ConnIdentity) IsReadonlyConn ¶
func (ci *ConnIdentity) IsReadonlyConn(operatorUID string, logf logger.Logf) bool
IsReadonlyConn reports whether the connection should be considered read-only, meaning it's not allowed to change the state of the node.
Read-only also means it's not allowed to access sensitive information, which admittedly doesn't follow from the name. Consider this "IsUnprivileged". Also, Windows doesn't use this. For Windows it always returns false.
TODO(bradfitz): rename it? Also make Windows use this.
func (*ConnIdentity) IsUnixSock ¶
func (ci *ConnIdentity) IsUnixSock() bool
func (*ConnIdentity) Pid ¶
func (ci *ConnIdentity) Pid() int
func (*ConnIdentity) User ¶
func (ci *ConnIdentity) User() *user.User
func (*ConnIdentity) WindowsUserID ¶
func (ci *ConnIdentity) WindowsUserID() ipn.WindowsUserID
WindowsUserID returns the local machine's userid of the connection if it's on Windows. Otherwise it returns the empty string.
It's suitable for passing to LookupUserFromID (os/user.LookupId) on any operating system.