Documentation
¶
Overview ¶
Package control is lys-secrets' login channel: a unix socket in the user's runtime directory through which lys-login's login and lock screens hand over the password they just verified, so the login collection unlocks with it, and through which a password change moves the login collection from the old password to the new. No password crosses D-Bus. Only processes of the same user may connect, checked with SO_PEERCRED.
Wire format: the client sends one request byte, then each of the request's passwords as a big-endian u32 length and the bytes (unlock: the password; rekey: the old password, then the new); the server answers one status byte.
Index ¶
- Variables
- func Listen(path string) (*usersock.Listener, error)
- func ReadPassword(r io.Reader) ([]byte, error)
- func Rekey(path string, old, next []byte) error
- func Serve(ctx context.Context, ln *usersock.Listener, l Login)
- func SocketPath(env xdg.Env) (string, error)
- func Unlock(path string, password []byte) error
- type Login
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotRunning = errors.New("lys-secrets is not running") ErrWrongPassword = errors.New("lys-secrets: the password does not unlock the login collection") )
Errors a client tells apart. ErrWrongPassword is also what a Login returns, or wraps, for a password that does not open the login collection.
Functions ¶
func Listen ¶
Listen binds the socket at path in a 0700 directory, replacing a stale socket a dead server left.
func ReadPassword ¶
ReadPassword reads a password whatever started the process wrote to an inherited descriptor (--unlock-fd): the whole stream, without a trailing newline.
func Rekey ¶
Rekey asks the lys-secrets serving path to move the login collection from the password old to next, as a password change does. No server is ErrNotRunning; an old password that does not open the login collection, which next does not open either, is ErrWrongPassword.
func SocketPath ¶
SocketPath is $XDG_RUNTIME_DIR/lys-secrets/control as env resolves it, so a process may find the socket of a session other than its own; an error when XDG_RUNTIME_DIR holds no absolute path, since there is no other place the user's session agrees on.
Types ¶
type Login ¶
type Login interface {
// UnlockLogin unlocks it with the login password.
UnlockLogin(password []byte) error
// RekeyLogin moves it from the login password old to next.
RekeyLogin(old, next []byte) error
}
Login is the login collection as the socket serves it; a password that does not open it is an error matching ErrWrongPassword.